Modified: trunk/Source/WebCore/ChangeLog (121259 => 121260)
--- trunk/Source/WebCore/ChangeLog 2012-06-26 13:07:17 UTC (rev 121259)
+++ trunk/Source/WebCore/ChangeLog 2012-06-26 13:09:25 UTC (rev 121260)
@@ -1,3 +1,19 @@
+2012-06-26 Huang Dongsung <[email protected]>
+
+ [Texmap] Bug fix typo about computing bytesPerLine in BitmapTextureGL.
+ https://bugs.webkit.org/show_bug.cgi?id=89924
+
+ "bytesPerLine == targetRect.width() / 4" is invalid.
+ This patch amended it into "bytesPerLine == targetRect.width() * 4".
+ Moreover, changed magic number 4 to bytesPerPixel.
+
+ Reviewed by Noam Rosenthal.
+
+ No new tests. Covered by existing tests.
+
+ * platform/graphics/texmap/TextureMapperGL.cpp:
+ (WebCore::BitmapTextureGL::updateContents):
+
2012-06-26 Roland Takacs <[email protected]>
Shader compiler unprepared to make ESSL output when GLES is used
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp (121259 => 121260)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp 2012-06-26 13:07:17 UTC (rev 121259)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp 2012-06-26 13:09:25 UTC (rev 121260)
@@ -474,7 +474,8 @@
{
GL_CMD(glBindTexture(GL_TEXTURE_2D, m_id));
- if (bytesPerLine == targetRect.width() / 4 && sourceOffset == IntPoint::zero()) {
+ const unsigned bytesPerPixel = 4;
+ if (bytesPerLine == targetRect.width() * bytesPerPixel && sourceOffset == IntPoint::zero()) {
GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), GL_RGBA, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, (const char*)data));
return;
}
@@ -482,11 +483,11 @@
// For ES drivers that don't support sub-images.
if (!driverSupportsSubImage()) {
const char* bits = static_cast<const char*>(data);
- const char* src = "" + sourceOffset.y() * bytesPerLine + sourceOffset.x() * 4;
- Vector<char> temporaryData(targetRect.width() * targetRect.height() * 4);
+ const char* src = "" + sourceOffset.y() * bytesPerLine + sourceOffset.x() * bytesPerPixel;
+ Vector<char> temporaryData(targetRect.width() * targetRect.height() * bytesPerPixel);
char* dst = temporaryData.data();
- const int targetBytesPerLine = targetRect.width() * 4;
+ const int targetBytesPerLine = targetRect.width() * bytesPerPixel;
for (int y = 0; y < targetRect.height(); ++y) {
memcpy(dst, src, targetBytesPerLine);
src += bytesPerLine;
@@ -499,7 +500,7 @@
#if !defined(TEXMAP_OPENGL_ES_2)
// Use the OpenGL sub-image extension, now that we know it's available.
- GL_CMD(glPixelStorei(GL_UNPACK_ROW_LENGTH, bytesPerLine / 4));
+ GL_CMD(glPixelStorei(GL_UNPACK_ROW_LENGTH, bytesPerLine / bytesPerPixel));
GL_CMD(glPixelStorei(GL_UNPACK_SKIP_ROWS, sourceOffset.y()));
GL_CMD(glPixelStorei(GL_UNPACK_SKIP_PIXELS, sourceOffset.x()));
GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), GL_RGBA, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, (const char*)data));