Update GrSurface/RenderTargetContexts to take and store GrSurfaceProxyViews.
Bug: skia:9556
Change-Id: Ie1aed1b16c237e9c9d1b582ac4ff02fdaaad238f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263205
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/text/GrAtlasManager.cpp b/src/gpu/text/GrAtlasManager.cpp
index 0beb3d3..978ac45 100644
--- a/src/gpu/text/GrAtlasManager.cpp
+++ b/src/gpu/text/GrAtlasManager.cpp
@@ -83,20 +83,21 @@
* Write the contents of the surface proxy to a PNG. Returns true if successful.
* @param filename Full path to desired file
*/
-static bool save_pixels(GrContext* context, GrSurfaceProxy* sProxy, GrColorType colorType,
+static bool save_pixels(GrContext* context, GrSurfaceProxyView view, GrColorType colorType,
const char* filename) {
- if (!sProxy) {
+ if (!view.proxy()) {
return false;
}
SkImageInfo ii =
- SkImageInfo::Make(sProxy->dimensions(), kRGBA_8888_SkColorType, kPremul_SkAlphaType);
+ SkImageInfo::Make(view.proxy()->dimensions(), kRGBA_8888_SkColorType,
+ kPremul_SkAlphaType);
SkBitmap bm;
if (!bm.tryAllocPixels(ii)) {
return false;
}
- auto sContext = GrSurfaceContext::Make(context, sk_ref_sp(sProxy), colorType,
+ auto sContext = GrSurfaceContext::Make(context, std::move(view), colorType,
kUnknown_SkAlphaType, nullptr);
if (!sContext || !sContext->asTextureProxy()) {
return false;
@@ -141,7 +142,7 @@
filename.printf("fontcache_%d%d%d.png", gDumpCount, i, pageIdx);
#endif
auto ct = mask_format_to_gr_color_type(AtlasIndexToMaskFormat(i));
- save_pixels(context, views[pageIdx].proxy(), ct, filename.c_str());
+ save_pixels(context, views[pageIdx], ct, filename.c_str());
}
}
}