Docs updates.
Change-Id: Iff395e1c6d81a484a2c4ad6e88357c0134971b78
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index a65edcd..b1f5f6b 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -80,6 +80,9 @@
{ SkXfermode::kXor_Mode, GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA }
};
+// This array contains the swapped version of each SkXfermode. For instance
+// this array's SrcOver blending mode is actually DstOver. You can refer to
+// createLayer() for more information on the purpose of this array.
static const Blender gBlendsSwap[] = {
{ SkXfermode::kClear_Mode, GL_ZERO, GL_ZERO },
{ SkXfermode::kSrc_Mode, GL_ZERO, GL_ONE },
@@ -302,7 +305,7 @@
* This implementation relies on the frame buffer being at least RGBA 8888. When
* a layer is created, only a texture is created, not an FBO. The content of the
* frame buffer contained within the layer's bounds is copied into this texture
- * using glCopyTexImage2D(). The layer's region is then cleared in the frame
+ * using glCopyTexImage2D(). The layer's region is then cleared(1) in the frame
* buffer and drawing continues as normal. This technique therefore treats the
* frame buffer as a scratch buffer for the layers.
*
@@ -322,6 +325,11 @@
* Because glCopyTexImage2D() can be slow, an alternative implementation might
* be use to draw a single clipped layer. The implementation described above
* is correct in every case.
+ *
+ * (1) The frame buffer is actually not cleared right away. To allow the GPU
+ * to potentially optimize series of calls to glCopyTexImage2D, the frame
+ * buffer is left untouched until the first drawing operation. Only when
+ * something actually gets drawn are the layers regions cleared.
*/
bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top,
float right, float bottom, int alpha, SkXfermode::Mode mode,int flags) {
diff --git a/libs/hwui/Snapshot.h b/libs/hwui/Snapshot.h
index ebedf53..062c986 100644
--- a/libs/hwui/Snapshot.h
+++ b/libs/hwui/Snapshot.h
@@ -116,6 +116,11 @@
bool clipTransformed(const Rect& r, SkRegion::Op op = SkRegion::kIntersect_Op) {
bool clipped = false;
+ // NOTE: The unimplemented operations require support for regions
+ // Supporting regions would require using a stencil buffer instead
+ // of the scissor. The stencil buffer itself is not too expensive
+ // (memory cost excluded) but on fillrate limited devices, managing
+ // the stencil might have a negative impact on the framerate.
switch (op) {
case SkRegion::kDifference_Op:
break;