Move Budgeted enum out of SkSurface, use in GrTextureProvider
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1728093005
DOCS_PREVIEW= https://skia.org/?cl=1728093005
Committed: https://skia.googlesource.com/skia/+/57599fe6c0336feaeeeb9b1996e77b70219b483c
CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac-Clang-x86_64-Release-CMake-Trybot
Review URL: https://codereview.chromium.org/1728093005
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index c502fc0..e28a31d 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -20,7 +20,7 @@
#include "SkPixelRef.h"
SkImage_Gpu::SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType at, GrTexture* tex,
- SkSurface::Budgeted budgeted)
+ SkBudgeted budgeted)
: INHERITED(w, h, uniqueID)
, fTexture(SkRef(tex))
, fAlphaType(at)
@@ -140,8 +140,7 @@
desc.fWidth = subset.width();
desc.fHeight = subset.height();
- GrTexture* subTx = ctx->textureProvider()->createTexture(desc,
- SkSurface::kYes_Budgeted == fBudgeted);
+ GrTexture* subTx = ctx->textureProvider()->createTexture(desc, fBudgeted);
if (!subTx) {
return nullptr;
}
@@ -167,7 +166,7 @@
tex->setRelease(releaseProc, releaseCtx);
}
- const SkSurface::Budgeted budgeted = SkSurface::kNo_Budgeted;
+ const SkBudgeted budgeted = SkBudgeted::kNo;
return new SkImage_Gpu(desc.fWidth, desc.fHeight, kNeedNewImageUniqueID, at, tex, budgeted);
}
@@ -193,22 +192,20 @@
return nullptr;
}
- const bool isBudgeted = true;
- SkAutoTUnref<GrTexture> dst(GrDeepCopyTexture(src, isBudgeted));
+ SkAutoTUnref<GrTexture> dst(GrDeepCopyTexture(src, SkBudgeted::kYes));
if (!dst) {
return nullptr;
}
- const SkSurface::Budgeted budgeted = SkSurface::kYes_Budgeted;
return new SkImage_Gpu(desc.fWidth, desc.fHeight, kNeedNewImageUniqueID, at, dst,
- budgeted);
+ SkBudgeted::kYes);
}
SkImage* SkImage::NewFromYUVTexturesCopy(GrContext* ctx , SkYUVColorSpace colorSpace,
const GrBackendObject yuvTextureHandles[3],
const SkISize yuvSizes[3],
GrSurfaceOrigin origin) {
- const SkSurface::Budgeted budgeted = SkSurface::kYes_Budgeted;
+ const SkBudgeted budgeted = SkBudgeted::kYes;
if (yuvSizes[0].fWidth <= 0 || yuvSizes[0].fHeight <= 0 ||
yuvSizes[1].fWidth <= 0 || yuvSizes[1].fHeight <= 0 ||
@@ -259,7 +256,7 @@
dstDesc.fConfig = kRGBA_8888_GrPixelConfig;
dstDesc.fSampleCnt = 0;
- SkAutoTUnref<GrTexture> dst(ctx->textureProvider()->createTexture(dstDesc, true));
+ SkAutoTUnref<GrTexture> dst(ctx->textureProvider()->createTexture(dstDesc, SkBudgeted::kYes));
if (!dst) {
return nullptr;
}
@@ -288,7 +285,7 @@
return nullptr;
}
return new SkImage_Gpu(texture->width(), texture->height(), id, at, texture,
- SkSurface::kNo_Budgeted);
+ SkBudgeted::kNo);
}
SkImage* SkImage::newTextureImage(GrContext *context) const {
@@ -315,7 +312,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
-GrTexture* GrDeepCopyTexture(GrTexture* src, bool budgeted) {
+GrTexture* GrDeepCopyTexture(GrTexture* src, SkBudgeted budgeted) {
GrContext* ctx = src->getContext();
GrSurfaceDesc desc = src->desc();