summaryrefslogtreecommitdiff
path: root/libs/hwui/pipeline/skia/SkiaPipeline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/pipeline/skia/SkiaPipeline.cpp')
-rw-r--r--libs/hwui/pipeline/skia/SkiaPipeline.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/libs/hwui/pipeline/skia/SkiaPipeline.cpp b/libs/hwui/pipeline/skia/SkiaPipeline.cpp
index 03fa266a5c20..69e603b6c927 100644
--- a/libs/hwui/pipeline/skia/SkiaPipeline.cpp
+++ b/libs/hwui/pipeline/skia/SkiaPipeline.cpp
@@ -46,6 +46,22 @@ void SkiaPipeline::onDestroyHardwareResources() {
// which will flush temporary resources over time.
}
+bool SkiaPipeline::pinImages(std::vector<SkImage*>& mutableImages) {
+ for (SkImage* image : mutableImages) {
+ mPinnedImages.emplace_back(sk_ref_sp(image));
+ // TODO: return false if texture creation fails (see b/32691999)
+ SkImage_pinAsTexture(image, mRenderThread.getGrContext());
+ }
+ return true;
+}
+
+void SkiaPipeline::unpinImages() {
+ for (auto& image : mPinnedImages) {
+ SkImage_unpinAsTexture(image.get(), mRenderThread.getGrContext());
+ }
+ mPinnedImages.clear();
+}
+
void SkiaPipeline::renderLayers(const FrameBuilder::LightGeometry& lightGeometry,
LayerUpdateQueue* layerUpdateQueue, bool opaque,
const BakedOpRenderer::LightInfo& lightInfo) {
@@ -154,9 +170,6 @@ void SkiaPipeline::renderFrame(const LayerUpdateQueue& layers, const SkRect& cli
const std::vector<sp<RenderNode>>& nodes, bool opaque, const Rect &contentDrawBounds,
sk_sp<SkSurface> surface) {
- // unpin all mutable images that were attached to nodes deleted while on the UI thread
- SkiaDisplayList::cleanupImages(surface->getCanvas()->getGrContext());
-
// draw all layers up front
renderLayersImpl(layers, opaque);