[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:46:00 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 5ef4c4643666c9ea4bc6f82d42793bf399ca7f1f
Author: zmo at google.com <zmo at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Oct 19 19:16:06 2010 +0000
2010-10-18 Zhenyao Mo <zmo at google.com>
Reviewed by Kenneth Russell.
gl-teximage.html fails on chromium webkit mac bot
https://bugs.webkit.org/show_bug.cgi?id=47034
* platform/graphics/GraphicsContext3D.cpp: Deal with endians in 16 bit image data.
(WebCore::convertColor16LittleTo8):
(WebCore::convertColor16BigTo8):
(WebCore::doPacking):
* platform/graphics/GraphicsContext3D.h: Ditto.
* platform/graphics/cg/GraphicsContext3DCG.cpp: Ditto.
(WebCore::GraphicsContext3D::getImageData):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70073 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 039a462..2699756 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-10-18 Zhenyao Mo <zmo at google.com>
+
+ Reviewed by Kenneth Russell.
+
+ gl-teximage.html fails on chromium webkit mac bot
+ https://bugs.webkit.org/show_bug.cgi?id=47034
+
+ * platform/graphics/GraphicsContext3D.cpp: Deal with endians in 16 bit image data.
+ (WebCore::convertColor16LittleTo8):
+ (WebCore::convertColor16BigTo8):
+ (WebCore::doPacking):
+ * platform/graphics/GraphicsContext3D.h: Ditto.
+ * platform/graphics/cg/GraphicsContext3DCG.cpp: Ditto.
+ (WebCore::GraphicsContext3D::getImageData):
+
2010-10-19 David Hyatt <hyatt at apple.com>
Reviewed by Dan Bernstein.
diff --git a/WebCore/platform/graphics/GraphicsContext3D.cpp b/WebCore/platform/graphics/GraphicsContext3D.cpp
index b077927..d2e9057 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.cpp
+++ b/WebCore/platform/graphics/GraphicsContext3D.cpp
@@ -37,11 +37,16 @@
namespace WebCore {
-static uint8_t convertColor16To8(uint16_t value)
+static uint8_t convertColor16LittleTo8(uint16_t value)
{
return value >> 8;
}
+static uint8_t convertColor16BigTo8(uint16_t value)
+{
+ return static_cast<uint8_t>(value & 0x00FF);
+}
+
PassRefPtr<DrawingBuffer> GraphicsContext3D::createDrawingBuffer(const IntSize& size)
{
return DrawingBuffer::create(this, size);
@@ -258,12 +263,20 @@ void unpackRGBA8ToRGBA8(const uint8_t* source, uint8_t* destination)
destination[3] = source[3];
}
-void unpackRGBA16ToRGBA8(const uint16_t* source, uint8_t* destination)
+void unpackRGBA16LittleToRGBA8(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]);
+ destination[0] = convertColor16LittleTo8(source[0]);
+ destination[1] = convertColor16LittleTo8(source[1]);
+ destination[2] = convertColor16LittleTo8(source[2]);
+ destination[3] = convertColor16LittleTo8(source[3]);
+}
+
+void unpackRGBA16BigToRGBA8(const uint16_t* source, uint8_t* destination)
+{
+ destination[0] = convertColor16BigTo8(source[0]);
+ destination[1] = convertColor16BigTo8(source[1]);
+ destination[2] = convertColor16BigTo8(source[2]);
+ destination[3] = convertColor16BigTo8(source[3]);
}
void unpackRGB8ToRGBA8(const uint8_t* source, uint8_t* destination)
@@ -274,11 +287,19 @@ void unpackRGB8ToRGBA8(const uint8_t* source, uint8_t* destination)
destination[3] = 0xFF;
}
-void unpackRGB16ToRGBA8(const uint16_t* source, uint8_t* destination)
+void unpackRGB16LittleToRGBA8(const uint16_t* source, uint8_t* destination)
{
- destination[0] = convertColor16To8(source[0]);
- destination[1] = convertColor16To8(source[1]);
- destination[2] = convertColor16To8(source[2]);
+ destination[0] = convertColor16LittleTo8(source[0]);
+ destination[1] = convertColor16LittleTo8(source[1]);
+ destination[2] = convertColor16LittleTo8(source[2]);
+ destination[3] = 0xFF;
+}
+
+void unpackRGB16BigToRGBA8(const uint16_t* source, uint8_t* destination)
+{
+ destination[0] = convertColor16BigTo8(source[0]);
+ destination[1] = convertColor16BigTo8(source[1]);
+ destination[2] = convertColor16BigTo8(source[2]);
destination[3] = 0xFF;
}
@@ -290,12 +311,20 @@ void unpackARGB8ToRGBA8(const uint8_t* source, uint8_t* destination)
destination[3] = source[0];
}
-void unpackARGB16ToRGBA8(const uint16_t* source, uint8_t* destination)
+void unpackARGB16LittleToRGBA8(const uint16_t* source, uint8_t* destination)
+{
+ destination[0] = convertColor16LittleTo8(source[1]);
+ destination[1] = convertColor16LittleTo8(source[2]);
+ destination[2] = convertColor16LittleTo8(source[3]);
+ destination[3] = convertColor16LittleTo8(source[0]);
+}
+
+void unpackARGB16BigToRGBA8(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]);
+ destination[0] = convertColor16BigTo8(source[1]);
+ destination[1] = convertColor16BigTo8(source[2]);
+ destination[2] = convertColor16BigTo8(source[3]);
+ destination[3] = convertColor16BigTo8(source[0]);
}
void unpackBGRA8ToRGBA8(const uint8_t* source, uint8_t* destination)
@@ -306,12 +335,20 @@ void unpackBGRA8ToRGBA8(const uint8_t* source, uint8_t* destination)
destination[3] = source[3];
}
-void unpackBGRA16ToRGBA8(const uint16_t* source, uint8_t* destination)
+void unpackBGRA16LittleToRGBA8(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]);
+ destination[0] = convertColor16LittleTo8(source[2]);
+ destination[1] = convertColor16LittleTo8(source[1]);
+ destination[2] = convertColor16LittleTo8(source[0]);
+ destination[3] = convertColor16LittleTo8(source[3]);
+}
+
+void unpackBGRA16BigToRGBA8(const uint16_t* source, uint8_t* destination)
+{
+ destination[0] = convertColor16BigTo8(source[2]);
+ destination[1] = convertColor16BigTo8(source[1]);
+ destination[2] = convertColor16BigTo8(source[0]);
+ destination[3] = convertColor16BigTo8(source[3]);
}
void unpackRGBA5551ToRGBA8(const uint16_t* source, uint8_t* destination)
@@ -359,11 +396,19 @@ void unpackR8ToRGBA8(const uint8_t* source, uint8_t* destination)
destination[3] = 0xFF;
}
-void unpackR16ToRGBA8(const uint16_t* source, uint8_t* destination)
+void unpackR16LittleToRGBA8(const uint16_t* source, uint8_t* destination)
+{
+ destination[0] = convertColor16LittleTo8(source[0]);
+ destination[1] = convertColor16LittleTo8(source[0]);
+ destination[2] = convertColor16LittleTo8(source[0]);
+ destination[3] = 0xFF;
+}
+
+void unpackR16BigToRGBA8(const uint16_t* source, uint8_t* destination)
{
- destination[0] = convertColor16To8(source[0]);
- destination[1] = convertColor16To8(source[0]);
- destination[2] = convertColor16To8(source[0]);
+ destination[0] = convertColor16BigTo8(source[0]);
+ destination[1] = convertColor16BigTo8(source[0]);
+ destination[2] = convertColor16BigTo8(source[0]);
destination[3] = 0xFF;
}
@@ -375,12 +420,20 @@ void unpackRA8ToRGBA8(const uint8_t* source, uint8_t* destination)
destination[3] = source[1];
}
-void unpackRA16ToRGBA8(const uint16_t* source, uint8_t* destination)
+void unpackRA16LittleToRGBA8(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]);
+ destination[0] = convertColor16LittleTo8(source[0]);
+ destination[1] = convertColor16LittleTo8(source[0]);
+ destination[2] = convertColor16LittleTo8(source[0]);
+ destination[3] = convertColor16LittleTo8(source[1]);
+}
+
+void unpackRA16BigToRGBA8(const uint16_t* source, uint8_t* destination)
+{
+ destination[0] = convertColor16BigTo8(source[0]);
+ destination[1] = convertColor16BigTo8(source[0]);
+ destination[2] = convertColor16BigTo8(source[0]);
+ destination[3] = convertColor16BigTo8(source[1]);
}
void unpackAR8ToRGBA8(const uint8_t* source, uint8_t* destination)
@@ -391,12 +444,20 @@ void unpackAR8ToRGBA8(const uint8_t* source, uint8_t* destination)
destination[3] = source[0];
}
-void unpackAR16ToRGBA8(const uint16_t* source, uint8_t* destination)
+void unpackAR16LittleToRGBA8(const uint16_t* source, uint8_t* destination)
+{
+ destination[0] = convertColor16LittleTo8(source[1]);
+ destination[1] = convertColor16LittleTo8(source[1]);
+ destination[2] = convertColor16LittleTo8(source[1]);
+ destination[3] = convertColor16LittleTo8(source[0]);
+}
+
+void unpackAR16BigToRGBA8(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]);
+ destination[0] = convertColor16BigTo8(source[1]);
+ destination[1] = convertColor16BigTo8(source[1]);
+ destination[2] = convertColor16BigTo8(source[1]);
+ destination[3] = convertColor16BigTo8(source[0]);
}
void unpackA8ToRGBA8(const uint8_t* source, uint8_t* destination)
@@ -407,12 +468,20 @@ void unpackA8ToRGBA8(const uint8_t* source, uint8_t* destination)
destination[3] = source[0];
}
-void unpackA16ToRGBA8(const uint16_t* source, uint8_t* destination)
+void unpackA16LittleToRGBA8(const uint16_t* source, uint8_t* destination)
{
destination[0] = 0x0;
destination[1] = 0x0;
destination[2] = 0x0;
- destination[3] = convertColor16To8(source[0]);
+ destination[3] = convertColor16LittleTo8(source[0]);
+}
+
+void unpackA16BigToRGBA8(const uint16_t* source, uint8_t* destination)
+{
+ destination[0] = 0x0;
+ destination[1] = 0x0;
+ destination[2] = 0x0;
+ destination[3] = convertColor16BigTo8(source[0]);
}
//----------------------------------------------------------------------
@@ -677,6 +746,7 @@ static void computeIncrementParameters(unsigned int width,
{
unsigned int elementSizeInBytes = sizeof(SourceType);
ASSERT(elementSizeInBytes <= bytesPerPixel);
+ ASSERT(!(bytesPerPixel % elementSizeInBytes));
unsigned int validRowBytes = width * bytesPerPixel;
unsigned int totalRowBytes = validRowBytes;
if (unpackAlignment) {
@@ -719,10 +789,16 @@ static void doPacking(const void* sourceData,
}
break;
}
- case GraphicsContext3D::kSourceFormatRGBA16: {
+ case GraphicsContext3D::kSourceFormatRGBA16Little: {
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);
+ computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackRGBA16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
+ break;
+ }
+ case GraphicsContext3D::kSourceFormatRGBA16Big: {
+ unsigned int sourceElementsPerPixel, sourceElementsPerRow;
+ computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackRGBA16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
case GraphicsContext3D::kSourceFormatRGB8: {
@@ -731,10 +807,16 @@ static void doPacking(const void* sourceData,
doUnpackingAndPacking<uint8_t, DestType, unpackRGB8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
- case GraphicsContext3D::kSourceFormatRGB16: {
+ case GraphicsContext3D::kSourceFormatRGB16Little: {
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);
+ computeIncrementParameters<uint16_t>(width, 6, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackRGB16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
+ break;
+ }
+ case GraphicsContext3D::kSourceFormatRGB16Big: {
+ unsigned int sourceElementsPerPixel, sourceElementsPerRow;
+ computeIncrementParameters<uint16_t>(width, 6, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackRGB16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
case GraphicsContext3D::kSourceFormatARGB8: {
@@ -743,10 +825,16 @@ static void doPacking(const void* sourceData,
doUnpackingAndPacking<uint8_t, DestType, unpackARGB8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
- case GraphicsContext3D::kSourceFormatARGB16: {
+ case GraphicsContext3D::kSourceFormatARGB16Little: {
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);
+ computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackARGB16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
+ break;
+ }
+ case GraphicsContext3D::kSourceFormatARGB16Big: {
+ unsigned int sourceElementsPerPixel, sourceElementsPerRow;
+ computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackARGB16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
case GraphicsContext3D::kSourceFormatBGRA8: {
@@ -755,10 +843,16 @@ static void doPacking(const void* sourceData,
doUnpackingAndPacking<uint8_t, DestType, unpackBGRA8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
- case GraphicsContext3D::kSourceFormatBGRA16: {
+ case GraphicsContext3D::kSourceFormatBGRA16Little: {
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);
+ computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackBGRA16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
+ break;
+ }
+ case GraphicsContext3D::kSourceFormatBGRA16Big: {
+ unsigned int sourceElementsPerPixel, sourceElementsPerRow;
+ computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackBGRA16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
case GraphicsContext3D::kSourceFormatRGBA5551: {
@@ -785,10 +879,16 @@ 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: {
+ case GraphicsContext3D::kSourceFormatR16Little: {
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);
+ computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackR16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
+ break;
+ }
+ case GraphicsContext3D::kSourceFormatR16Big: {
+ unsigned int sourceElementsPerPixel, sourceElementsPerRow;
+ computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackR16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
case GraphicsContext3D::kSourceFormatRA8: {
@@ -797,10 +897,16 @@ static void doPacking(const void* sourceData,
doUnpackingAndPacking<uint8_t, DestType, unpackRA8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
- case GraphicsContext3D::kSourceFormatRA16: {
+ case GraphicsContext3D::kSourceFormatRA16Little: {
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);
+ computeIncrementParameters<uint16_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackRA16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
+ break;
+ }
+ case GraphicsContext3D::kSourceFormatRA16Big: {
+ unsigned int sourceElementsPerPixel, sourceElementsPerRow;
+ computeIncrementParameters<uint16_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackRA16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
case GraphicsContext3D::kSourceFormatAR8: {
@@ -809,10 +915,16 @@ static void doPacking(const void* sourceData,
doUnpackingAndPacking<uint8_t, DestType, unpackAR8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
- case GraphicsContext3D::kSourceFormatAR16: {
+ case GraphicsContext3D::kSourceFormatAR16Little: {
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);
+ computeIncrementParameters<uint16_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackAR16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
+ break;
+ }
+ case GraphicsContext3D::kSourceFormatAR16Big: {
+ unsigned int sourceElementsPerPixel, sourceElementsPerRow;
+ computeIncrementParameters<uint16_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackAR16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
case GraphicsContext3D::kSourceFormatA8: {
@@ -821,10 +933,16 @@ static void doPacking(const void* sourceData,
doUnpackingAndPacking<uint8_t, DestType, unpackA8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
break;
}
- case GraphicsContext3D::kSourceFormatA16: {
+ case GraphicsContext3D::kSourceFormatA16Little: {
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);
+ computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackA16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);
+ break;
+ }
+ case GraphicsContext3D::kSourceFormatA16Big: {
+ unsigned int sourceElementsPerPixel, sourceElementsPerRow;
+ computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow);
+ doUnpackingAndPacking<uint16_t, DestType, unpackA16BigToRGBA8, 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 df363b4..d74c97c 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.h
+++ b/WebCore/platform/graphics/GraphicsContext3D.h
@@ -541,24 +541,32 @@ public:
// by non-member functions.
enum SourceDataFormat {
kSourceFormatRGBA8,
- kSourceFormatRGBA16,
+ kSourceFormatRGBA16Little,
+ kSourceFormatRGBA16Big,
kSourceFormatRGB8,
- kSourceFormatRGB16,
+ kSourceFormatRGB16Little,
+ kSourceFormatRGB16Big,
kSourceFormatBGRA8,
- kSourceFormatBGRA16,
+ kSourceFormatBGRA16Little,
+ kSourceFormatBGRA16Big,
kSourceFormatARGB8,
- kSourceFormatARGB16,
+ kSourceFormatARGB16Little,
+ kSourceFormatARGB16Big,
kSourceFormatRGBA5551,
kSourceFormatRGBA4444,
kSourceFormatRGB565,
kSourceFormatR8,
- kSourceFormatR16,
+ kSourceFormatR16Little,
+ kSourceFormatR16Big,
kSourceFormatRA8,
- kSourceFormatRA16,
+ kSourceFormatRA16Little,
+ kSourceFormatRA16Big,
kSourceFormatAR8,
- kSourceFormatAR16,
+ kSourceFormatAR16Little,
+ kSourceFormatAR16Big,
kSourceFormatA8,
- kSourceFormatA16
+ kSourceFormatA16Little,
+ kSourceFormatA16Big
};
//----------------------------------------------------------------------
diff --git a/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp b/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
index c61e95a..fe4fc7f 100644
--- a/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
@@ -73,6 +73,26 @@ bool GraphicsContext3D::getImageData(Image* image,
if (bitsPerPixel % bitsPerComponent)
return false;
size_t componentsPerPixel = bitsPerPixel / bitsPerComponent;
+ bool srcByteOrder16Big = false;
+ if (bitsPerComponent == 16) {
+ CGBitmapInfo bitInfo = CGImageGetBitmapInfo(cgImage);
+ switch (bitInfo & kCGBitmapByteOrderMask) {
+ case kCGBitmapByteOrder16Big:
+ srcByteOrder16Big = true;
+ break;
+ case kCGBitmapByteOrder16Little:
+ srcByteOrder16Big = false;
+ break;
+ case kCGBitmapByteOrderDefault:
+ // This is a bug in earlier version of cg where the default endian
+ // is little whereas the decoded 16-bit png image data is actually
+ // Big. Later version (10.6.4) no longer returns ByteOrderDefault.
+ srcByteOrder16Big = true;
+ break;
+ default:
+ return false;
+ }
+ }
SourceDataFormat srcDataFormat = kSourceFormatRGBA8;
AlphaOp neededAlphaOp = kAlphaDoNothing;
switch (CGImageGetAlphaInfo(cgImage)) {
@@ -88,13 +108,13 @@ bool GraphicsContext3D::getImageData(Image* image,
if (bitsPerComponent == 8)
srcDataFormat = kSourceFormatAR8;
else
- srcDataFormat = kSourceFormatAR16;
+ srcDataFormat = srcByteOrder16Big ? kSourceFormatAR16Big : kSourceFormatAR16Little;
break;
case 4:
if (bitsPerComponent == 8)
srcDataFormat = kSourceFormatARGB8;
else
- srcDataFormat = kSourceFormatARGB16;
+ srcDataFormat = srcByteOrder16Big ? kSourceFormatARGB16Big : kSourceFormatARGB16Little;
break;
default:
return false;
@@ -109,19 +129,19 @@ bool GraphicsContext3D::getImageData(Image* image,
if (bitsPerComponent == 8)
srcDataFormat = kSourceFormatA8;
else
- srcDataFormat = kSourceFormatA16;
+ srcDataFormat = srcByteOrder16Big ? kSourceFormatA16Big : kSourceFormatA16Little;
break;
case 2:
if (bitsPerComponent == 8)
srcDataFormat = kSourceFormatAR8;
else
- srcDataFormat = kSourceFormatAR16;
+ srcDataFormat = srcByteOrder16Big ? kSourceFormatAR16Big : kSourceFormatAR16Little;
break;
case 4:
if (bitsPerComponent == 8)
srcDataFormat = kSourceFormatARGB8;
else
- srcDataFormat = kSourceFormatARGB16;
+ srcDataFormat = srcByteOrder16Big ? kSourceFormatARGB16Big : kSourceFormatARGB16Little;
break;
default:
return false;
@@ -134,13 +154,13 @@ bool GraphicsContext3D::getImageData(Image* image,
if (bitsPerComponent == 8)
srcDataFormat = kSourceFormatAR8;
else
- srcDataFormat = kSourceFormatAR16;
+ srcDataFormat = srcByteOrder16Big ? kSourceFormatAR16Big : kSourceFormatAR16Little;
break;
case 4:
if (bitsPerComponent == 8)
srcDataFormat = kSourceFormatARGB8;
else
- srcDataFormat = kSourceFormatARGB16;
+ srcDataFormat = srcByteOrder16Big ? kSourceFormatARGB16Big : kSourceFormatARGB16Little;
break;
default:
return false;
@@ -157,13 +177,13 @@ bool GraphicsContext3D::getImageData(Image* image,
if (bitsPerComponent == 8)
srcDataFormat = kSourceFormatRA8;
else
- srcDataFormat = kSourceFormatRA16;
+ srcDataFormat = srcByteOrder16Big ? kSourceFormatRA16Big : kSourceFormatRA16Little;
break;
case 4:
if (bitsPerComponent == 8)
srcDataFormat = kSourceFormatRGBA8;
else
- srcDataFormat = kSourceFormatRGBA16;
+ srcDataFormat = srcByteOrder16Big ? kSourceFormatRGBA16Big : kSourceFormatRGBA16Little;
break;
default:
return false;
@@ -177,19 +197,19 @@ bool GraphicsContext3D::getImageData(Image* image,
if (bitsPerComponent == 8)
srcDataFormat = kSourceFormatA8;
else
- srcDataFormat = kSourceFormatA16;
+ srcDataFormat = srcByteOrder16Big ? kSourceFormatA16Big : kSourceFormatA16Little;
break;
case 2:
if (bitsPerComponent == 8)
srcDataFormat = kSourceFormatRA8;
else
- srcDataFormat = kSourceFormatRA16;
+ srcDataFormat = srcByteOrder16Big ? kSourceFormatRA16Big : kSourceFormatRA16Little;
break;
case 4:
if (bitsPerComponent == 8)
srcDataFormat = kSourceFormatRGBA8;
else
- srcDataFormat = kSourceFormatRGBA16;
+ srcDataFormat = srcByteOrder16Big ? kSourceFormatRGBA16Big : kSourceFormatRGBA16Little;
break;
default:
return false;
@@ -201,13 +221,13 @@ bool GraphicsContext3D::getImageData(Image* image,
if (bitsPerComponent == 8)
srcDataFormat = kSourceFormatRA8;
else
- srcDataFormat = kSourceFormatRA16;
+ srcDataFormat = srcByteOrder16Big ? kSourceFormatRA16Big : kSourceFormatRA16Little;
break;
case 4:
if (bitsPerComponent == 8)
srcDataFormat = kSourceFormatRGBA8;
else
- srcDataFormat = kSourceFormatRGBA16;
+ srcDataFormat = srcByteOrder16Big ? kSourceFormatRGBA16Big : kSourceFormatRGBA16Little;
break;
default:
return false;
@@ -219,13 +239,13 @@ bool GraphicsContext3D::getImageData(Image* image,
if (bitsPerComponent == 8)
srcDataFormat = kSourceFormatR8;
else
- srcDataFormat = kSourceFormatR16;
+ srcDataFormat = srcByteOrder16Big ? kSourceFormatR16Big : kSourceFormatR16Little;
break;
case 3:
if (bitsPerComponent == 8)
srcDataFormat = kSourceFormatRGB8;
else
- srcDataFormat = kSourceFormatRGB16;
+ srcDataFormat = srcByteOrder16Big ? kSourceFormatRGB16Big : kSourceFormatRGB16Little;
break;
default:
return false;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list