Merge "Import revised translations."
diff --git a/opengl/libs/GLES2_dbg/Android.mk b/opengl/libs/GLES2_dbg/Android.mk
index c2b1142..70853d8 100644
--- a/opengl/libs/GLES2_dbg/Android.mk
+++ b/opengl/libs/GLES2_dbg/Android.mk
@@ -31,6 +31,9 @@
     LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
 endif
 
+LOCAL_CFLAGS += -DLOG_TAG=\"libGLES2_dbg\"
+
+
 # we need to access the private Bionic header <bionic_tls.h>
 # on ARM platforms, we need to mirror the ARCH_ARM_HAVE_TLS_REGISTER
 # behavior from the bionic Android.mk file
diff --git a/opengl/libs/GLES2_dbg/src/dbgcontext.cpp b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
index 9e77665..41061e1 100644
--- a/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
+++ b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
@@ -30,13 +30,11 @@
 }
 
 DbgContext::DbgContext(const unsigned version, const gl_hooks_t * const hooks,
-                       const unsigned MAX_VERTEX_ATTRIBS, const GLenum readFormat,
-                       const GLenum readType)
+                       const unsigned MAX_VERTEX_ATTRIBS)
         : lzf_buf(NULL), lzf_readIndex(0), lzf_refSize(0), lzf_refBufSize(0)
         , version(version), hooks(hooks)
         , MAX_VERTEX_ATTRIBS(MAX_VERTEX_ATTRIBS)
-        , readFormat(readFormat), readType(readType)
-        , readBytesPerPixel(GetBytesPerPixel(readFormat, readType))
+        , readBytesPerPixel(4)
         , captureSwap(0), captureDraw(0)
         , vertexAttribs(new VertexAttrib[MAX_VERTEX_ATTRIBS])
         , hasNonVBOAttribs(false), indexBuffers(NULL), indexBuffer(NULL)
@@ -67,11 +65,7 @@
     assert(GL_NO_ERROR == hooks->gl.glGetError());
     GLint MAX_VERTEX_ATTRIBS = 0;
     hooks->gl.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &MAX_VERTEX_ATTRIBS);
-    GLint readFormat, readType;
-    hooks->gl.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &readFormat);
-    hooks->gl.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &readType);
-    DbgContext* dbg = new DbgContext(version, hooks, MAX_VERTEX_ATTRIBS, readFormat, readType);
-
+    DbgContext* dbg = new DbgContext(version, hooks, MAX_VERTEX_ATTRIBS);
     glesv2debugger::Message msg, cmd;
     msg.set_context_id(reinterpret_cast<int>(dbg));
     msg.set_expect_response(false);
@@ -100,33 +94,31 @@
 {
     switch (type) {
     case GL_UNSIGNED_SHORT_5_6_5:
-        return 2;
     case GL_UNSIGNED_SHORT_4_4_4_4:
-        return 2;
     case GL_UNSIGNED_SHORT_5_5_5_1:
         return 2;
     case GL_UNSIGNED_BYTE:
         break;
     default:
-        assert(0);
+        LOGE("GetBytesPerPixel: unknown type %x", type);
     }
 
     switch (format) {
     case GL_ALPHA:
-        return 1;
     case GL_LUMINANCE:
         return 1;
-        break;
     case GL_LUMINANCE_ALPHA:
         return 2;
     case GL_RGB:
         return 3;
     case GL_RGBA:
+    case 0x80E1:   // GL_BGRA_EXT
         return 4;
     default:
-        assert(0);
-        return 0;
+        LOGE("GetBytesPerPixel: unknown format %x", format);
     }
+
+    return 1; // in doubt...
 }
 
 void DbgContext::Fetch(const unsigned index, std::string * const data) const
diff --git a/opengl/libs/GLES2_dbg/src/egl.cpp b/opengl/libs/GLES2_dbg/src/egl.cpp
index eb28d06..bbea3bd 100644
--- a/opengl/libs/GLES2_dbg/src/egl.cpp
+++ b/opengl/libs/GLES2_dbg/src/egl.cpp
@@ -41,11 +41,11 @@
         void * pixels = dbg->GetReadPixelsBuffer(viewport[2] * viewport[3] *
                         dbg->readBytesPerPixel);
         dbg->hooks->gl.glReadPixels(viewport[0], viewport[1], viewport[2],
-                                    viewport[3], dbg->readFormat, dbg->readType, pixels);
+                                    viewport[3], GL_RGBA, GL_UNSIGNED_BYTE, pixels);
         dbg->CompressReadPixelBuffer(msg.mutable_data());
         msg.set_data_type(msg.ReferencedImage);
-        msg.set_pixel_format(dbg->readFormat);
-        msg.set_pixel_type(dbg->readType);
+        msg.set_pixel_format(GL_RGBA);
+        msg.set_pixel_type(GL_UNSIGNED_BYTE);
         msg.set_image_width(viewport[2]);
         msg.set_image_height(viewport[3]);
     }
diff --git a/opengl/libs/GLES2_dbg/src/header.h b/opengl/libs/GLES2_dbg/src/header.h
index f2b1fa6..49f3847 100644
--- a/opengl/libs/GLES2_dbg/src/header.h
+++ b/opengl/libs/GLES2_dbg/src/header.h
@@ -87,7 +87,6 @@
     const unsigned int version; // 0 is GLES1, 1 is GLES2
     const gl_hooks_t * const hooks;
     const unsigned int MAX_VERTEX_ATTRIBS;
-    const GLenum readFormat, readType; // implementation supported glReadPixels
     const unsigned int readBytesPerPixel;
 
     unsigned int captureSwap; // number of eglSwapBuffers to glReadPixels
