Polygonal rendering of simple fill shapes
bug:4419017
Change-Id: If0428e1732139786cba15f54b285d880e4a56b89
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp
index 5d59a4c..794c80a 100644
--- a/libs/hwui/LayerRenderer.cpp
+++ b/libs/hwui/LayerRenderer.cpp
@@ -345,7 +345,7 @@
bool LayerRenderer::copyLayer(Layer* layer, SkBitmap* bitmap) {
Caches& caches = Caches::getInstance();
- if (layer && layer->isTextureLayer() && bitmap->width() <= caches.maxTextureSize &&
+ if (layer && bitmap->width() <= caches.maxTextureSize &&
bitmap->height() <= caches.maxTextureSize) {
GLuint fbo = caches.fboCache.get();
@@ -358,6 +358,7 @@
GLuint texture;
GLuint previousFbo;
+ GLuint previousViewport[4];
GLenum format;
GLenum type;
@@ -387,11 +388,13 @@
float alpha = layer->getAlpha();
SkXfermode::Mode mode = layer->getMode();
+ GLuint previousLayerFbo = layer->getFbo();
layer->setAlpha(255, SkXfermode::kSrc_Mode);
layer->setFbo(fbo);
glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*) &previousFbo);
+ glGetIntegerv(GL_VIEWPORT, (GLint*) &previousViewport);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glGenTextures(1, &texture);
@@ -459,9 +462,11 @@
glBindFramebuffer(GL_FRAMEBUFFER, previousFbo);
layer->setAlpha(alpha, mode);
- layer->setFbo(0);
+ layer->setFbo(previousLayerFbo);
glDeleteTextures(1, &texture);
caches.fboCache.put(fbo);
+ glViewport(previousViewport[0], previousViewport[1],
+ previousViewport[2], previousViewport[3]);
return status;
}