Rm readPixels from GrSurface & move read/writeSurfacePixels to GrContextPriv (take 3)
This is in service of: https://skia-review.googlesource.com/c/11125/ (Add parallel proxyID to StencilOps & RenderTargetOpList) where I want a better choke point for texture creation to improve discard handling.
This is a re-reland of: https://skia-review.googlesource.com/c/11200/ (Rm readPixels from GrSurface & move read/writeSurfacePixels to GrContextPriv)
Change-Id: Icfb9dd223418dd460405efd2bfd9d1c356beed1a
Reviewed-on: https://skia-review.googlesource.com/11412
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp
index fe67925..95ade04 100644
--- a/tests/ImageFilterCacheTest.cpp
+++ b/tests/ImageFilterCacheTest.cpp
@@ -181,18 +181,6 @@
#include "GrContext.h"
#include "GrResourceProvider.h"
-static GrTexture* create_texture(GrContext* context) {
- SkBitmap srcBM = create_bm();
-
- GrSurfaceDesc desc;
- desc.fConfig = kRGBA_8888_GrPixelConfig;
- desc.fFlags = kNone_GrSurfaceFlags;
- desc.fWidth = kFullSize;
- desc.fHeight = kFullSize;
-
- return context->resourceProvider()->createTexture(desc, SkBudgeted::kNo, srcBM.getPixels(), 0);
-}
-
static sk_sp<GrTextureProxy> create_proxy(GrResourceProvider* resourceProvider) {
SkBitmap srcBM = create_bm();
@@ -208,10 +196,16 @@
srcBM.rowBytes());
}
-
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ctxInfo) {
- sk_sp<GrTexture> srcTexture(create_texture(ctxInfo.grContext()));
- if (!srcTexture) {
+ GrContext* context = ctxInfo.grContext();
+
+ sk_sp<GrTextureProxy> srcProxy(create_proxy(context->resourceProvider()));
+ if (!srcProxy) {
+ return;
+ }
+
+ GrTexture* tex = srcProxy->instantiate(context->resourceProvider());
+ if (!tex) {
return;
}
@@ -222,8 +216,8 @@
backendDesc.fWidth = kFullSize;
backendDesc.fHeight = kFullSize;
backendDesc.fSampleCnt = 0;
- backendDesc.fTextureHandle = srcTexture->getTextureHandle();
- sk_sp<SkImage> srcImage(SkImage::MakeFromTexture(ctxInfo.grContext(),
+ backendDesc.fTextureHandle = tex->getTextureHandle();
+ sk_sp<SkImage> srcImage(SkImage::MakeFromTexture(context,
backendDesc,
kPremul_SkAlphaType));
if (!srcImage) {