Changeset 134816 in webkit


Ignore:
Timestamp:
Nov 15, 2012 12:35:40 PM (11 years ago)
Author:
hclam@chromium.org
Message:

[chromium] WebGL texImage2D fails with deferred image decoding
https://bugs.webkit.org/show_bug.cgi?id=102310

Reviewed by Kenneth Russell.

Source/WebCore:

Skia's implementation of GraphicsContext3D::getImageData() uses ImageSource
to decode an image. When deferred image decoding is enabled this class
generates an ImageFrame marked as incomplete, which WebGL rejects. This results
in failing of texImage2D.

This change uses ImageDecoder directly instead of ImageSource. This skips
the code path of deferred image decoding. This behavior is correct because
GraphicsContext3D wants to decode the image differently with alpha not
premultiplied and color profile applied optionally.

Added a test to prove this change fixed the bug.

Test: fast/images/webgl-teximage2d.html

  • platform/graphics/skia/GraphicsContext3DSkia.cpp:

(WebCore::GraphicsContext3D::getImageData):

LayoutTests:

Added a test to exercise texImage2D with an Image object.

  • fast/images/webgl-teximage2d-expected.txt: Added.
  • fast/images/webgl-teximage2d.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r134815 r134816  
     12012-11-15  Alpha Lam  <hclam@chromium.org>
     2
     3        [chromium] WebGL texImage2D fails with deferred image decoding
     4        https://bugs.webkit.org/show_bug.cgi?id=102310
     5
     6        Reviewed by Kenneth Russell.
     7
     8        Added a test to exercise texImage2D with an Image object.
     9
     10        * fast/images/webgl-teximage2d-expected.txt: Added.
     11        * fast/images/webgl-teximage2d.html: Added.
     12
    1132012-11-15  Stephen Chenney  <schenney@chromium.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r134814 r134816  
     12012-11-15  Alpha Lam  <hclam@chromium.org>
     2
     3        [chromium] WebGL texImage2D fails with deferred image decoding
     4        https://bugs.webkit.org/show_bug.cgi?id=102310
     5
     6        Reviewed by Kenneth Russell.
     7
     8        Skia's implementation of GraphicsContext3D::getImageData() uses ImageSource
     9        to decode an image. When deferred image decoding is enabled this class
     10        generates an ImageFrame marked as incomplete, which WebGL rejects. This results
     11        in failing of texImage2D.
     12
     13        This change uses ImageDecoder directly instead of ImageSource. This skips
     14        the code path of deferred image decoding. This behavior is correct because
     15        GraphicsContext3D wants to decode the image differently with alpha not
     16        premultiplied and color profile applied optionally.
     17
     18        Added a test to prove this change fixed the bug.
     19
     20        Test: fast/images/webgl-teximage2d.html
     21
     22        * platform/graphics/skia/GraphicsContext3DSkia.cpp:
     23        (WebCore::GraphicsContext3D::getImageData):
     24
    1252012-11-15  Jer Noble  <jer.noble@apple.com>
    226
  • trunk/Source/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp

    r122175 r134816  
    3333#include "BitmapImage.h"
    3434#include "Image.h"
    35 #include "ImageSource.h"
     35#include "ImageDecoder.h"
    3636#include "NativeImageSkia.h"
    3737#include "SkColorPriv.h"
     
    5757    bool hasAlpha = skiaImage ? !skiaImage->bitmap().isOpaque() : true;
    5858    if ((!skiaImage || ignoreGammaAndColorProfile || (hasAlpha && !premultiplyAlpha)) && image->data()) {
    59         ImageSource decoder(ImageSource::AlphaNotPremultiplied,
    60                             ignoreGammaAndColorProfile ? ImageSource::GammaAndColorProfileIgnored : ImageSource::GammaAndColorProfileApplied);
    61         // Attempt to get raw unpremultiplied image data
    62         decoder.setData(image->data(), true);
    63         if (!decoder.frameCount() || !decoder.frameIsCompleteAtIndex(0))
     59        // Attempt to get raw unpremultiplied image data.
     60        OwnPtr<ImageDecoder> decoder(adoptPtr(ImageDecoder::create(
     61            *(image->data()), ImageSource::AlphaNotPremultiplied,
     62            ignoreGammaAndColorProfile ? ImageSource::GammaAndColorProfileIgnored : ImageSource::GammaAndColorProfileApplied)));
     63        if (!decoder)
    6464            return false;
    65         hasAlpha = decoder.frameHasAlphaAtIndex(0);
    66         pixels = adoptPtr(decoder.createFrameAtIndex(0));
     65        decoder->setData(image->data(), true);
     66        if (!decoder->frameCount())
     67            return false;
     68        ImageFrame* frame = decoder->frameBufferAtIndex(0);
     69        if (!frame || frame->status() != ImageFrame::FrameComplete)
     70            return false;
     71        hasAlpha = frame->hasAlpha();
     72        pixels = adoptPtr(frame->asNewNativeImage());
    6773        if (!pixels.get() || !pixels->isDataComplete() || !pixels->bitmap().width() || !pixels->bitmap().height())
    6874            return false;
Note: See TracChangeset for help on using the changeset viewer.