Bug 118249 - Fix cast-align warnings in WebCore/platform/graphics/texmap/TextureMapperGL.cpp
Summary: Fix cast-align warnings in WebCore/platform/graphics/texmap/TextureMapperGL.cpp
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Csaba Osztrogonác
Depends on:
Reported: 2013-07-01 08:35 PDT by Csaba Osztrogonác
Modified: 2013-07-02 04:19 PDT (History)
6 users (show)

See Also:

Patch (1.70 KB, patch)
2013-07-01 08:38 PDT, Csaba Osztrogonác
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Csaba Osztrogonác 2013-07-01 08:35:28 PDT
/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)
    NativeImagePtr frameImage = image->nativeImageForCurrentFrame();
    if (!frameImage)

    int bytesPerLine;
    const char* imageData;

    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);

    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.
Comment 1 Csaba Osztrogonác 2013-07-01 08:38:30 PDT
Created attachment 205813 [details]
Comment 2 Csaba Osztrogonác 2013-07-02 02:13:29 PDT
ping for Qt and Cairo review.
Comment 3 Csaba Osztrogonác 2013-07-02 04:19:48 PDT
Comment on attachment 205813 [details]

Clearing flags on attachment: 205813

Committed r152283: <http://trac.webkit.org/changeset/152283>
Comment 4 Csaba Osztrogonác 2013-07-02 04:19:54 PDT
All reviewed patches have been landed.  Closing bug.