Loading libs/hwui/BakedOpRenderer.cpp +10 −4 Original line number Diff line number Diff line Loading @@ -208,7 +208,6 @@ void BakedOpRenderer::drawRects(const float* rects, int count, const SkPaint* pa // TODO: Currently assume full FBO damage, due to FrameInfoVisualizer::unionDirty. // Should should scissor/set mHasDrawn safely. mRenderState.scissor().setEnabled(false); mHasDrawn = true; Glop glop; GlopBuilder(mRenderState, mCaches, &glop) .setRoundRectClipState(nullptr) Loading @@ -217,7 +216,11 @@ void BakedOpRenderer::drawRects(const float* rects, int count, const SkPaint* pa .setTransform(Matrix4::identity(), TransformFlags::None) .setModelViewIdentityEmptyBounds() .build(); mRenderState.render(glop, mRenderTarget.orthoMatrix); // Disable blending if this is the first draw to the main framebuffer, in case app has defined // transparency where it doesn't make sense - as first draw in opaque window. bool overrideDisableBlending = !mHasDrawn && mOpaque && !mRenderTarget.frameBufferId; mRenderState.render(glop, mRenderTarget.orthoMatrix, overrideDisableBlending); mHasDrawn = true; } // clears and re-fills stencil with provided rendertarget space quads, Loading @@ -234,7 +237,7 @@ void BakedOpRenderer::setupStencilQuads(std::vector<Vertex>& quadVertices, .setTransform(Matrix4::identity(), TransformFlags::None) .setModelViewIdentityEmptyBounds() .build(); mRenderState.render(glop, mRenderTarget.orthoMatrix); mRenderState.render(glop, mRenderTarget.orthoMatrix, false); mRenderState.stencil().enableTest(incrementThreshold); } Loading Loading @@ -346,7 +349,10 @@ void BakedOpRenderer::prepareRender(const Rect* dirtyBounds, const ClipBase* cli void BakedOpRenderer::renderGlopImpl(const Rect* dirtyBounds, const ClipBase* clip, const Glop& glop) { prepareRender(dirtyBounds, clip); mRenderState.render(glop, mRenderTarget.orthoMatrix); // Disable blending if this is the first draw to the main framebuffer, in case app has defined // transparency where it doesn't make sense - as first draw in opaque window. bool overrideDisableBlending = !mHasDrawn && mOpaque && !mRenderTarget.frameBufferId; mRenderState.render(glop, mRenderTarget.orthoMatrix, overrideDisableBlending); if (!mRenderTarget.frameBufferId) mHasDrawn = true; } Loading libs/hwui/OpenGLReadback.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -228,7 +228,7 @@ inline CopyResult copyTextureInto(Caches& caches, RenderState& renderState, .build(); Matrix4 ortho; ortho.loadOrtho(destWidth, destHeight); renderState.render(glop, ortho); renderState.render(glop, ortho, false); // TODO: We should convert to linear space when the target is RGBA16F glReadPixels(0, 0, bitmap->width(), bitmap->height(), format, Loading libs/hwui/renderstate/Blend.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -118,7 +118,7 @@ void Blend::getFactors(SkBlendMode mode, ModeOrderSwap modeUsage, GLenum* outSrc } void Blend::setFactors(GLenum srcMode, GLenum dstMode) { if (srcMode == GL_ZERO && dstMode == GL_ZERO) { if ((srcMode == GL_ZERO || srcMode == GL_ONE) && dstMode == GL_ZERO) { // disable blending if (mEnabled) { glDisable(GL_BLEND); Loading libs/hwui/renderstate/RenderState.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -262,7 +262,8 @@ void RenderState::postDecStrong(VirtualLightRefBase* object) { // Render /////////////////////////////////////////////////////////////////////////////// void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix) { void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix, bool overrideDisableBlending) { const Glop::Mesh& mesh = glop.mesh; const Glop::Mesh::Vertices& vertices = mesh.vertices; const Glop::Mesh::Indices& indices = mesh.indices; Loading Loading @@ -417,7 +418,11 @@ void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix) { // ------------------------------------ // ---------- GL state setup ---------- // ------------------------------------ if (CC_UNLIKELY(overrideDisableBlending)) { blend().setFactors(GL_ZERO, GL_ZERO); } else { blend().setFactors(glop.blend.src, glop.blend.dst); } GL_CHECKPOINT(MODERATE); Loading libs/hwui/renderstate/RenderState.h +1 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ public: // more thinking... void postDecStrong(VirtualLightRefBase* object); void render(const Glop& glop, const Matrix4& orthoMatrix); void render(const Glop& glop, const Matrix4& orthoMatrix, bool overrideDisableBlending); Blend& blend() { return *mBlend; } MeshState& meshState() { return *mMeshState; } Loading Loading
libs/hwui/BakedOpRenderer.cpp +10 −4 Original line number Diff line number Diff line Loading @@ -208,7 +208,6 @@ void BakedOpRenderer::drawRects(const float* rects, int count, const SkPaint* pa // TODO: Currently assume full FBO damage, due to FrameInfoVisualizer::unionDirty. // Should should scissor/set mHasDrawn safely. mRenderState.scissor().setEnabled(false); mHasDrawn = true; Glop glop; GlopBuilder(mRenderState, mCaches, &glop) .setRoundRectClipState(nullptr) Loading @@ -217,7 +216,11 @@ void BakedOpRenderer::drawRects(const float* rects, int count, const SkPaint* pa .setTransform(Matrix4::identity(), TransformFlags::None) .setModelViewIdentityEmptyBounds() .build(); mRenderState.render(glop, mRenderTarget.orthoMatrix); // Disable blending if this is the first draw to the main framebuffer, in case app has defined // transparency where it doesn't make sense - as first draw in opaque window. bool overrideDisableBlending = !mHasDrawn && mOpaque && !mRenderTarget.frameBufferId; mRenderState.render(glop, mRenderTarget.orthoMatrix, overrideDisableBlending); mHasDrawn = true; } // clears and re-fills stencil with provided rendertarget space quads, Loading @@ -234,7 +237,7 @@ void BakedOpRenderer::setupStencilQuads(std::vector<Vertex>& quadVertices, .setTransform(Matrix4::identity(), TransformFlags::None) .setModelViewIdentityEmptyBounds() .build(); mRenderState.render(glop, mRenderTarget.orthoMatrix); mRenderState.render(glop, mRenderTarget.orthoMatrix, false); mRenderState.stencil().enableTest(incrementThreshold); } Loading Loading @@ -346,7 +349,10 @@ void BakedOpRenderer::prepareRender(const Rect* dirtyBounds, const ClipBase* cli void BakedOpRenderer::renderGlopImpl(const Rect* dirtyBounds, const ClipBase* clip, const Glop& glop) { prepareRender(dirtyBounds, clip); mRenderState.render(glop, mRenderTarget.orthoMatrix); // Disable blending if this is the first draw to the main framebuffer, in case app has defined // transparency where it doesn't make sense - as first draw in opaque window. bool overrideDisableBlending = !mHasDrawn && mOpaque && !mRenderTarget.frameBufferId; mRenderState.render(glop, mRenderTarget.orthoMatrix, overrideDisableBlending); if (!mRenderTarget.frameBufferId) mHasDrawn = true; } Loading
libs/hwui/OpenGLReadback.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -228,7 +228,7 @@ inline CopyResult copyTextureInto(Caches& caches, RenderState& renderState, .build(); Matrix4 ortho; ortho.loadOrtho(destWidth, destHeight); renderState.render(glop, ortho); renderState.render(glop, ortho, false); // TODO: We should convert to linear space when the target is RGBA16F glReadPixels(0, 0, bitmap->width(), bitmap->height(), format, Loading
libs/hwui/renderstate/Blend.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -118,7 +118,7 @@ void Blend::getFactors(SkBlendMode mode, ModeOrderSwap modeUsage, GLenum* outSrc } void Blend::setFactors(GLenum srcMode, GLenum dstMode) { if (srcMode == GL_ZERO && dstMode == GL_ZERO) { if ((srcMode == GL_ZERO || srcMode == GL_ONE) && dstMode == GL_ZERO) { // disable blending if (mEnabled) { glDisable(GL_BLEND); Loading
libs/hwui/renderstate/RenderState.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -262,7 +262,8 @@ void RenderState::postDecStrong(VirtualLightRefBase* object) { // Render /////////////////////////////////////////////////////////////////////////////// void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix) { void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix, bool overrideDisableBlending) { const Glop::Mesh& mesh = glop.mesh; const Glop::Mesh::Vertices& vertices = mesh.vertices; const Glop::Mesh::Indices& indices = mesh.indices; Loading Loading @@ -417,7 +418,11 @@ void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix) { // ------------------------------------ // ---------- GL state setup ---------- // ------------------------------------ if (CC_UNLIKELY(overrideDisableBlending)) { blend().setFactors(GL_ZERO, GL_ZERO); } else { blend().setFactors(glop.blend.src, glop.blend.dst); } GL_CHECKPOINT(MODERATE); Loading
libs/hwui/renderstate/RenderState.h +1 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ public: // more thinking... void postDecStrong(VirtualLightRefBase* object); void render(const Glop& glop, const Matrix4& orthoMatrix); void render(const Glop& glop, const Matrix4& orthoMatrix, bool overrideDisableBlending); Blend& blend() { return *mBlend; } MeshState& meshState() { return *mMeshState; } Loading