[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 14:03:13 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 3ca86b79e3bda8f6ed6a4593256324d6fe3b9458
Author: zmo at google.com <zmo at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Oct 1 23:08:27 2010 +0000
2010-09-30 Zhenyao Mo <zmo at google.com>
Reviewed by Kenneth Russell.
texImage2D fails on 16-bit-per-channel images
https://bugs.webkit.org/show_bug.cgi?id=46947
* platform/graphics/GraphicsContext3D.cpp: Handling 16-bit-per-channel source formats.
(WebCore::convertColor16To8):
(WebCore::doPacking):
* platform/graphics/GraphicsContext3D.h: Ditto.
* platform/graphics/cg/GraphicsContext3DCG.cpp: Ditto.
(WebCore::GraphicsContext3D::getImageData):
2010-09-30 Zhenyao Mo <zmo at google.com>
Reviewed by Kenneth Russell.
texImage2D fails on 16-bit-per-channel images
https://bugs.webkit.org/show_bug.cgi?id=46947
* fast/canvas/webgl/gl-teximage-expected.txt: Add a test case for loading 16-bit-per-channel images as textures.
* fast/canvas/webgl/gl-teximage.html: Ditto.
* fast/canvas/webgl/resources/green-2x2-16bit.png: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 96e66cc..de37122 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2010-09-30 Zhenyao Mo <zmo at google.com>
+
+ Reviewed by Kenneth Russell.
+
+ texImage2D fails on 16-bit-per-channel images
+ https://bugs.webkit.org/show_bug.cgi?id=46947
+
+ * fast/canvas/webgl/gl-teximage-expected.txt: Add a test case for loading 16-bit-per-channel images as textures.
+ * fast/canvas/webgl/gl-teximage.html: Ditto.
+ * fast/canvas/webgl/resources/green-2x2-16bit.png: Added.
+
2010-10-01 Alpha Lam <hclam at chromium.org>
Build fix. Not reviewed.
diff --git a/LayoutTests/fast/canvas/webgl/gl-teximage-expected.txt b/LayoutTests/fast/canvas/webgl/gl-teximage-expected.txt
index e40a969..2451b3b 100644
--- a/LayoutTests/fast/canvas/webgl/gl-teximage-expected.txt
+++ b/LayoutTests/fast/canvas/webgl/gl-teximage-expected.txt
@@ -68,6 +68,11 @@ PASS getError was expected value: NO_ERROR : Should be no errors from setup
PASS pixel 128, 8 should be within 10 units of 0, 0, 255, 255 was 0, 0, 254, 255
PASS getError was expected value: NO_ERROR : Should be no errors
+check uploading of 16-bit images
+PASS getError was expected value: NO_ERROR : Should be no errors from setup
+PASS pixel 128, 8 should be within 10 units of 15, 121, 0, 255 was 15, 121, 0, 255
+PASS getError was expected value: NO_ERROR : Should be no errors
+
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/canvas/webgl/gl-teximage.html b/LayoutTests/fast/canvas/webgl/gl-teximage.html
index e124b5f..530e080 100644
--- a/LayoutTests/fast/canvas/webgl/gl-teximage.html
+++ b/LayoutTests/fast/canvas/webgl/gl-teximage.html
@@ -33,7 +33,8 @@ var imgURLs = [
'resources/gray-ramp.png',
'resources/zero-alpha.png',
'resources/3x3.png',
- 'resources/blue-1x1.jpg'];
+ 'resources/blue-1x1.jpg',
+ 'resources/green-2x2-16bit.png'];
wtu.loadImagesAsync(imgURLs, runTests);
@@ -289,6 +290,20 @@ function runTests(imgs) {
glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors");
debug("");
+ debug("check uploading of 16-bit images");
+ gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE,
+ imgs['resources/green-2x2-16bit.png']);
+ glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup");
+ wtu.drawQuad(gl);
+ gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf);
+
+ checkPixelRange(buf, middle, center, [ 15, 121, 0, 255], 10);
+
+ glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors");
+
+ debug("");
successfullyParsed = true;
shouldBeTrue("successfullyParsed");
debug('<br /><span class="pass">TEST COMPLETE</span>');
diff --git a/LayoutTests/fast/canvas/webgl/resources/green-2x2-16bit.png b/LayoutTests/fast/canvas/webgl/resources/green-2x2-16bit.png
new file mode 100644
index 0000000..7fcb969
Binary files /dev/null and b/LayoutTests/fast/canvas/webgl/resources/green-2x2-16bit.png differ
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 612d384..d2fd8f1 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-09-30 Zhenyao Mo <zmo at google.com>
+
+ Reviewed by Kenneth Russell.
+
+ texImage2D fails on 16-bit-per-channel images
+ https://bugs.webkit.org/show_bug.cgi?id=46947
+
+ * platform/graphics/GraphicsContext3D.cpp: Handling 16-bit-per-channel source formats.
+ (WebCore::convertColor16To8):
+ (WebCore::doPacking):
+ * platform/graphics/GraphicsContext3D.h: Ditto.
+ * platform/graphics/cg/GraphicsContext3DCG.cpp: Ditto.
+ (WebCore::GraphicsContext3D::getImageData):
+
2010-10-01 Eric Uhrhane <ericu at chromium.org>
Reviewed by Nate Chapin.
diff --git a/WebCore/platform/graphics/GraphicsContext3D.cpp b/WebCore/platform/graphics/GraphicsContext3D.cpp
index 86e9569..9c34a09 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.cpp
+++ b/WebCore/platform/graphics/GraphicsContext3D.cpp
@@ -36,6 +36,11 @@
namespace WebCore {
+static uint8_t convertColor16To8(uint16_t value)
+{
+ return value >> 8;
+}
+
bool GraphicsContext3D::computeFormatAndTypeParameters(unsigned int format,
unsigned int type,
unsigned long* componentsPerPixel,
@@ -247,6 +252,14 @@ void unpackRGBA8ToRGBA8(const uint8_t* source, uint8_t* destination)
destination[3] = source[3];
}
+void unpackRGBA16ToRGBA8(const uint16_t* source, uint8_t* destination)
+{
+ destination[0] = convertColor16To8(source[0]);
+ destination[1] = convertColor16To8(source[1]);
+ destination[2] = convertColor16To8(source[2]);
+ destination[3] = convertColor16To8(source[3]);
+}
+
void unpackRGB8ToRGBA8(const uint8_t* source, uint8_t* destination)
{
destination[0] = source[0];
@@ -255,6 +268,14 @@ void unpackRGB8ToRGBA8(const uint8_t* source, uint8_t* destination)
destination[3] = 0xFF;
}
+void unpackRGB16ToRGBA8(const uint16_t* source, uint8_t* destination)
+{
+ destination[0] = convertColor16To8(source[0]);
+ destination[1] = convertColor16To8(source[1]);
+ destination[2] = convertColor16To8(source[2]);
+ destination[3] = 0xFF;
+}
+
void unpackARGB8ToRGBA8(const uint8_t* source, uint8_t* destination)
{
destination[0] = source[1];
@@ -263,6 +284,14 @@ void unpackARGB8ToRGBA8(const uint8_t* source, uint8_t* destination)
destination[3] = source[0];
}
+void unpackARGB16ToRGBA8(const uint16_t* source, uint8_t* destination)
+{
+ destination[0] = convertColor16To8(source[1]);
+ destination[1] = convertColor16To8(source[2]);
+ destination[2] = convertColor16To8(source[3]);
+ destination[3] = convertColor16To8(source[0]);
+}
+
void unpackBGRA8ToRGBA8(const uint8_t* source, uint8_t* destination)
{
destination[0] = source[2];
@@ -271,6 +300,14 @@ void unpackBGRA8ToRGBA8(const uint8_t* source, uint8_t* destination)
destination[3] = source[3];
}
+void unpackBGRA16ToRGBA8(const uint16_t* source, uint8_t* destination)
+{
+ destination[0] = convertColor16To8(source[2]);
+ destination[1] = convertColor16To8(source[1]);
+ destination[2] = convertColor16To8(source[0]);
+ destination[3] = convertColor16To8(source[3]);
+}
+
void unpackRGBA5551ToRGBA8(const uint16_t* source, uint8_t* destination)
{
uint16_t packedValue = source[0];
@@ -316,6 +353,14 @@ void unpackR8ToRGBA8(const uint8_t* source, uint8_t* destination)
destination[3] = 0xFF;
}
+void unpackR16ToRGBA8(const uint16_t* source, uint8_t* destination)
+{
+ destination[0] = convertColor16To8(source[0]);
+ destination[1] = convertColor16To8(source[0]);
+ destination[2] = convertColor16To8(source[0]);
+ destination[3] = 0xFF;
+}
+
void unpackRA8ToRGBA8(const uint8_t* source, uint8_t* destination)
{
destination[0] = source[0];
@@ -324,6 +369,14 @@ void unpackRA8ToRGBA8(const uint8_t* source, uint8_t* destination)
destination[3] = source[1];
}
+void unpackRA16ToRGBA8(const uint16_t* source, uint8_t* destination)
+{
+ destination[0] = convertColor16To8(source[0]);
+ destination[1] = convertColor16To8(source[0]);
+ destination[2] = convertColor16To8(source[0]);
+ destination[3] = convertColor16To8(source[1]);
+}
+
void unpackAR8ToRGBA8(const uint8_t* source, uint8_t* destination)
{
destination[0] = source[1];
@@ -332,6 +385,14 @@ void unpackAR8ToRGBA8(const uint8_t* source, uint8_t* destination)
destination[3] = source[0];
}
+void unpackAR16ToRGBA8(const uint16_t* source, uint8_t* destination)
+{
+ destination[0] = convertColor16To8(source[1]);
+ destination[1] = convertColor16To8(source[1]);
+ destination[2] = convertColor16To8(source[1]);
+ destination[3] = convertColor16To8(source[0]);
+}
+
void unpackA8ToRGBA8(const uint8_t* source, uint8_t* destination)
{
destination[0] = 0x0;
@@ -340,6 +401,14 @@ void unpackA8ToRGBA8(const uint8_t* source, uint8_t* destination)
destination[3] = source[0];
}
+void unpackA16ToRGBA8(const uint16_t* source, uint8_t* destination)
+{
+ destination[0] = 0x0;
+ destination[1] = 0x0;
+ destination[2] = 0x0;
+ destination[3] = convertColor16To8(source[0]);
+}
+
//----------------------------------------------------------------------
// Pixel packing routines.
//
@@ -644,24 +713,48 @@ static void doPacking(const void* sourceData,
}
break;
}
+ case GraphicsContext3D::kSourceFormatRGBA16: {
+ unsigned int sourceElementsPerPixel, sourceElementsPerRow;
+ computeIncrementParameters<uint8_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackRGBA16ToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
+ break;
+ }
case GraphicsContext3D::kSourceFormatRGB8: {
unsigned int sourceElementsPerPixel, sourceElementsPerRow;
computeIncrementParameters<uint8_t>(width, 3, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
doUnpackingAndPacking<uint8_t, DestType, unpackRGB8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
+ case GraphicsContext3D::kSourceFormatRGB16: {
+ unsigned int sourceElementsPerPixel, sourceElementsPerRow;
+ computeIncrementParameters<uint8_t>(width, 3, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackRGB16ToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
+ break;
+ }
case GraphicsContext3D::kSourceFormatARGB8: {
unsigned int sourceElementsPerPixel, sourceElementsPerRow;
computeIncrementParameters<uint8_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
doUnpackingAndPacking<uint8_t, DestType, unpackARGB8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
+ case GraphicsContext3D::kSourceFormatARGB16: {
+ unsigned int sourceElementsPerPixel, sourceElementsPerRow;
+ computeIncrementParameters<uint8_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackARGB16ToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
+ break;
+ }
case GraphicsContext3D::kSourceFormatBGRA8: {
unsigned int sourceElementsPerPixel, sourceElementsPerRow;
computeIncrementParameters<uint8_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
doUnpackingAndPacking<uint8_t, DestType, unpackBGRA8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
+ case GraphicsContext3D::kSourceFormatBGRA16: {
+ unsigned int sourceElementsPerPixel, sourceElementsPerRow;
+ computeIncrementParameters<uint8_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackBGRA16ToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
+ break;
+ }
case GraphicsContext3D::kSourceFormatRGBA5551: {
unsigned int sourceElementsPerPixel, sourceElementsPerRow;
computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
@@ -686,24 +779,48 @@ static void doPacking(const void* sourceData,
doUnpackingAndPacking<uint8_t, DestType, unpackR8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
+ case GraphicsContext3D::kSourceFormatR16: {
+ unsigned int sourceElementsPerPixel, sourceElementsPerRow;
+ computeIncrementParameters<uint8_t>(width, 1, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackR16ToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
+ break;
+ }
case GraphicsContext3D::kSourceFormatRA8: {
unsigned int sourceElementsPerPixel, sourceElementsPerRow;
computeIncrementParameters<uint8_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
doUnpackingAndPacking<uint8_t, DestType, unpackRA8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
+ case GraphicsContext3D::kSourceFormatRA16: {
+ unsigned int sourceElementsPerPixel, sourceElementsPerRow;
+ computeIncrementParameters<uint8_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackRA16ToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
+ break;
+ }
case GraphicsContext3D::kSourceFormatAR8: {
unsigned int sourceElementsPerPixel, sourceElementsPerRow;
computeIncrementParameters<uint8_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
doUnpackingAndPacking<uint8_t, DestType, unpackAR8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
+ case GraphicsContext3D::kSourceFormatAR16: {
+ unsigned int sourceElementsPerPixel, sourceElementsPerRow;
+ computeIncrementParameters<uint8_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackAR16ToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
+ break;
+ }
case GraphicsContext3D::kSourceFormatA8: {
unsigned int sourceElementsPerPixel, sourceElementsPerRow;
computeIncrementParameters<uint8_t>(width, 1, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
doUnpackingAndPacking<uint8_t, DestType, unpackA8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
+ case GraphicsContext3D::kSourceFormatA16: {
+ unsigned int sourceElementsPerPixel, sourceElementsPerRow;
+ computeIncrementParameters<uint8_t>(width, 1, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackA16ToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
+ break;
+ }
}
}
diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h
index 28ef8f2..907d845 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.h
+++ b/WebCore/platform/graphics/GraphicsContext3D.h
@@ -541,16 +541,24 @@ public:
// by non-member functions.
enum SourceDataFormat {
kSourceFormatRGBA8,
+ kSourceFormatRGBA16,
kSourceFormatRGB8,
+ kSourceFormatRGB16,
kSourceFormatBGRA8,
+ kSourceFormatBGRA16,
kSourceFormatARGB8,
+ kSourceFormatARGB16,
kSourceFormatRGBA5551,
kSourceFormatRGBA4444,
kSourceFormatRGB565,
kSourceFormatR8,
+ kSourceFormatR16,
kSourceFormatRA8,
+ kSourceFormatRA16,
kSourceFormatAR8,
- kSourceFormatA8
+ kSourceFormatAR16,
+ kSourceFormatA8,
+ kSourceFormatA16
};
//----------------------------------------------------------------------
diff --git a/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp b/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
index 2a81fd2..c61e95a 100644
--- a/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
@@ -64,9 +64,15 @@ bool GraphicsContext3D::getImageData(Image* image,
return false;
size_t width = CGImageGetWidth(cgImage);
size_t height = CGImageGetHeight(cgImage);
- if (!width || !height || CGImageGetBitsPerComponent(cgImage) != 8)
+ if (!width || !height)
return false;
- size_t componentsPerPixel = CGImageGetBitsPerPixel(cgImage) / 8;
+ size_t bitsPerComponent = CGImageGetBitsPerComponent(cgImage);
+ size_t bitsPerPixel = CGImageGetBitsPerPixel(cgImage);
+ if (bitsPerComponent != 8 && bitsPerComponent != 16)
+ return false;
+ if (bitsPerPixel % bitsPerComponent)
+ return false;
+ size_t componentsPerPixel = bitsPerPixel / bitsPerComponent;
SourceDataFormat srcDataFormat = kSourceFormatRGBA8;
AlphaOp neededAlphaOp = kAlphaDoNothing;
switch (CGImageGetAlphaInfo(cgImage)) {
@@ -79,10 +85,16 @@ bool GraphicsContext3D::getImageData(Image* image,
neededAlphaOp = kAlphaDoUnmultiply;
switch (componentsPerPixel) {
case 2:
- srcDataFormat = kSourceFormatAR8;
+ if (bitsPerComponent == 8)
+ srcDataFormat = kSourceFormatAR8;
+ else
+ srcDataFormat = kSourceFormatAR16;
break;
case 4:
- srcDataFormat = kSourceFormatARGB8;
+ if (bitsPerComponent == 8)
+ srcDataFormat = kSourceFormatARGB8;
+ else
+ srcDataFormat = kSourceFormatARGB16;
break;
default:
return false;
@@ -94,13 +106,22 @@ bool GraphicsContext3D::getImageData(Image* image,
neededAlphaOp = kAlphaDoPremultiply;
switch (componentsPerPixel) {
case 1:
- srcDataFormat = kSourceFormatA8;
+ if (bitsPerComponent == 8)
+ srcDataFormat = kSourceFormatA8;
+ else
+ srcDataFormat = kSourceFormatA16;
break;
case 2:
- srcDataFormat = kSourceFormatAR8;
+ if (bitsPerComponent == 8)
+ srcDataFormat = kSourceFormatAR8;
+ else
+ srcDataFormat = kSourceFormatAR16;
break;
case 4:
- srcDataFormat = kSourceFormatARGB8;
+ if (bitsPerComponent == 8)
+ srcDataFormat = kSourceFormatARGB8;
+ else
+ srcDataFormat = kSourceFormatARGB16;
break;
default:
return false;
@@ -110,10 +131,16 @@ bool GraphicsContext3D::getImageData(Image* image,
// This path is only accessible for MacOS earlier than 10.6.4.
switch (componentsPerPixel) {
case 2:
- srcDataFormat = kSourceFormatAR8;
+ if (bitsPerComponent == 8)
+ srcDataFormat = kSourceFormatAR8;
+ else
+ srcDataFormat = kSourceFormatAR16;
break;
case 4:
- srcDataFormat = kSourceFormatARGB8;
+ if (bitsPerComponent == 8)
+ srcDataFormat = kSourceFormatARGB8;
+ else
+ srcDataFormat = kSourceFormatARGB16;
break;
default:
return false;
@@ -127,10 +154,16 @@ bool GraphicsContext3D::getImageData(Image* image,
neededAlphaOp = kAlphaDoUnmultiply;
switch (componentsPerPixel) {
case 2:
- srcDataFormat = kSourceFormatRA8;
+ if (bitsPerComponent == 8)
+ srcDataFormat = kSourceFormatRA8;
+ else
+ srcDataFormat = kSourceFormatRA16;
break;
case 4:
- srcDataFormat = kSourceFormatRGBA8;
+ if (bitsPerComponent == 8)
+ srcDataFormat = kSourceFormatRGBA8;
+ else
+ srcDataFormat = kSourceFormatRGBA16;
break;
default:
return false;
@@ -141,13 +174,22 @@ bool GraphicsContext3D::getImageData(Image* image,
neededAlphaOp = kAlphaDoPremultiply;
switch (componentsPerPixel) {
case 1:
- srcDataFormat = kSourceFormatA8;
+ if (bitsPerComponent == 8)
+ srcDataFormat = kSourceFormatA8;
+ else
+ srcDataFormat = kSourceFormatA16;
break;
case 2:
- srcDataFormat = kSourceFormatRA8;
+ if (bitsPerComponent == 8)
+ srcDataFormat = kSourceFormatRA8;
+ else
+ srcDataFormat = kSourceFormatRA16;
break;
case 4:
- srcDataFormat = kSourceFormatRGBA8;
+ if (bitsPerComponent == 8)
+ srcDataFormat = kSourceFormatRGBA8;
+ else
+ srcDataFormat = kSourceFormatRGBA16;
break;
default:
return false;
@@ -156,10 +198,16 @@ bool GraphicsContext3D::getImageData(Image* image,
case kCGImageAlphaNoneSkipLast:
switch (componentsPerPixel) {
case 2:
- srcDataFormat = kSourceFormatRA8;
+ if (bitsPerComponent == 8)
+ srcDataFormat = kSourceFormatRA8;
+ else
+ srcDataFormat = kSourceFormatRA16;
break;
case 4:
- srcDataFormat = kSourceFormatRGBA8;
+ if (bitsPerComponent == 8)
+ srcDataFormat = kSourceFormatRGBA8;
+ else
+ srcDataFormat = kSourceFormatRGBA16;
break;
default:
return false;
@@ -168,10 +216,16 @@ bool GraphicsContext3D::getImageData(Image* image,
case kCGImageAlphaNone:
switch (componentsPerPixel) {
case 1:
- srcDataFormat = kSourceFormatR8;
+ if (bitsPerComponent == 8)
+ srcDataFormat = kSourceFormatR8;
+ else
+ srcDataFormat = kSourceFormatR16;
break;
case 3:
- srcDataFormat = kSourceFormatRGB8;
+ if (bitsPerComponent == 8)
+ srcDataFormat = kSourceFormatRGB8;
+ else
+ srcDataFormat = kSourceFormatRGB16;
break;
default:
return false;
@@ -188,7 +242,7 @@ bool GraphicsContext3D::getImageData(Image* image,
outputVector.resize(width * height * 4);
unsigned int srcUnpackAlignment = 0;
size_t bytesPerRow = CGImageGetBytesPerRow(cgImage);
- unsigned int padding = bytesPerRow - componentsPerPixel * width;
+ unsigned int padding = bytesPerRow - bitsPerPixel / 8 * width;
if (padding) {
srcUnpackAlignment = padding + 1;
while (bytesPerRow % srcUnpackAlignment)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list