Loading libs/hwui/Caches.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -325,6 +325,10 @@ void Caches::setScissor(GLint x, GLint y, GLint width, GLint height) { } } void Caches::resetScissor() { mScissorX = mScissorY = mScissorWidth = mScissorHeight = 0; } TextureVertex* Caches::getRegionMesh() { // Create the mesh, 2 triangles and 4 vertices per rectangle in the region if (!mRegionMesh) { Loading libs/hwui/Caches.h +5 −0 Original line number Diff line number Diff line Loading @@ -192,6 +192,11 @@ public: */ void setScissor(GLint x, GLint y, GLint width, GLint height); /** * Resets the scissor state. */ void resetScissor(); /** * Returns the mesh used to draw regions. Calling this method will * bind a VBO of type GL_ELEMENT_ARRAY_BUFFER that contains the Loading libs/hwui/OpenGLRenderer.cpp +28 −21 Original line number Diff line number Diff line Loading @@ -206,6 +206,7 @@ void OpenGLRenderer::resume() { glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glEnable(GL_SCISSOR_TEST); mCaches.resetScissor(); dirtyClip(); mCaches.activeTexture(0); Loading Loading @@ -2517,7 +2518,27 @@ void OpenGLRenderer::chooseBlending(bool blend, SkXfermode::Mode mode, ProgramDescription& description, bool swapSrcDst) { blend = blend || mode != SkXfermode::kSrcOver_Mode; if (blend) { if (mode <= SkXfermode::kScreen_Mode) { // These blend modes are not supported by OpenGL directly and have // to be implemented using shaders. Since the shader will perform // the blending, turn blending off here // If the blend mode cannot be implemented using shaders, fall // back to the default SrcOver blend mode instead if (mode > SkXfermode::kScreen_Mode) { if (mCaches.extensions.hasFramebufferFetch()) { description.framebufferMode = mode; description.swapSrcDst = swapSrcDst; if (mCaches.blend) { glDisable(GL_BLEND); mCaches.blend = false; } return; } else { mode = SkXfermode::kSrcOver_Mode; } } if (!mCaches.blend) { glEnable(GL_BLEND); } Loading @@ -2530,20 +2551,6 @@ void OpenGLRenderer::chooseBlending(bool blend, SkXfermode::Mode mode, mCaches.lastSrcMode = sourceMode; mCaches.lastDstMode = destMode; } } else { // These blend modes are not supported by OpenGL directly and have // to be implemented using shaders. Since the shader will perform // the blending, turn blending off here if (mCaches.extensions.hasFramebufferFetch()) { description.framebufferMode = mode; description.swapSrcDst = swapSrcDst; } if (mCaches.blend) { glDisable(GL_BLEND); } blend = false; } } else if (mCaches.blend) { glDisable(GL_BLEND); } Loading Loading
libs/hwui/Caches.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -325,6 +325,10 @@ void Caches::setScissor(GLint x, GLint y, GLint width, GLint height) { } } void Caches::resetScissor() { mScissorX = mScissorY = mScissorWidth = mScissorHeight = 0; } TextureVertex* Caches::getRegionMesh() { // Create the mesh, 2 triangles and 4 vertices per rectangle in the region if (!mRegionMesh) { Loading
libs/hwui/Caches.h +5 −0 Original line number Diff line number Diff line Loading @@ -192,6 +192,11 @@ public: */ void setScissor(GLint x, GLint y, GLint width, GLint height); /** * Resets the scissor state. */ void resetScissor(); /** * Returns the mesh used to draw regions. Calling this method will * bind a VBO of type GL_ELEMENT_ARRAY_BUFFER that contains the Loading
libs/hwui/OpenGLRenderer.cpp +28 −21 Original line number Diff line number Diff line Loading @@ -206,6 +206,7 @@ void OpenGLRenderer::resume() { glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glEnable(GL_SCISSOR_TEST); mCaches.resetScissor(); dirtyClip(); mCaches.activeTexture(0); Loading Loading @@ -2517,7 +2518,27 @@ void OpenGLRenderer::chooseBlending(bool blend, SkXfermode::Mode mode, ProgramDescription& description, bool swapSrcDst) { blend = blend || mode != SkXfermode::kSrcOver_Mode; if (blend) { if (mode <= SkXfermode::kScreen_Mode) { // These blend modes are not supported by OpenGL directly and have // to be implemented using shaders. Since the shader will perform // the blending, turn blending off here // If the blend mode cannot be implemented using shaders, fall // back to the default SrcOver blend mode instead if (mode > SkXfermode::kScreen_Mode) { if (mCaches.extensions.hasFramebufferFetch()) { description.framebufferMode = mode; description.swapSrcDst = swapSrcDst; if (mCaches.blend) { glDisable(GL_BLEND); mCaches.blend = false; } return; } else { mode = SkXfermode::kSrcOver_Mode; } } if (!mCaches.blend) { glEnable(GL_BLEND); } Loading @@ -2530,20 +2551,6 @@ void OpenGLRenderer::chooseBlending(bool blend, SkXfermode::Mode mode, mCaches.lastSrcMode = sourceMode; mCaches.lastDstMode = destMode; } } else { // These blend modes are not supported by OpenGL directly and have // to be implemented using shaders. Since the shader will perform // the blending, turn blending off here if (mCaches.extensions.hasFramebufferFetch()) { description.framebufferMode = mode; description.swapSrcDst = swapSrcDst; } if (mCaches.blend) { glDisable(GL_BLEND); } blend = false; } } else if (mCaches.blend) { glDisable(GL_BLEND); } Loading