Title: [141843] trunk/Source/WebCore
Revision
141843
Author
[email protected]
Date
2013-02-04 18:25:46 -0800 (Mon, 04 Feb 2013)

Log Message

Fix the issue that some possible source formats are ignored for float textures in texture packing for CG port
https://bugs.webkit.org/show_bug.cgi?id=108812

Patch by Jun Jiang <[email protected]> on 2013-02-04
Reviewed by Kenneth Russell.

Already covered by latest WebGL conformance test.

* platform/graphics/GraphicsContext3D.cpp:
(WebCore):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (141842 => 141843)


--- trunk/Source/WebCore/ChangeLog	2013-02-05 02:12:44 UTC (rev 141842)
+++ trunk/Source/WebCore/ChangeLog	2013-02-05 02:25:46 UTC (rev 141843)
@@ -1,3 +1,15 @@
+2013-02-04  Jun Jiang  <[email protected]>
+
+        Fix the issue that some possible source formats are ignored for float textures in texture packing for CG port
+        https://bugs.webkit.org/show_bug.cgi?id=108812
+
+        Reviewed by Kenneth Russell.
+
+        Already covered by latest WebGL conformance test.
+
+        * platform/graphics/GraphicsContext3D.cpp:
+        (WebCore):
+
 2013-02-04  Gyuyoung Kim  <[email protected]>
 
         [EFL] Remove needless local variables in LocalizedStringsEfl.cpp

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp (141842 => 141843)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp	2013-02-05 02:12:44 UTC (rev 141842)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp	2013-02-05 02:25:46 UTC (rev 141843)
@@ -519,6 +519,58 @@
     }
 }
 
+template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatABGR8, uint8_t, float>(const uint8_t* source, float* destination, unsigned pixelsPerRow)
+{
+    const float scaleFactor = 1.0f / 255.0f;
+    for (unsigned i = 0; i < pixelsPerRow; ++i) {
+        destination[0] = source[3] * scaleFactor;
+        destination[1] = source[2] * scaleFactor;
+        destination[2] = source[1] * scaleFactor;
+        destination[3] = source[0] * scaleFactor;
+        source += 4;
+        destination += 4;
+    }
+}
+
+template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatARGB8, uint8_t, float>(const uint8_t* source, float* destination, unsigned pixelsPerRow)
+{
+    const float scaleFactor = 1.0f / 255.0f;
+    for (unsigned i = 0; i < pixelsPerRow; ++i) {
+        destination[0] = source[1] * scaleFactor;
+        destination[1] = source[2] * scaleFactor;
+        destination[2] = source[3] * scaleFactor;
+        destination[3] = source[0] * scaleFactor;
+        source += 4;
+        destination += 4;
+    }
+}
+
+template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatRGB8, uint8_t, float>(const uint8_t* source, float* destination, unsigned pixelsPerRow)
+{
+    const float scaleFactor = 1.0f / 255.0f;
+    for (unsigned i = 0; i < pixelsPerRow; ++i) {
+        destination[0] = source[0] * scaleFactor;
+        destination[1] = source[1] * scaleFactor;
+        destination[2] = source[2] * scaleFactor;
+        destination[3] = 1;
+        source += 3;
+        destination += 4;
+    }
+}
+
+template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatBGR8, uint8_t, float>(const uint8_t* source, float* destination, unsigned pixelsPerRow)
+{
+    const float scaleFactor = 1.0f / 255.0f;
+    for (unsigned i = 0; i < pixelsPerRow; ++i) {
+        destination[0] = source[2] * scaleFactor;
+        destination[1] = source[1] * scaleFactor;
+        destination[2] = source[0] * scaleFactor;
+        destination[3] = 1;
+        source += 3;
+        destination += 4;
+    }
+}
+
 template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatRGB32F, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
@@ -1239,10 +1291,6 @@
         ASSERT_NOT_REACHED();
         return;
     }
-    if (IsFloatFormat<DstFormat>::Value && !IsFloatFormat<SrcFormat>::Value && SrcFormat != GraphicsContext3D::DataFormatRGBA8 && SrcFormat != GraphicsContext3D::DataFormatBGRA8) {
-        ASSERT_NOT_REACHED();
-        return;
-    }
     if (!IsFloatFormat<DstFormat>::Value && IsFloatFormat<SrcFormat>::Value) {
         ASSERT_NOT_REACHED();
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to