Loading libs/hwui/GlopBuilder.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include "Caches.h" #include "Glop.h" #include "Matrix.h" #include "Patch.h" #include "renderstate/MeshState.h" #include "renderstate/RenderState.h" #include "SkiaShader.h" Loading Loading @@ -189,6 +190,20 @@ GlopBuilder& GlopBuilder::setMeshVertexBuffer(const VertexBuffer& vertexBuffer, return *this; } GlopBuilder& GlopBuilder::setMeshPatchQuads(const Patch& patch) { TRIGGER_STAGE(kMeshStage); mOutGlop->mesh.primitiveMode = GL_TRIANGLES; mOutGlop->mesh.indices = { mRenderState.meshState().getQuadListIBO(), nullptr }; mOutGlop->mesh.vertices = { mCaches.patchCache.getMeshBuffer(), VertexAttribFlags::kTextureCoord, (void*)patch.offset, (void*)patch.textureOffset, nullptr, kTextureVertexStride }; mOutGlop->mesh.elementCount = patch.indexCount; return *this; } //////////////////////////////////////////////////////////////////////////////// // Fill //////////////////////////////////////////////////////////////////////////////// Loading libs/hwui/GlopBuilder.h +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ public: GlopBuilder& setMeshTexturedMesh(TextureVertex* vertexData, int elementCount); // TODO: use indexed quads GlopBuilder& setMeshColoredTexturedMesh(ColorTextureVertex* vertexData, int elementCount); // TODO: use indexed quads GlopBuilder& setMeshTexturedIndexedQuads(TextureVertex* vertexData, int elementCount); // TODO: take quadCount GlopBuilder& setMeshPatchQuads(const Patch& patch); GlopBuilder& setFillPaint(const SkPaint& paint, float alphaScale); GlopBuilder& setFillTexturePaint(Texture& texture, int textureFillFlags, Loading libs/hwui/OpenGLRenderer.cpp +20 −1 Original line number Diff line number Diff line Loading @@ -2326,9 +2326,28 @@ void OpenGLRenderer::drawPatch(const SkBitmap* bitmap, const Patch* mesh, return; } mCaches.textureState().activateTexture(0); Texture* texture = entry ? entry->texture : mCaches.textureCache.get(bitmap); if (!texture) return; if (USE_GLOPS) { // 9 patches are built for stretching - always filter int textureFillFlags = static_cast<int>(TextureFillFlags::kForceFilter); if (bitmap->colorType() == kAlpha_8_SkColorType) { textureFillFlags |= TextureFillFlags::kIsAlphaMaskTexture; } Glop glop; GlopBuilder(mRenderState, mCaches, &glop) .setMeshPatchQuads(*mesh) .setFillTexturePaint(*texture, textureFillFlags, paint, currentSnapshot()->alpha) .setTransform(currentSnapshot()->getOrthoMatrix(), *currentTransform(), false) .setModelViewOffsetRectSnap(left, top, Rect(0, 0, right - left, bottom - top)) // TODO: get minimal bounds from patch .setRoundRectClipState(currentSnapshot()->roundRectClipState) .build(); renderGlop(glop); return; } mCaches.textureState().activateTexture(0); const AutoTexture autoCleanup(texture); texture->setWrap(GL_CLAMP_TO_EDGE, true); Loading Loading
libs/hwui/GlopBuilder.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include "Caches.h" #include "Glop.h" #include "Matrix.h" #include "Patch.h" #include "renderstate/MeshState.h" #include "renderstate/RenderState.h" #include "SkiaShader.h" Loading Loading @@ -189,6 +190,20 @@ GlopBuilder& GlopBuilder::setMeshVertexBuffer(const VertexBuffer& vertexBuffer, return *this; } GlopBuilder& GlopBuilder::setMeshPatchQuads(const Patch& patch) { TRIGGER_STAGE(kMeshStage); mOutGlop->mesh.primitiveMode = GL_TRIANGLES; mOutGlop->mesh.indices = { mRenderState.meshState().getQuadListIBO(), nullptr }; mOutGlop->mesh.vertices = { mCaches.patchCache.getMeshBuffer(), VertexAttribFlags::kTextureCoord, (void*)patch.offset, (void*)patch.textureOffset, nullptr, kTextureVertexStride }; mOutGlop->mesh.elementCount = patch.indexCount; return *this; } //////////////////////////////////////////////////////////////////////////////// // Fill //////////////////////////////////////////////////////////////////////////////// Loading
libs/hwui/GlopBuilder.h +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ public: GlopBuilder& setMeshTexturedMesh(TextureVertex* vertexData, int elementCount); // TODO: use indexed quads GlopBuilder& setMeshColoredTexturedMesh(ColorTextureVertex* vertexData, int elementCount); // TODO: use indexed quads GlopBuilder& setMeshTexturedIndexedQuads(TextureVertex* vertexData, int elementCount); // TODO: take quadCount GlopBuilder& setMeshPatchQuads(const Patch& patch); GlopBuilder& setFillPaint(const SkPaint& paint, float alphaScale); GlopBuilder& setFillTexturePaint(Texture& texture, int textureFillFlags, Loading
libs/hwui/OpenGLRenderer.cpp +20 −1 Original line number Diff line number Diff line Loading @@ -2326,9 +2326,28 @@ void OpenGLRenderer::drawPatch(const SkBitmap* bitmap, const Patch* mesh, return; } mCaches.textureState().activateTexture(0); Texture* texture = entry ? entry->texture : mCaches.textureCache.get(bitmap); if (!texture) return; if (USE_GLOPS) { // 9 patches are built for stretching - always filter int textureFillFlags = static_cast<int>(TextureFillFlags::kForceFilter); if (bitmap->colorType() == kAlpha_8_SkColorType) { textureFillFlags |= TextureFillFlags::kIsAlphaMaskTexture; } Glop glop; GlopBuilder(mRenderState, mCaches, &glop) .setMeshPatchQuads(*mesh) .setFillTexturePaint(*texture, textureFillFlags, paint, currentSnapshot()->alpha) .setTransform(currentSnapshot()->getOrthoMatrix(), *currentTransform(), false) .setModelViewOffsetRectSnap(left, top, Rect(0, 0, right - left, bottom - top)) // TODO: get minimal bounds from patch .setRoundRectClipState(currentSnapshot()->roundRectClipState) .build(); renderGlop(glop); return; } mCaches.textureState().activateTexture(0); const AutoTexture autoCleanup(texture); texture->setWrap(GL_CLAMP_TO_EDGE, true); Loading