Revert "Revert "Remove SkImage deferred texture image data APIs.""
This reverts commit aae533e418f37d788cdb1a1177e882d0f8868b62.
Change-Id: I0434892d8946490a75e17620c49c594eaa18158e
Reviewed-on: https://skia-review.googlesource.com/100603
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/docs/SkImage_Reference.bmh b/docs/SkImage_Reference.bmh
index dc4d4ef..fa08509 100644
--- a/docs/SkImage_Reference.bmh
+++ b/docs/SkImage_Reference.bmh
@@ -2113,33 +2113,6 @@
# ------------------------------------------------------------------------------
-#Struct DeferredTextureImageUsageParams
-#Deprecated soon
-
-Used only by Chrome.
-
-##
-
-#Method size_t getDeferredTextureImageData(const GrContextThreadSafeProxy& contextThreadSafeProxy,
- const DeferredTextureImageUsageParams deferredTextureImageUsageParams[],
- int paramCnt,
- void* buffer,
- SkColorSpace* dstColorSpace = nullptr,
- SkColorType dstColorType = kN32_SkColorType) const
-#Deprecated soon
-
-Used only by Chrome.
-##
-
-#Method static sk_sp<SkImage> MakeFromDeferredTextureImageData(GrContext* context, const void* data,
- SkBudgeted budgeted)
-#Deprecated soon
-
-Used only by Chrome.
-##
-
-# ------------------------------------------------------------------------------
-
#Typedef std::function<void(GrBackendTexture)> BackendTextureReleaseProc
##
@@ -2179,34 +2152,34 @@
#Platform gpu
#Height 64
#Function
-static sk_sp<SkImage> create_gpu_image(GrContext* grContext) {
- const SkImageInfo info = SkImageInfo::MakeN32(20, 20, kOpaque_SkAlphaType);
- auto surface(SkSurface::MakeRenderTarget(grContext, SkBudgeted::kNo, info));
- SkCanvas* canvas = surface->getCanvas();
- canvas->clear(SK_ColorWHITE);
- SkPaint paint;
- paint.setColor(SK_ColorBLACK);
- canvas->drawRect(SkRect::MakeXYWH(5, 5, 10, 10), paint);
- return surface->makeImageSnapshot();
-}
-##
-
-void draw(SkCanvas* canvas) {
- GrContext* grContext = canvas->getGrContext();
- if (!grContext) {
- return;
- }
- sk_sp<SkImage> backEndImage = create_gpu_image(grContext);
- canvas->drawImage(backEndImage, 0, 0);
- GrBackendTexture texture;
- SkImage::BackendTextureReleaseProc proc;
- if (!SkImage::MakeBackendTextureFromSkImage(grContext, std::move(backEndImage),
- &texture, &proc)) {
- return;
- }
- sk_sp<SkImage> i2 = SkImage::MakeFromTexture(grContext, texture, kTopLeft_GrSurfaceOrigin,
- kN32_SkColorType, kOpaque_SkAlphaType, nullptr);
- canvas->drawImage(i2, 30, 30);
+static sk_sp<SkImage> create_gpu_image(GrContext* grContext) {
+ const SkImageInfo info = SkImageInfo::MakeN32(20, 20, kOpaque_SkAlphaType);
+ auto surface(SkSurface::MakeRenderTarget(grContext, SkBudgeted::kNo, info));
+ SkCanvas* canvas = surface->getCanvas();
+ canvas->clear(SK_ColorWHITE);
+ SkPaint paint;
+ paint.setColor(SK_ColorBLACK);
+ canvas->drawRect(SkRect::MakeXYWH(5, 5, 10, 10), paint);
+ return surface->makeImageSnapshot();
+}
+##
+
+void draw(SkCanvas* canvas) {
+ GrContext* grContext = canvas->getGrContext();
+ if (!grContext) {
+ return;
+ }
+ sk_sp<SkImage> backEndImage = create_gpu_image(grContext);
+ canvas->drawImage(backEndImage, 0, 0);
+ GrBackendTexture texture;
+ SkImage::BackendTextureReleaseProc proc;
+ if (!SkImage::MakeBackendTextureFromSkImage(grContext, std::move(backEndImage),
+ &texture, &proc)) {
+ return;
+ }
+ sk_sp<SkImage> i2 = SkImage::MakeFromTexture(grContext, texture, kTopLeft_GrSurfaceOrigin,
+ kN32_SkColorType, kOpaque_SkAlphaType, nullptr);
+ canvas->drawImage(i2, 30, 30);
}
##
@@ -2248,20 +2221,20 @@
#Example
#Image 4
#Platform gpu
- SkBitmap bitImage;
- if (image->asLegacyBitmap(&bitImage, SkImage::kRO_LegacyBitmapMode)) {
- canvas->drawBitmap(bitImage, 0, 0);
- }
- GrContext* grContext = canvas->getGrContext();
- if (!grContext) {
- return;
- }
- sk_sp<SkImage> textureImage(SkImage::MakeFromTexture(grContext, backEndTexture,
- kTopLeft_GrSurfaceOrigin, kOpaque_SkAlphaType, nullptr));
- canvas->drawImage(textureImage, 45, 45);
- if (textureImage->asLegacyBitmap(&bitImage, SkImage::kRO_LegacyBitmapMode)) {
- canvas->drawBitmap(bitImage, 90, 90);
- }
+ SkBitmap bitImage;
+ if (image->asLegacyBitmap(&bitImage, SkImage::kRO_LegacyBitmapMode)) {
+ canvas->drawBitmap(bitImage, 0, 0);
+ }
+ GrContext* grContext = canvas->getGrContext();
+ if (!grContext) {
+ return;
+ }
+ sk_sp<SkImage> textureImage(SkImage::MakeFromTexture(grContext, backEndTexture,
+ kTopLeft_GrSurfaceOrigin, kOpaque_SkAlphaType, nullptr));
+ canvas->drawImage(textureImage, 45, 45);
+ if (textureImage->asLegacyBitmap(&bitImage, SkImage::kRO_LegacyBitmapMode)) {
+ canvas->drawBitmap(bitImage, 90, 90);
+ }
##
#SeeAlso MakeRasterData makeRasterImage makeNonTextureImage