summaryrefslogtreecommitdiff
path: root/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2017-12-04 15:07:08 -0500
committerDerek Sollenberger <djsollen@google.com>2017-12-05 10:41:07 -0500
commit03e6cff7a6b20d68babc0b90b15112561360f17f (patch)
tree4bd11bb0f0d23c50d21c4139b70f5978615388b8 /libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
parentca1265e26fcfaae53e0f4dd9d3aa0023158305dc (diff)
Allocate textures in multiples of LAYER_SIZE.
This matches the behavior of the old HWUI renderer and avoids jank when trying to release a series of small textures. Test: UiBenchJankTests #testResizeHwLayer Bug: 69566781 Change-Id: Idc01f8438e85d4810032fd30a141132a6cdd47a1
Diffstat (limited to 'libs/hwui/pipeline/skia/RenderNodeDrawable.cpp')
-rw-r--r--libs/hwui/pipeline/skia/RenderNodeDrawable.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
index 845acc0fc0b2..e2f02df62b30 100644
--- a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
+++ b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
@@ -205,7 +205,13 @@ void RenderNodeDrawable::drawContent(SkCanvas* canvas) const {
if (layerNeedsPaint(layerProperties, alphaMultiplier, &tmpPaint)) {
paint = &tmpPaint;
}
- renderNode->getLayerSurface()->draw(canvas, 0, 0, paint);
+
+ // surfaces for layers are created on LAYER_SIZE boundaries (which are >= layer size) so
+ // we need to restrict the portion of the surface drawn to the size of the renderNode.
+ SkASSERT(renderNode->getLayerSurface()->width() >= bounds.width());
+ SkASSERT(renderNode->getLayerSurface()->height() >= bounds.height());
+ canvas->drawImageRect(renderNode->getLayerSurface()->makeImageSnapshot().get(),
+ bounds, bounds, paint);
if (!renderNode->getSkiaLayer()->hasRenderedSinceRepaint) {
renderNode->getSkiaLayer()->hasRenderedSinceRepaint = true;