summaryrefslogtreecommitdiffstats
path: root/libs/hwui/OpenGLRenderer.cpp
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2015-02-26 16:28:17 -0800
committerChris Craik <ccraik@google.com>2015-02-27 10:50:12 -0800
commit26bf34200e40a0fa8c66366559aa016380cd8c6f (patch)
tree40603e6acbcd9f1d3a3b6f0c0a84314e70ca6f94 /libs/hwui/OpenGLRenderer.cpp
parentb11be294b1e721c08f3756626edfedea35711eb2 (diff)
downloadframeworks_base-26bf34200e40a0fa8c66366559aa016380cd8c6f.zip
frameworks_base-26bf34200e40a0fa8c66366559aa016380cd8c6f.tar.gz
frameworks_base-26bf34200e40a0fa8c66366559aa016380cd8c6f.tar.bz2
Glop TextureLayer support
Change-Id: I348a926bd4a2f47be9fdbe74058c0aa2f8dc6276
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 3913ee5..83715ba 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -846,8 +846,21 @@ void OpenGLRenderer::composeLayer(const Snapshot& removed, const Snapshot& resto
}
void OpenGLRenderer::drawTextureLayer(Layer* layer, const Rect& rect) {
- float alpha = getLayerAlpha(layer);
+ if (USE_GLOPS) {
+ bool snap = !layer->getForceFilter()
+ && layer->getWidth() == (uint32_t) rect.getWidth()
+ && layer->getHeight() == (uint32_t) rect.getHeight();
+ Glop glop;
+ GlopBuilder aBuilder(mRenderState, mCaches, &glop);
+ aBuilder.setMeshTexturedUvQuad(nullptr, Rect(0, 1, 1, 0)) // TODO: simplify with VBO
+ .setFillTextureLayer(*layer, getLayerAlpha(layer))
+ .setTransform(currentSnapshot()->getOrthoMatrix(), *currentTransform(), false)
+ .setModelViewMapUnitToRectOptionalSnap(snap, rect)
+ .setRoundRectClipState(currentSnapshot()->roundRectClipState)
+ .build();
+ }
+ float alpha = getLayerAlpha(layer);
setupDraw();
if (layer->getRenderTarget() == GL_TEXTURE_2D) {
setupDrawWithTexture();
@@ -866,10 +879,10 @@ void OpenGLRenderer::drawTextureLayer(Layer* layer, const Rect& rect) {
} else {
setupDrawExternalTexture(layer->getTextureId());
}
- if (currentTransform()->isPureTranslate() &&
- !layer->getForceFilter() &&
- layer->getWidth() == (uint32_t) rect.getWidth() &&
- layer->getHeight() == (uint32_t) rect.getHeight()) {
+ if (currentTransform()->isPureTranslate()
+ && !layer->getForceFilter()
+ && layer->getWidth() == (uint32_t) rect.getWidth()
+ && layer->getHeight() == (uint32_t) rect.getHeight()) {
const float x = (int) floorf(rect.left + currentTransform()->getTranslateX() + 0.5f);
const float y = (int) floorf(rect.top + currentTransform()->getTranslateY() + 0.5f);