Loading libs/hwui/Layer.h +4 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,10 @@ struct Layer { * Indicates whether this layer should be blended. */ bool blend; /** * Indicates that this layer has never been used before. */ bool empty; }; // struct Layer }; // namespace uirenderer Loading libs/hwui/LayerCache.cpp +3 −5 Original line number Diff line number Diff line Loading @@ -109,18 +109,16 @@ Layer* LayerCache::get(LayerSize& size) { layer = new Layer; layer->blend = true; layer->empty = true; glGenTextures(1, &layer->texture); glBindTexture(GL_TEXTURE_2D, layer->texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width, size.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); } return layer; Loading libs/hwui/OpenGLRenderer.cpp +9 −2 Original line number Diff line number Diff line Loading @@ -381,8 +381,15 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top, // Copy the framebuffer into the layer glBindTexture(GL_TEXTURE_2D, layer->texture); if (layer->empty) { glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left, mHeight - bounds.bottom, bounds.getWidth(), bounds.getHeight(), 0); layer->empty = false; } else { glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left, mHeight - bounds.bottom, bounds.getWidth(), bounds.getHeight()); } if (flags & SkCanvas::kClipToLayer_SaveFlag) { if (mSnapshot->clipTransformed(bounds)) setScissorFromClip(); Loading Loading
libs/hwui/Layer.h +4 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,10 @@ struct Layer { * Indicates whether this layer should be blended. */ bool blend; /** * Indicates that this layer has never been used before. */ bool empty; }; // struct Layer }; // namespace uirenderer Loading
libs/hwui/LayerCache.cpp +3 −5 Original line number Diff line number Diff line Loading @@ -109,18 +109,16 @@ Layer* LayerCache::get(LayerSize& size) { layer = new Layer; layer->blend = true; layer->empty = true; glGenTextures(1, &layer->texture); glBindTexture(GL_TEXTURE_2D, layer->texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width, size.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); } return layer; Loading
libs/hwui/OpenGLRenderer.cpp +9 −2 Original line number Diff line number Diff line Loading @@ -381,8 +381,15 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top, // Copy the framebuffer into the layer glBindTexture(GL_TEXTURE_2D, layer->texture); if (layer->empty) { glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left, mHeight - bounds.bottom, bounds.getWidth(), bounds.getHeight(), 0); layer->empty = false; } else { glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left, mHeight - bounds.bottom, bounds.getWidth(), bounds.getHeight()); } if (flags & SkCanvas::kClipToLayer_SaveFlag) { if (mSnapshot->clipTransformed(bounds)) setScissorFromClip(); Loading