summaryrefslogtreecommitdiff
path: root/libs/hwui/PixelBuffer.h
diff options
context:
space:
mode:
author Digish Pandya <digishp@codeaurora.org> 2014-05-12 14:37:04 +0530
committer Digish Pandya <digishp@codeaurora.org> 2014-05-15 08:59:22 +0530
commitc62c1cc17ded117433d23ba5dd6c364b05fbcdbd (patch)
tree77a4ff0a587caaf8dd612dcf6e642a7e5f25bcf4 /libs/hwui/PixelBuffer.h
parente3e2c471b2504335e99ed15975c3c5c9dfbf2795 (diff)
Use alpha channel instead of red in drawCachedGlyphBitmap
the correct value to copy in bitmap is alpha component from the cachebuffer. currently it is offset to red channel if format is RGBA which is wrong. this is followup fix for https://android-review.googlesource.com/#/c/93943/ Change-Id: I96b5ba35df5ccaef44caf2542d35d6585ba1df80 Signed-off-by: Digish Pandya <digishp@codeaurora.org>
Diffstat (limited to 'libs/hwui/PixelBuffer.h')
-rw-r--r--libs/hwui/PixelBuffer.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/libs/hwui/PixelBuffer.h b/libs/hwui/PixelBuffer.h
index 9725a6162a2c..04225a20cfc2 100644
--- a/libs/hwui/PixelBuffer.h
+++ b/libs/hwui/PixelBuffer.h
@@ -175,6 +175,25 @@ public:
return 0;
}
+ /**
+ * Returns the alpha channel offset in the specified format.
+ *
+ * Supported formats:
+ * GL_ALPHA
+ * GL_RGBA
+ */
+ static uint32_t formatAlphaOffset(GLenum format) {
+ switch (format) {
+ case GL_ALPHA:
+ return 0;
+ case GL_RGBA:
+ return 3;
+ }
+
+ ALOGE("unsupported format: %d",format);
+ return 0;
+ }
+
protected:
/**
* Creates a new render buffer in the specified format and dimensions.