diff options
author | Ben Murdoch <benm@google.com> | 2011-06-02 12:07:03 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-10 10:47:21 +0100 |
commit | 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch) | |
tree | e4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp | |
parent | 87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff) | |
download | external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2 |
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp')
-rw-r--r-- | Source/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Source/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp b/Source/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp index 5950c35..0fb44e7 100644 --- a/Source/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp @@ -30,6 +30,7 @@ #include "GraphicsContext3D.h" +#include "BitmapImage.h" #include "Image.h" #include "ImageSource.h" #include "NativeImageSkia.h" @@ -50,15 +51,17 @@ bool GraphicsContext3D::getImageData(Image* image, if (!image) return false; OwnPtr<NativeImageSkia> pixels; - NativeImageSkia* skiaImage = 0; + NativeImageSkia* skiaImage = image->nativeImageForCurrentFrame(); AlphaOp neededAlphaOp = AlphaDoNothing; - if (image->data()) { + bool hasAlpha = skiaImage ? !skiaImage->isOpaque() : true; + if ((!skiaImage || ignoreGammaAndColorProfile || (hasAlpha && !premultiplyAlpha)) && image->data()) { ImageSource decoder(ImageSource::AlphaNotPremultiplied, ignoreGammaAndColorProfile ? ImageSource::GammaAndColorProfileIgnored : ImageSource::GammaAndColorProfileApplied); + // Attempt to get raw unpremultiplied image data decoder.setData(image->data(), true); if (!decoder.frameCount() || !decoder.frameIsCompleteAtIndex(0)) return false; - bool hasAlpha = decoder.frameHasAlphaAtIndex(0); + hasAlpha = decoder.frameHasAlphaAtIndex(0); pixels = adoptPtr(decoder.createFrameAtIndex(0)); if (!pixels.get() || !pixels->isDataComplete() || !pixels->width() || !pixels->height()) return false; @@ -68,12 +71,8 @@ bool GraphicsContext3D::getImageData(Image* image, skiaImage = pixels.get(); if (hasAlpha && premultiplyAlpha) neededAlphaOp = AlphaDoPremultiply; - } else { - // This is a special case for texImage2D with HTMLCanvasElement input. - skiaImage = image->nativeImageForCurrentFrame(); - if (!premultiplyAlpha) - neededAlphaOp = AlphaDoUnmultiply; - } + } else if (!premultiplyAlpha && hasAlpha) + neededAlphaOp = AlphaDoUnmultiply; if (!skiaImage) return false; SkBitmap& skiaImageRef = *skiaImage; |