Remove create function in proxyProvider that takes a raster SkImage.
Instead in proxyProvider we just have a create a bitmap call which
does no special fallback or logic. All the callers now go through
GrBitmapTextureMaker which handles and special fallbacks or caching
support that we need.
Change-Id: I71bb896cc78f64f9d6d54b54af2490d48e0f5af5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266842
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index 879a028..65db58d 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -8,6 +8,7 @@
#include "src/gpu/GrSWMaskHelper.h"
#include "include/private/GrRecordingContext.h"
+#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
@@ -97,16 +98,13 @@
SkImageInfo ii = SkImageInfo::MakeA8(fPixels->width(), fPixels->height());
size_t rowBytes = fPixels->rowBytes();
- sk_sp<SkData> data = fPixels->detachPixelsAsData();
- if (!data) {
- return nullptr;
- }
+ SkBitmap bitmap;
+ SkAssertResult(bitmap.installPixels(ii, fPixels->detachPixels(), rowBytes,
+ [](void* addr, void* context) { sk_free(addr); },
+ nullptr));
+ bitmap.setImmutable();
- sk_sp<SkImage> img = SkImage::MakeRasterData(ii, std::move(data), rowBytes);
- if (!img) {
- return nullptr;
- }
-
- return context->priv().proxyProvider()->createTextureProxy(std::move(img), 1, SkBudgeted::kYes,
- fit);
+ GrBitmapTextureMaker maker(context, bitmap, GrBitmapTextureMaker::Cached::kNo, fit);
+ auto [texture, ct] = maker.refTextureProxy(GrMipMapped::kNo);
+ return texture;
}