summaryrefslogtreecommitdiff
path: root/libs/hwui/OpenGLRenderer.cpp
diff options
context:
space:
mode:
author Chris Craik <ccraik@google.com> 2015-03-03 09:54:14 -0800
committer Chris Craik <ccraik@google.com> 2015-03-03 09:54:14 -0800
commit0556d90253902ae797e4fcea79602a30ff16f82c (patch)
treeab516c46f81b1ae35a6803435197704e396f304f /libs/hwui/OpenGLRenderer.cpp
parenta6b52198b9e73a4b7f80103116feeace74433246 (diff)
Glop DrawPatch support
Change-Id: Icaa78bdb2cf52c1fc2194ec4016634967d17fb6a
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index d7f871cdee7c..eef4b7357219 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -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);