diff options
author | Leon Scroggins III <scroggo@google.com> | 2018-03-26 15:00:49 -0400 |
---|---|---|
committer | Stan Iliev <stani@google.com> | 2018-03-29 19:30:28 +0000 |
commit | 1a12ab26d419bad8e5c3c121d98114199e05f47c (patch) | |
tree | 44ae7781ac684a360d9e85d482b336036e89ec3e /libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp | |
parent | 407932ebc0fab40dccd7298f179639b8b9f93460 (diff) |
Fix Skia's impl for TextureView.getBitmap
Bug: 73392905
Test: New test added with I2d4ef440f943a50b9367976ba1444f4350071bfd
When providing a width and height, getBitmap should scale to the
destination. Add a parameter to LayerDrawable::DrawLayer for a
destination rectangle to scale to. Pass the size of the bitmap in
SkiaOpenGLPipeline::copyLayerInto down to DrawLayer. The only other
caller of DrawLayer is unaffected.
Change-Id: I7aa192181c2d15bc8fd4de2fb15c4d276b05d2ac
Diffstat (limited to 'libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp')
-rw-r--r-- | libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp b/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp index 365d7403e046..74cfb2854e62 100644 --- a/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp +++ b/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp @@ -138,7 +138,9 @@ bool SkiaOpenGLPipeline::copyLayerInto(DeferredLayerUpdater* deferredLayer, SkBi SkBudgeted::kYes, bitmap->info()); Layer* layer = deferredLayer->backingLayer(); - if (LayerDrawable::DrawLayer(mRenderThread.getGrContext(), tmpSurface->getCanvas(), layer)) { + const SkRect dstRect = SkRect::MakeIWH(bitmap->width(), bitmap->height()); + if (LayerDrawable::DrawLayer(mRenderThread.getGrContext(), tmpSurface->getCanvas(), layer, + &dstRect)) { sk_sp<SkImage> tmpImage = tmpSurface->makeImageSnapshot(); if (tmpImage->readPixels(bitmap->info(), bitmap->getPixels(), bitmap->rowBytes(), 0, 0)) { bitmap->notifyPixelsChanged(); |