Add GrMakeCachedBitmapProxy
This is split out of https://skia-review.googlesource.com/c/7889/ (Remove SkSpecialImage's GrTexture-based ctors) to allow focusing on the caching/subsetting changes.
Change-Id: Ic2af7a0d03e88941ab5b6cdfcecbbdefe3578eda
Reviewed-on: https://skia-review.googlesource.com/8456
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/SkGrPriv.h b/src/gpu/SkGrPriv.h
index 5437d4a..7f52ee8 100644
--- a/src/gpu/SkGrPriv.h
+++ b/src/gpu/SkGrPriv.h
@@ -9,6 +9,7 @@
#define SkGrPriv_DEFINED
#include "GrBlend.h"
+#include "GrSamplerParams.h"
#include "GrTypes.h"
#include "SkCanvas.h"
#include "SkImageInfo.h"
@@ -22,6 +23,7 @@
class GrFragmentProcessor;
class GrPaint;
class GrTexture;
+class GrTextureProxy;
class GrUniqueKey;
class SkBitmap;
class SkData;
@@ -178,6 +180,22 @@
GrTexture* GrUploadMipMapToTexture(GrContext*, const SkImageInfo&, const GrMipLevel* texels,
int mipLevelCount);
+sk_sp<GrTexture> GrMakeCachedBitmapTexture(GrContext*, const SkBitmap&,
+ const GrSamplerParams&, SkScalar scaleAdjust[2]);
+
+// This is intended to replace:
+// SkAutoLockPixels alp(bitmap, true);
+// if (!bitmap.readyToDraw()) {
+// return nullptr;
+// }
+// sk_sp<GrTexture> texture = GrMakeCachedBitmapTexture(fContext.get(), bitmap,
+// GrSamplerParams::ClampNoFilter(),
+// nullptr);
+// if (!texture) {
+// return nullptr;
+// }
+sk_sp<GrTextureProxy> GrMakeCachedBitmapProxy(GrContext* context, const SkBitmap& bitmap);
+
//////////////////////////////////////////////////////////////////////////////
GR_STATIC_ASSERT((int)kZero_GrBlendCoeff == (int)SkXfermode::kZero_Coeff);