[Webkit-unassigned] [Bug 118249] New: Fix cast-align warnings in WebCore/platform/graphics/texmap/TextureMapperGL.cpp

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jul 1 08:33:31 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=118249

           Summary: Fix cast-align warnings in
                    WebCore/platform/graphics/texmap/TextureMapperGL.cpp
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: New Bugs
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: ossy at webkit.org
                CC: allan.jensen at digia.com, noam at webkit.org


/home/oszi/WebKit/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp:894:59: warning: cast from 'char*' to 'uint32_t* {aka unsigned int*}' increases required alignment of target type [-Wcast-align]

void BitmapTextureGL::updateContents(const void* srcData, const IntRect& targetRect, const IntPoint& sourceOffset, int bytesPerLine, UpdateContentsFlag updateContentsFlag)
{
....
    char* data = reinterpret_cast<char*>(const_cast<void*>(srcData));
...
  swizzleBGRAToRGBA(reinterpret_cast<uint32_t*>(data), IntRect(adjustedSourceOffset, targetRect.size()), bytesPerLine / bytesPerPixel);   < ---- line 894
...
}

...
void BitmapTextureGL::updateContents(Image* image, const IntRect& targetRect, const IntPoint& offset, UpdateContentsFlag updateContentsFlag)
{
    if (!image)
        return;
    NativeImagePtr frameImage = image->nativeImageForCurrentFrame();
    if (!frameImage)
        return;

    int bytesPerLine;
    const char* imageData;

#if PLATFORM(QT)
    QImage qImage = frameImage->toImage();
    imageData = reinterpret_cast<const char*>(qImage.constBits());
    bytesPerLine = qImage.bytesPerLine();
#elif USE(CAIRO)
    cairo_surface_t* surface = frameImage.get();
    imageData = reinterpret_cast<const char*>(cairo_image_surface_get_data(surface));
    bytesPerLine = cairo_image_surface_get_stride(surface);
#endif

    updateContents(imageData, targetRect, offset, bytesPerLine, updateContentsFlag);   < ------ call!
}
...

The problematic data is come from cairo_image_surface_get_data(surface) or qImage.constBits().
Both of them contains BGRA data, so I think we can assume that they are 32 bit aligned.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list