diff options
| author | Romain Guy <romainguy@google.com> | 2010-09-13 18:11:21 -0700 |
|---|---|---|
| committer | Romain Guy <romainguy@google.com> | 2010-09-13 18:13:52 -0700 |
| commit | 87a76578f76f4a6bceb187da6b7a01899ca0d85a (patch) | |
| tree | 853825c9d863f06c7ace42e2fd5da3ce814c92a5 /libs | |
| parent | e8c1c539ca18f8aeb74c3a3710893516e2c1be7c (diff) | |
| download | frameworks_base-87a76578f76f4a6bceb187da6b7a01899ca0d85a.zip frameworks_base-87a76578f76f4a6bceb187da6b7a01899ca0d85a.tar.gz frameworks_base-87a76578f76f4a6bceb187da6b7a01899ca0d85a.tar.bz2 | |
Docs updates.
Change-Id: Iff395e1c6d81a484a2c4ad6e88357c0134971b78
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 10 | ||||
| -rw-r--r-- | libs/hwui/Snapshot.h | 5 |
2 files changed, 14 insertions, 1 deletions
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 @@ static const Blender gBlends[] = { { 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 @@ int OpenGLRenderer::saveLayerAlpha(float left, float top, float right, float bot * 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 @@ int OpenGLRenderer::saveLayerAlpha(float left, float top, float right, float bot * 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 @@ public: 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; |
