[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
zmo at google.com
zmo at google.com
Wed Dec 22 12:50:45 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit d529e6d7f50fdc9d8253318130eb99f956a2bb1e
Author: zmo at google.com <zmo at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Aug 31 16:57:25 2010 +0000
2010-08-25 Zhenyao Mo <zmo at google.com>
Reviewed by Kenneth Russell.
Passing premultiplyAlpha=false to tex{Sub}Image2D loses information (cg)
https://bugs.webkit.org/show_bug.cgi?id=44566
* platform/graphics/cg/GraphicsContext3DCG.cpp:
(WebCore::GraphicsContext3D::getImageData): Fix the premultiplyAlpha issue for cg.
2010-08-25 Zhenyao Mo <zmo at google.com>
Reviewed by Kenneth Russell.
Passing premultiplyAlpha=false to tex{Sub}Image2D loses information (cg)
https://bugs.webkit.org/show_bug.cgi?id=44566
* fast/canvas/webgl/gl-teximage-expected.txt: Fix a typo in the file.
* platform/chromium/test_expectations.txt: Re-enable gl-teximage.html test.
* platform/mac/Skipped: Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66494 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 683e54d..497a116 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2010-08-25 Zhenyao Mo <zmo at google.com>
+
+ Reviewed by Kenneth Russell.
+
+ Passing premultiplyAlpha=false to tex{Sub}Image2D loses information (cg)
+ https://bugs.webkit.org/show_bug.cgi?id=44566
+
+ * fast/canvas/webgl/gl-teximage-expected.txt: Fix a typo in the file.
+ * platform/chromium/test_expectations.txt: Re-enable gl-teximage.html test.
+ * platform/mac/Skipped: Ditto.
+
2010-08-31 Dave Hyatt <hyatt at apple.com>
Reviewed by Adam Roben.
diff --git a/LayoutTests/platform/chromium/test_expectations.txt b/LayoutTests/platform/chromium/test_expectations.txt
index 695448d..9cdd2ff 100644
--- a/LayoutTests/platform/chromium/test_expectations.txt
+++ b/LayoutTests/platform/chromium/test_expectations.txt
@@ -2538,9 +2538,6 @@ BUGWK37297 : fast/history/sibling-visited-test.html = TEXT
BUGWK36983 MAC : fast/canvas/webgl/null-object-behaviour.html = TEXT
BUGWK36983 MAC : fast/canvas/webgl/uniform-location.html = TEXT
-// Caused by premultiplying alphas in CG image decoding.
-BUG44566 MAC : fast/canvas/webgl/gl-teximage.html = TEXT
-
// Added in http://trac.webkit.org/changeset/57476. Fails in Chromium because
// LayoutTestController::computedStyleWithVisitedInfo() is missing.
BUG41206 : fast/history/multiple-classes-visited.html = TEXT TIMEOUT
diff --git a/LayoutTests/platform/mac/Skipped b/LayoutTests/platform/mac/Skipped
index acd542b..3980771 100644
--- a/LayoutTests/platform/mac/Skipped
+++ b/LayoutTests/platform/mac/Skipped
@@ -296,9 +296,6 @@ animations/play-state.html
# https://bugs.webkit.org/show_bug.cgi?id=43332
inspector/dom-breakpoints.html
-# https://bugs.webkit.org/show_bug.cgi?id=44566
-fast/canvas/webgl/gl-teximage.html
-
# Safari doesn't allow to customize outermost scrollbars.
# https://bugs.webkit.org/show_bug.cgi?id=43960
scrollbars/custom-scrollbar-with-incomplete-style.html
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 5421e93..591bf78 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,13 @@
+2010-08-25 Zhenyao Mo <zmo at google.com>
+
+ Reviewed by Kenneth Russell.
+
+ Passing premultiplyAlpha=false to tex{Sub}Image2D loses information (cg)
+ https://bugs.webkit.org/show_bug.cgi?id=44566
+
+ * platform/graphics/cg/GraphicsContext3DCG.cpp:
+ (WebCore::GraphicsContext3D::getImageData): Fix the premultiplyAlpha issue for cg.
+
2010-08-31 Dave Hyatt <hyatt at apple.com>
Reviewed by Adam Roben.
diff --git a/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp b/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
index df14f9d..0ff8bea 100644
--- a/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
@@ -34,6 +34,7 @@
#include <CoreGraphics/CGBitmapContext.h>
#include <CoreGraphics/CGContext.h>
+#include <CoreGraphics/CGDataProvider.h>
#include <CoreGraphics/CGImage.h>
#include <wtf/RetainPtr.h>
@@ -48,62 +49,100 @@ bool GraphicsContext3D::getImageData(Image* image,
{
if (!image)
return false;
- CGImageRef cgImage = image->nativeImageForCurrentFrame();
+ CGImageRef cgImage;
+ RetainPtr<CGImageRef> decodedImage;
+ if (image->data()) {
+ ImageSource decoder(false);
+ decoder.setData(image->data(), true);
+ if (!decoder.frameCount())
+ return false;
+ decodedImage = decoder.createFrameAtIndex(0);
+ cgImage = decodedImage.get();
+ } else
+ cgImage = image->nativeImageForCurrentFrame();
if (!cgImage)
return false;
- int width = CGImageGetWidth(cgImage);
- int height = CGImageGetHeight(cgImage);
- // FIXME: we should get rid of this temporary copy where possible.
- int tempRowBytes = width * 4;
- Vector<uint8_t> tempVector;
- tempVector.resize(height * tempRowBytes);
- // Try to reuse the color space from the image to preserve its colors.
- // Some images use a color space (such as indexed) unsupported by the bitmap context.
- CGColorSpaceRef colorSpace = CGImageGetColorSpace(cgImage);
- bool releaseColorSpace = false;
- CGColorSpaceModel colorSpaceModel = CGColorSpaceGetModel(colorSpace);
- switch (colorSpaceModel) {
- case kCGColorSpaceModelMonochrome:
- case kCGColorSpaceModelRGB:
- case kCGColorSpaceModelCMYK:
- case kCGColorSpaceModelLab:
- case kCGColorSpaceModelDeviceN:
+ size_t width = CGImageGetWidth(cgImage);
+ size_t height = CGImageGetHeight(cgImage);
+ if (!width || !height || CGImageGetBitsPerComponent(cgImage) != 8)
+ return false;
+ size_t componentsPerPixel = CGImageGetBitsPerPixel(cgImage) / 8;
+ SourceDataFormat srcDataFormat = kSourceFormatRGBA8;
+ AlphaOp neededAlphaOp = kAlphaDoNothing;
+ switch (CGImageGetAlphaInfo(cgImage)) {
+ case kCGImageAlphaPremultipliedFirst:
+ case kCGImageAlphaFirst:
+ case kCGImageAlphaNoneSkipFirst:
+ return false;
+ case kCGImageAlphaPremultipliedLast:
+ // This is a special case for texImage2D with HTMLCanvasElement input,
+ // in which case image->data() should be null.
+ ASSERT(!image->data());
+ if (!premultiplyAlpha)
+ neededAlphaOp = kAlphaDoUnmultiply;
+ switch (componentsPerPixel) {
+ case 2:
+ srcDataFormat = kSourceFormatRA8;
+ break;
+ case 4:
+ srcDataFormat = kSourceFormatRGBA8;
+ break;
+ default:
+ return false;
+ }
break;
- default:
- colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGBLinear);
- releaseColorSpace = true;
+ case kCGImageAlphaLast:
+ if (premultiplyAlpha)
+ neededAlphaOp = kAlphaDoPremultiply;
+ switch (componentsPerPixel) {
+ case 1:
+ srcDataFormat = kSourceFormatA8;
+ break;
+ case 2:
+ srcDataFormat = kSourceFormatRA8;
+ break;
+ case 4:
+ srcDataFormat = kSourceFormatRGBA8;
+ break;
+ default:
+ return false;
+ }
break;
- }
- CGContextRef tempContext = CGBitmapContextCreate(tempVector.data(),
- width, height, 8, tempRowBytes,
- colorSpace,
- // FIXME: change this!
- kCGImageAlphaPremultipliedLast);
- if (releaseColorSpace)
- CGColorSpaceRelease(colorSpace);
- if (!tempContext)
+ case kCGImageAlphaNoneSkipLast:
+ switch (componentsPerPixel) {
+ case 2:
+ srcDataFormat = kSourceFormatRA8;
+ break;
+ case 4:
+ srcDataFormat = kSourceFormatRGBA8;
+ break;
+ default:
+ return false;
+ }
+ case kCGImageAlphaNone:
+ switch (componentsPerPixel) {
+ case 1:
+ srcDataFormat = kSourceFormatR8;
+ break;
+ case 3:
+ srcDataFormat = kSourceFormatRGB8;
+ break;
+ default:
+ return false;
+ }
+ break;
+ default:
return false;
- CGContextSetBlendMode(tempContext, kCGBlendModeCopy);
- CGContextDrawImage(tempContext,
- CGRectMake(0, 0, static_cast<CGFloat>(width), static_cast<CGFloat>(height)),
- cgImage);
- CGContextRelease(tempContext);
- // Pack the pixel data into the output vector.
- unsigned long componentsPerPixel, bytesPerComponent;
- if (!computeFormatAndTypeParameters(format, type, &componentsPerPixel, &bytesPerComponent))
+ }
+ RetainPtr<CFDataRef> pixelData;
+ pixelData.adoptCF(CGDataProviderCopyData(CGImageGetDataProvider(cgImage)));
+ if (!pixelData)
return false;
- int rowBytes = width * componentsPerPixel * bytesPerComponent;
- outputVector.resize(height * rowBytes);
- CGImageAlphaInfo info = CGImageGetAlphaInfo(cgImage);
- bool hasAlphaChannel = (info != kCGImageAlphaNone
- && info != kCGImageAlphaNoneSkipLast
- && info != kCGImageAlphaNoneSkipFirst);
- AlphaOp neededAlphaOp = kAlphaDoNothing;
- if (!premultiplyAlpha && hasAlphaChannel)
- // FIXME: must fetch the image data before the premultiplication step.
- neededAlphaOp = kAlphaDoUnmultiply;
- return packPixels(tempVector.data(), kSourceFormatRGBA8, width, height, 0,
- format, type, neededAlphaOp, outputVector.data());
+ const UInt8* rgba = CFDataGetBytePtr(pixelData.get());
+ outputVector.resize(width * height * 4);
+ bool rt = packPixels(rgba, srcDataFormat, width, height, 0,
+ format, type, neededAlphaOp, outputVector.data());
+ return rt;
}
void GraphicsContext3D::paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight, int canvasWidth, int canvasHeight, CGContextRef context)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list