@@ -124,8 +123,7 @@
     unsigned maxAttrib; // number of slots used by program
 
     DbgContext(const unsigned version, const gl_hooks_t * const hooks,
-               const unsigned MAX_VERTEX_ATTRIBS, const GLenum readFormat,
-               const GLenum readType);
+               const unsigned MAX_VERTEX_ATTRIBS);
     ~DbgContext();
 
     void Fetch(const unsigned index, std::string * const data) const;
diff --git a/opengl/libs/GLES2_dbg/src/vertex.cpp b/opengl/libs/GLES2_dbg/src/vertex.cpp
index 029ee3b..28a2420 100644
--- a/opengl/libs/GLES2_dbg/src/vertex.cpp
+++ b/opengl/libs/GLES2_dbg/src/vertex.cpp
@@ -77,7 +77,7 @@
                 pixels = dbg->GetReadPixelsBuffer(viewport[2] * viewport[3] *
                                                   dbg->readBytesPerPixel);
                 Debug_glReadPixels(viewport[0], viewport[1], viewport[2], viewport[3],
-                                   dbg->readFormat, dbg->readType, pixels);
+                        GL_RGBA, GL_UNSIGNED_BYTE, pixels);
             }
             break;
         case glesv2debugger::Message_Function_SKIP:
@@ -134,19 +134,22 @@
     msg.set_arg7(dbg->maxAttrib); // indicate capturing vertex data
     std::string * const data = msg.mutable_data();
     if (GL_UNSIGNED_BYTE == type) {
-        if (dbg->indexBuffer)
+        if (dbg->indexBuffer) {
             FetchIndexed(count, (unsigned char *)dbg->indexBuffer->data +
                          (unsigned long)indices, data, dbg);
-        else
+        } else {
             FetchIndexed(count, (unsigned char *)indices, data, dbg);
+        }
     } else if (GL_UNSIGNED_SHORT == type) {
-        if (dbg->indexBuffer)
+        if (dbg->indexBuffer) {
             FetchIndexed(count, (unsigned short *)((char *)dbg->indexBuffer->data +
                                                    (unsigned long)indices), data, dbg);
-        else
+        } else {
             FetchIndexed(count, (unsigned short *)indices, data, dbg);
-    } else
+        }
+    } else {
         assert(0);
+    }
 
     void * pixels = NULL;
     int viewport[4] = {};
@@ -174,7 +177,7 @@
             Send(msg, cmd);
             expectResponse = cmd.expect_response();
             // TODO: pack glReadPixels data with vertex data instead of
-            //  relying on sperate call for transport, this would allow
+            //  relying on separate call for transport, this would allow
             //  auto generated message loop using EXTEND_Debug macro
             if (dbg->captureDraw > 0) {
                 dbg->captureDraw--;
@@ -182,7 +185,7 @@
                 pixels = dbg->GetReadPixelsBuffer(viewport[2] * viewport[3] *
                                                   dbg->readBytesPerPixel);
                 Debug_glReadPixels(viewport[0], viewport[1], viewport[2], viewport[3],
-                                   dbg->readFormat, dbg->readType, pixels);
+                        GL_RGBA, GL_UNSIGNED_BYTE, pixels);
             }
             break;
         case glesv2debugger::Message_Function_SKIP:
diff --git a/opengl/libs/GLES2_dbg/test/test_main.cpp b/opengl/libs/GLES2_dbg/test/test_main.cpp
index 058bea4..183bf8e 100644
--- a/opengl/libs/GLES2_dbg/test/test_main.cpp
+++ b/opengl/libs/GLES2_dbg/test/test_main.cpp
@@ -29,7 +29,7 @@
     gl_hooks_t hooks;
 
     DbgContextTest()
-            : dbg(1, &hooks, 32, GL_RGBA, GL_UNSIGNED_BYTE) {
+            : dbg(1, &hooks, 32) {
         // You can do set-up work for each test here.
         hooks.gl.glGetError = GetError;
     }
diff --git a/opengl/libs/GLES2_dbg/test/test_server.cpp b/opengl/libs/GLES2_dbg/test/test_server.cpp
index bbbe913..0ab87b0 100644
--- a/opengl/libs/GLES2_dbg/test/test_server.cpp
+++ b/opengl/libs/GLES2_dbg/test/test_server.cpp
@@ -151,7 +151,7 @@
     virtual void SetUp() {
         ServerFileTest::SetUp();
 
-        dbg = new DbgContext(1, &hooks, 32, GL_RGBA, GL_UNSIGNED_BYTE);
+        dbg = new DbgContext(1, &hooks, 32);
         ASSERT_NE((void *)NULL, dbg);
         for (unsigned int i = 0; i < sizeof(hooks) / sizeof(void *); i++)
             ((void **)&hooks)[i] = reinterpret_cast<void *>(glNoop);
diff --git a/opengl/libs/GLES2_dbg/test/test_socket.cpp b/opengl/libs/GLES2_dbg/test/test_socket.cpp
index b2148ac..9f815e2 100644
--- a/opengl/libs/GLES2_dbg/test/test_socket.cpp
+++ b/opengl/libs/GLES2_dbg/test/test_socket.cpp
@@ -44,7 +44,7 @@
     }
 
     virtual void SetUp() {
-        dbg = new DbgContext(1, &hooks, 32, GL_RGBA, GL_UNSIGNED_BYTE);
+        dbg = new DbgContext(1, &hooks, 32);
         ASSERT_TRUE(dbg != NULL);
         for (unsigned int i = 0; i < sizeof(hooks) / sizeof(void *); i++)
             ((void **)&hooks)[i] = (void *)glNoop;