Revert of Move Budgeted enum out of SkSurface, use in GrTextureProvider (patchset #6 id:100001 of https://codereview.chromium.org/1728093005/ )
Reason for revert:
Need workaround for chrome to build
Original issue's description:
> 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
TBR=reed@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1734043002
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index 5793284..70998bd 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -667,7 +667,7 @@
const void* srcData = (kSkia8888_GrPixelConfig == desc.fConfig) ? kData : swizData;
SkAutoTUnref<GrTexture> texture(
- ctx->textureProvider()->createTexture(desc, SkBudgeted::kNo, srcData, 0));
+ ctx->textureProvider()->createTexture(desc, false, srcData, 0));
if (!texture) {
continue;
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp
index 30f218a..9806611 100644
--- a/tests/BlurTest.cpp
+++ b/tests/BlurTest.cpp
@@ -565,7 +565,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SmallBoxBlurBug, reporter, ctx) {
SkImageInfo info = SkImageInfo::MakeN32Premul(128, 128);
- SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, SkBudgeted::kNo, info));
+ SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, SkSurface::kNo_Budgeted, info));
SkCanvas* canvas = surface->getCanvas();
SkRect r = SkRect::MakeXYWH(10, 10, 100, 100);
diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp
index df15208..a36c439 100644
--- a/tests/ClearTest.cpp
+++ b/tests/ClearTest.cpp
@@ -55,7 +55,7 @@
desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- rtKeepAlive->reset(context->textureProvider()->createTexture(desc, SkBudgeted::kYes));
+ rtKeepAlive->reset(context->textureProvider()->createTexture(desc, true));
if (!(*rtKeepAlive)) {
return false;
}
diff --git a/tests/ClipBoundsTest.cpp b/tests/ClipBoundsTest.cpp
index b5b9cae..c59d5a5 100644
--- a/tests/ClipBoundsTest.cpp
+++ b/tests/ClipBoundsTest.cpp
@@ -25,7 +25,7 @@
desc.fHeight = kYSize;
SkAutoTUnref<GrTexture> texture(
- context->textureProvider()->createTexture(desc, SkBudgeted::kYes, nullptr, 0));
+ context->textureProvider()->createTexture(desc, false, nullptr, 0));
if (!texture) {
return;
}
diff --git a/tests/CopySurfaceTest.cpp b/tests/CopySurfaceTest.cpp
index 3740f6e..4b64537 100644
--- a/tests/CopySurfaceTest.cpp
+++ b/tests/CopySurfaceTest.cpp
@@ -68,11 +68,11 @@
dstDesc.fFlags = dFlags;
SkAutoTUnref<GrTexture> src(
- context->textureProvider()->createTexture(srcDesc, SkBudgeted::kNo,
+ context->textureProvider()->createTexture(srcDesc, false,
srcPixels.get(),
kRowBytes));
SkAutoTUnref<GrTexture> dst(
- context->textureProvider()->createTexture(dstDesc, SkBudgeted::kNo,
+ context->textureProvider()->createTexture(dstDesc, false,
dstPixels.get(),
kRowBytes));
if (!src || !dst) {
diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp
index 637055b..fdae3b3 100644
--- a/tests/EGLImageTest.cpp
+++ b/tests/EGLImageTest.cpp
@@ -73,8 +73,7 @@
copyDesc.fWidth = externalTexture->width();
copyDesc.fHeight = externalTexture->height();
copyDesc.fFlags = kRenderTarget_GrSurfaceFlag;
- SkAutoTUnref<GrTexture> copy(context->textureProvider()->createTexture(
- copyDesc, SkBudgeted::kYes));
+ SkAutoTUnref<GrTexture> copy(context->textureProvider()->createTexture(copyDesc, true));
context->copySurface(copy, externalTexture);
test_read_pixels(reporter, context, copy, expectedPixelValues);
}
diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp
index 3a8d63c..04f73c7 100644
--- a/tests/FloatingPointTextureTest.cpp
+++ b/tests/FloatingPointTextureTest.cpp
@@ -46,7 +46,7 @@
desc.fOrigin = 0 == origin ?
kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin;
SkAutoTUnref<GrTexture> fpTexture(context->textureProvider()->createTexture(
- desc, SkBudgeted::kNo, controlPixelData.begin(), 0));
+ desc, false, controlPixelData.begin(), 0));
// Floating point textures are NOT supported everywhere
if (nullptr == fpTexture) {
continue;
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 7440608..81d1013 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -170,7 +170,7 @@
GrTexture* texture = textureProvider->findAndRefTextureByUniqueKey(key);
if (!texture) {
- texture = textureProvider->createTexture(texDesc, SkBudgeted::kYes);
+ texture = textureProvider->createTexture(texDesc, true);
if (texture) {
textureProvider->assignUniqueKeyToTexture(key, texture);
}
@@ -310,13 +310,13 @@
dummyDesc.fWidth = 34;
dummyDesc.fHeight = 18;
SkAutoTUnref<GrTexture> dummyTexture1(
- context->textureProvider()->createTexture(dummyDesc, SkBudgeted::kNo, nullptr, 0));
+ context->textureProvider()->createTexture(dummyDesc, false, nullptr, 0));
dummyDesc.fFlags = kNone_GrSurfaceFlags;
dummyDesc.fConfig = kAlpha_8_GrPixelConfig;
dummyDesc.fWidth = 16;
dummyDesc.fHeight = 22;
SkAutoTUnref<GrTexture> dummyTexture2(
- context->textureProvider()->createTexture(dummyDesc, SkBudgeted::kNo, nullptr, 0));
+ context->textureProvider()->createTexture(dummyDesc, false, nullptr, 0));
if (!dummyTexture1 || ! dummyTexture2) {
SkDebugf("Could not allocate dummy textures");
@@ -373,7 +373,7 @@
rtDesc.fFlags = kRenderTarget_GrSurfaceFlag;
rtDesc.fConfig = kRGBA_8888_GrPixelConfig;
SkAutoTUnref<GrRenderTarget> rt(
- context->textureProvider()->createTexture(rtDesc, SkBudgeted::kNo)->asRenderTarget());
+ context->textureProvider()->createTexture(rtDesc, false)->asRenderTarget());
int fpFactoryCnt = GrProcessorTestFactory<GrFragmentProcessor>::Count();
for (int i = 0; i < fpFactoryCnt; ++i) {
// Since FP factories internally randomize, call each 10 times.
diff --git a/tests/GpuDrawPathTest.cpp b/tests/GpuDrawPathTest.cpp
index d454d9b..b0d483b 100644
--- a/tests/GpuDrawPathTest.cpp
+++ b/tests/GpuDrawPathTest.cpp
@@ -82,7 +82,7 @@
for (auto& sampleCount : {0, 4, 16}) {
SkImageInfo info = SkImageInfo::MakeN32Premul(255, 255);
SkAutoTUnref<SkSurface> surface(
- SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info,
+ SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info,
sampleCount, nullptr));
if (!surface) {
continue;
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index ac0b399..4b7dbd3 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -25,8 +25,7 @@
desc.fWidth = 256;
desc.fHeight = 256;
desc.fSampleCnt = 0;
- GrSurface* texRT1 = context->textureProvider()->createTexture(
- desc, SkBudgeted::kNo, nullptr, 0);
+ GrSurface* texRT1 = context->textureProvider()->createTexture(desc, false, nullptr, 0);
REPORTER_ASSERT(reporter, texRT1 == texRT1->asRenderTarget());
REPORTER_ASSERT(reporter, texRT1 == texRT1->asTexture());
@@ -38,7 +37,7 @@
static_cast<GrSurface*>(texRT1->asTexture()));
desc.fFlags = kNone_GrSurfaceFlags;
- GrSurface* tex1 = context->textureProvider()->createTexture(desc, SkBudgeted::kNo, nullptr, 0);
+ GrSurface* tex1 = context->textureProvider()->createTexture(desc, false, nullptr, 0);
REPORTER_ASSERT(reporter, nullptr == tex1->asRenderTarget());
REPORTER_ASSERT(reporter, tex1 == tex1->asTexture());
REPORTER_ASSERT(reporter, static_cast<GrSurface*>(tex1) == tex1->asTexture());
diff --git a/tests/GrTextureMipMapInvalidationTest.cpp b/tests/GrTextureMipMapInvalidationTest.cpp
index b047550..e0a1282 100644
--- a/tests/GrTextureMipMapInvalidationTest.cpp
+++ b/tests/GrTextureMipMapInvalidationTest.cpp
@@ -26,10 +26,8 @@
desc.fWidth = 256;
desc.fHeight = 256;
desc.fSampleCnt = 0;
- GrSurface* texRT1 = context->textureProvider()->createTexture(
- desc, SkBudgeted::kNo, nullptr, 0);
- GrSurface* texRT2 = context->textureProvider()->createTexture(
- desc, SkBudgeted::kNo, nullptr, 0);
+ GrSurface* texRT1 = context->textureProvider()->createTexture(desc, false, nullptr, 0);
+ GrSurface* texRT2 = context->textureProvider()->createTexture(desc, false, nullptr, 0);
REPORTER_ASSERT(reporter, nullptr != texRT1);
REPORTER_ASSERT(reporter, nullptr != texRT2);
GrTexture* tex = texRT1->asTexture();
diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp
index 3494011..74c56df 100644
--- a/tests/ImageFilterCacheTest.cpp
+++ b/tests/ImageFilterCacheTest.cpp
@@ -184,7 +184,7 @@
desc.fWidth = kFullSize;
desc.fHeight = kFullSize;
- return context->textureProvider()->createTexture(desc, SkBudgeted::kNo, srcBM.getPixels(), 0);
+ return context->textureProvider()->createTexture(desc, false, srcBM.getPixels(), 0);
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, context) {
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 89c069c..60480ec 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -1329,7 +1329,7 @@
const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context,
- SkBudgeted::kNo,
+ SkSurface::kNo_Budgeted,
SkImageInfo::MakeN32Premul(100, 100),
0,
&props,
@@ -1343,7 +1343,7 @@
const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context,
- SkBudgeted::kNo,
+ SkSurface::kNo_Budgeted,
SkImageInfo::MakeN32Premul(100, 100),
0,
&props,
@@ -1357,7 +1357,7 @@
const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context,
- SkBudgeted::kNo,
+ SkSurface::kNo_Budgeted,
SkImageInfo::MakeN32Premul(1, 1),
0,
&props,
@@ -1371,7 +1371,7 @@
const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context,
- SkBudgeted::kNo,
+ SkSurface::kNo_Budgeted,
SkImageInfo::MakeN32Premul(1, 1),
0,
&props,
@@ -1383,7 +1383,7 @@
DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) {
SkAutoTUnref<SkSurface> surface(
- SkSurface::NewRenderTarget(context, SkBudgeted::kYes,
+ SkSurface::NewRenderTarget(context, SkSurface::kYes_Budgeted,
SkImageInfo::MakeN32Premul(100, 100)));
test_large_blur_input(reporter, surface->getCanvas());
}
diff --git a/tests/ImageIsOpaqueTest.cpp b/tests/ImageIsOpaqueTest.cpp
index 739af2b..5d7003f 100644
--- a/tests/ImageIsOpaqueTest.cpp
+++ b/tests/ImageIsOpaqueTest.cpp
@@ -68,12 +68,12 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageIsOpaqueTest_Gpu, reporter, context) {
SkImageInfo infoTransparent = SkImageInfo::MakeN32Premul(5, 5);
SkAutoTUnref<SkSurface> surfaceTransparent(
- SkSurface::NewRenderTarget(context, SkBudgeted::kNo, infoTransparent));
+ SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, infoTransparent));
check_isopaque(reporter, surfaceTransparent, false);
SkImageInfo infoOpaque = SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType);
SkAutoTUnref<SkSurface> surfaceOpaque(
- SkSurface::NewRenderTarget(context,SkBudgeted::kNo, infoOpaque));
+ SkSurface::NewRenderTarget(context,SkSurface::kNo_Budgeted, infoOpaque));
check_isopaque(reporter, surfaceOpaque, true);
}
diff --git a/tests/ImageNewShaderTest.cpp b/tests/ImageNewShaderTest.cpp
index 7b7d80e..2c25b90 100644
--- a/tests/ImageNewShaderTest.cpp
+++ b/tests/ImageNewShaderTest.cpp
@@ -116,9 +116,9 @@
SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5);
SkAutoTUnref<SkSurface> sourceSurface(
- SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info));
+ SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info));
SkAutoTUnref<SkSurface> destinationSurface(
- SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info));
+ SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info));
runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info);
}
@@ -127,7 +127,7 @@
SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5);
SkAutoTUnref<SkSurface> sourceSurface(SkSurface::NewRenderTarget(context,
- SkBudgeted::kNo, info));
+ SkSurface::kNo_Budgeted, info));
SkAutoTUnref<SkSurface> destinationSurface(SkSurface::NewRaster(info));
runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info);
@@ -138,7 +138,7 @@
SkAutoTUnref<SkSurface> sourceSurface(SkSurface::NewRaster(info));
SkAutoTUnref<SkSurface> destinationSurface(SkSurface::NewRenderTarget(context,
- SkBudgeted::kNo, info));
+ SkSurface::kNo_Budgeted, info));
runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info);
}
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 2ec1f34..1bf56c5 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -124,7 +124,7 @@
#if SK_SUPPORT_GPU
static SkImage* create_gpu_image(GrContext* context) {
const SkImageInfo info = SkImageInfo::MakeN32(20, 20, kOpaque_SkAlphaType);
- SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(context, SkBudgeted::kNo,
+ SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted,
info));
draw_image_test_pattern(surface->getCanvas());
return surface->newImageSnapshot();
@@ -696,7 +696,7 @@
desc.fHeight = h;
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fSampleCnt = 0;
- SkAutoTUnref<GrTexture> tex(provider->createTexture(desc, SkBudgeted::kNo, storage, w * 4));
+ SkAutoTUnref<GrTexture> tex(provider->createTexture(desc, false, storage, w * 4));
if (!tex) {
REPORTER_ASSERT(reporter, false);
return;
diff --git a/tests/PremulAlphaRoundTripTest.cpp b/tests/PremulAlphaRoundTripTest.cpp
index e0060d6..7f94485 100644
--- a/tests/PremulAlphaRoundTripTest.cpp
+++ b/tests/PremulAlphaRoundTripTest.cpp
@@ -109,7 +109,7 @@
const SkImageInfo info = SkImageInfo::MakeN32Premul(256, 256);
SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkAutoTUnref<SkBaseDevice> device(
- SkGpuDevice::Create(context, SkBudgeted::kNo, info, 0, &props,
+ SkGpuDevice::Create(context, SkSurface::kNo_Budgeted, info, 0, &props,
SkGpuDevice::kUninit_InitContents));
test_premul_alpha_roundtrip(reporter, device);
}
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index b87d2b8..00cb12d 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -396,7 +396,7 @@
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fOrigin = origin;
SkAutoTUnref<GrTexture> surfaceTexture(
- context->textureProvider()->createTexture(desc, SkBudgeted::kNo));
+ context->textureProvider()->createTexture(desc, false));
SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect(surfaceTexture->asRenderTarget()));
desc.fFlags = kNone_GrSurfaceFlags;
test_readpixels(reporter, surface, kLast_BitmapInit);
@@ -452,7 +452,7 @@
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fOrigin = origin;
desc.fFlags = kNone_GrSurfaceFlags;
- texture.reset(context->textureProvider()->createTexture(desc, SkBudgeted::kNo));
+ texture.reset(context->textureProvider()->createTexture(desc, false));
test_readpixels_texture(reporter, texture);
}
}
@@ -603,8 +603,8 @@
// do they draw the same?
const SkImageInfo info = SkImageInfo::MakeN32Premul(128, 128);
- SkAutoTUnref<SkSurface> surfA(SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info, 0));
- SkAutoTUnref<SkSurface> surfB(SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info, 0));
+ SkAutoTUnref<SkSurface> surfA(SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info, 0));
+ SkAutoTUnref<SkSurface> surfB(SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info, 0));
if (false) {
//
diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp
index 1be775f..d1c2f8c 100644
--- a/tests/ReadWriteAlphaTest.cpp
+++ b/tests/ReadWriteAlphaTest.cpp
@@ -50,7 +50,7 @@
// We are initializing the texture with zeros here
memset(alphaData, 0, X_SIZE * Y_SIZE);
SkAutoTUnref<GrTexture> texture(
- context->textureProvider()->createTexture(desc, SkBudgeted::kNo , alphaData, 0));
+ context->textureProvider()->createTexture(desc, false, alphaData, 0));
if (!texture) {
if (!rt) {
ERRORF(reporter, "Could not create alpha texture.");
@@ -150,7 +150,7 @@
}
}
SkAutoTUnref<GrTexture> texture(
- context->textureProvider()->createTexture(desc, SkBudgeted::kNo, rgbaData, 0));
+ context->textureProvider()->createTexture(desc, false, rgbaData, 0));
if (!texture) {
// We always expect to be able to create a RGBA texture
if (!rt && kRGBA_8888_GrPixelConfig == desc.fConfig) {
diff --git a/tests/RecordReplaceDrawTest.cpp b/tests/RecordReplaceDrawTest.cpp
index 216f1ca..fe8f347 100644
--- a/tests/RecordReplaceDrawTest.cpp
+++ b/tests/RecordReplaceDrawTest.cpp
@@ -124,8 +124,7 @@
desc.fHeight = kHeight;
desc.fSampleCnt = 0;
- texture.reset(context->textureProvider()->createTexture(
- desc, SkBudgeted::kNo, nullptr, 0));
+ texture.reset(context->textureProvider()->createTexture(desc, false, nullptr, 0));
layer->setTexture(texture, SkIRect::MakeWH(kWidth, kHeight), false);
}
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index 2943c25..168a573 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -58,8 +58,7 @@
copyDstDesc.fWidth = rectangleTexture->width();
copyDstDesc.fHeight = rectangleTexture->height();
copyDstDesc.fFlags = kRenderTarget_GrSurfaceFlag;
- SkAutoTUnref<GrTexture> dst(context->textureProvider()->createTexture(
- copyDstDesc, SkBudgeted::kYes));
+ SkAutoTUnref<GrTexture> dst(context->textureProvider()->createTexture(copyDstDesc, true));
context->copySurface(dst, rectangleTexture);
test_read_pixels(reporter, context, dst, expectedPixelValues);
}
@@ -79,8 +78,8 @@
copySrcDesc.fWidth = rectangleTexture->width();
copySrcDesc.fHeight = rectangleTexture->height();
copySrcDesc.fFlags = kRenderTarget_GrSurfaceFlag;
- SkAutoTUnref<GrTexture> src(context->textureProvider()->createTexture(
- copySrcDesc, SkBudgeted::kYes, pixels.get(), 0));
+ SkAutoTUnref<GrTexture> src(context->textureProvider()->createTexture(copySrcDesc, true,
+ pixels.get(), 0));
context->copySurface(rectangleTexture, src);
test_read_pixels(reporter, context, rectangleTexture, pixels.get());
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index c715b2e..c8613ad 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -38,7 +38,7 @@
desc.fHeight = gHeight;
SkImageInfo info = SkImageInfo::MakeN32Premul(gWidth, gHeight);
SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(context,
- SkBudgeted::kNo, info));
+ SkSurface::kNo_Budgeted, info));
SkCanvas* canvas = surface->getCanvas();
const SkIRect size = SkIRect::MakeWH(gWidth, gHeight);
@@ -91,12 +91,12 @@
GrTextureProvider* cache = context->textureProvider();
GrResourceProvider* resourceProvider = context->resourceProvider();
// Test that two budgeted RTs with the same desc share a stencil buffer.
- SkAutoTUnref<GrTexture> smallRT0(cache->createTexture(smallDesc, SkBudgeted::kYes));
+ SkAutoTUnref<GrTexture> smallRT0(cache->createTexture(smallDesc, true));
if (smallRT0 && smallRT0->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallRT0->asRenderTarget());
}
- SkAutoTUnref<GrTexture> smallRT1(cache->createTexture(smallDesc, SkBudgeted::kYes));
+ SkAutoTUnref<GrTexture> smallRT1(cache->createTexture(smallDesc, true));
if (smallRT1 && smallRT1->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallRT1->asRenderTarget());
}
@@ -108,7 +108,7 @@
resourceProvider->attachStencilAttachment(smallRT1->asRenderTarget()));
// An unbudgeted RT with the same desc should also share.
- SkAutoTUnref<GrTexture> smallRT2(cache->createTexture(smallDesc, SkBudgeted::kNo));
+ SkAutoTUnref<GrTexture> smallRT2(cache->createTexture(smallDesc, false));
if (smallRT2 && smallRT2->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallRT2->asRenderTarget());
}
@@ -125,7 +125,7 @@
bigDesc.fWidth = 400;
bigDesc.fHeight = 200;
bigDesc.fSampleCnt = 0;
- SkAutoTUnref<GrTexture> bigRT(cache->createTexture(bigDesc, SkBudgeted::kNo));
+ SkAutoTUnref<GrTexture> bigRT(cache->createTexture(bigDesc, false));
if (bigRT && bigRT->asRenderTarget()) {
resourceProvider->attachStencilAttachment(bigRT->asRenderTarget());
}
@@ -139,7 +139,7 @@
// An RT with a different sample count should not share.
GrSurfaceDesc smallMSAADesc = smallDesc;
smallMSAADesc.fSampleCnt = 4;
- SkAutoTUnref<GrTexture> smallMSAART0(cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
+ SkAutoTUnref<GrTexture> smallMSAART0(cache->createTexture(smallMSAADesc, false));
if (smallMSAART0 && smallMSAART0->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallMSAART0->asRenderTarget());
}
@@ -155,7 +155,7 @@
resourceProvider->attachStencilAttachment(smallRT0->asRenderTarget()) !=
resourceProvider->attachStencilAttachment(smallMSAART0->asRenderTarget()));
// A second MSAA RT should share with the first MSAA RT.
- SkAutoTUnref<GrTexture> smallMSAART1(cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
+ SkAutoTUnref<GrTexture> smallMSAART1(cache->createTexture(smallMSAADesc, false));
if (smallMSAART1 && smallMSAART1->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallMSAART1->asRenderTarget());
}
@@ -171,9 +171,8 @@
smallMSAART0 && smallMSAART0->asRenderTarget() &&
smallMSAART0->asRenderTarget()->numColorSamples() < 8) {
smallMSAADesc.fSampleCnt = 8;
- smallMSAART1.reset(cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
- SkAutoTUnref<GrTexture> smallMSAART1(
- cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
+ smallMSAART1.reset(cache->createTexture(smallMSAADesc, false));
+ SkAutoTUnref<GrTexture> smallMSAART1(cache->createTexture(smallMSAADesc, false));
if (smallMSAART1 && smallMSAART1->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallMSAART1->asRenderTarget());
}
@@ -570,7 +569,7 @@
// Since this resource is unbudgeted, it should not be reachable as scratch.
REPORTER_ASSERT(reporter, resource->resourcePriv().getScratchKey() == key);
REPORTER_ASSERT(reporter, !resource->cacheAccess().isScratch());
- REPORTER_ASSERT(reporter, SkBudgeted::kNo == resource->resourcePriv().isBudgeted());
+ REPORTER_ASSERT(reporter, !resource->resourcePriv().isBudgeted());
REPORTER_ASSERT(reporter, nullptr == cache->findAndRefScratchResource(key, TestResource::kDefaultSize, 0));
REPORTER_ASSERT(reporter, 1 == cache->getResourceCount());
REPORTER_ASSERT(reporter, size == cache->getResourceBytes());
@@ -587,7 +586,7 @@
REPORTER_ASSERT(reporter, resource);
REPORTER_ASSERT(reporter, resource->resourcePriv().getScratchKey() == key);
REPORTER_ASSERT(reporter, resource->cacheAccess().isScratch());
- REPORTER_ASSERT(reporter, SkBudgeted::kYes == resource->resourcePriv().isBudgeted());
+ REPORTER_ASSERT(reporter, resource->resourcePriv().isBudgeted());
if (0 == i) {
// If made unbudgeted, it should return to original state: ref'ed and unbudgeted. Try
@@ -602,7 +601,7 @@
REPORTER_ASSERT(reporter, size == cache->getBudgetedResourceBytes());
REPORTER_ASSERT(reporter, !resource->resourcePriv().getScratchKey().isValid());
REPORTER_ASSERT(reporter, !resource->cacheAccess().isScratch());
- REPORTER_ASSERT(reporter, SkBudgeted::kYes == resource->resourcePriv().isBudgeted());
+ REPORTER_ASSERT(reporter, resource->resourcePriv().isBudgeted());
// now when it is unrefed it should die since it has no key.
resource->unref();
diff --git a/tests/SRGBReadWritePixelsTest.cpp b/tests/SRGBReadWritePixelsTest.cpp
index 1446d7d..20b2783 100644
--- a/tests/SRGBReadWritePixelsTest.cpp
+++ b/tests/SRGBReadWritePixelsTest.cpp
@@ -161,8 +161,7 @@
desc.fConfig = kSRGBA_8888_GrPixelConfig;
if (context->caps()->isConfigRenderable(desc.fConfig, false) &&
context->caps()->isConfigTexturable(desc.fConfig)) {
- SkAutoTUnref<GrTexture> tex(context->textureProvider()->createTexture(
- desc, SkBudgeted::kNo));
+ SkAutoTUnref<GrTexture> tex(context->textureProvider()->createTexture(desc, false));
if (!tex) {
ERRORF(reporter, "Could not create SRGBA texture.");
return;
@@ -201,7 +200,7 @@
}
desc.fConfig = kRGBA_8888_GrPixelConfig;
- tex.reset(context->textureProvider()->createTexture(desc, SkBudgeted::kNo));
+ tex.reset(context->textureProvider()->createTexture(desc, false));
if (!tex) {
ERRORF(reporter, "Could not create RGBA texture.");
return;
diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp
index bde140d..049453d 100644
--- a/tests/SpecialImageTest.cpp
+++ b/tests/SpecialImageTest.cpp
@@ -135,7 +135,7 @@
desc.fWidth = kFullSize;
desc.fHeight = kFullSize;
- SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(desc, SkBudgeted::kNo,
+ SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(desc, false,
bm.getPixels(), 0));
if (!texture) {
return;
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 7449f21..41fef61 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -54,7 +54,7 @@
if (requestedInfo) {
*requestedInfo = info;
}
- return SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info, 0, nullptr);
+ return SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info, 0, nullptr);
}
static SkSurface* create_gpu_scratch_surface(GrContext* context,
SkAlphaType at = kPremul_SkAlphaType,
@@ -63,7 +63,7 @@
if (requestedInfo) {
*requestedInfo = info;
}
- return SkSurface::NewRenderTarget(context, SkBudgeted::kYes, info, 0, nullptr);
+ return SkSurface::NewRenderTarget(context, SkSurface::kYes_Budgeted, info, 0, nullptr);
}
#endif
@@ -77,7 +77,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceEmpty_Gpu, reporter, context) {
const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_SkAlphaType);
REPORTER_ASSERT(reporter, nullptr ==
- SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info, 0, nullptr));
+ SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info, 0, nullptr));
}
#endif
@@ -340,7 +340,7 @@
std::function<intptr_t(SkSurface*)> surfaceBackingStore) {
std::function<intptr_t(SkImage*)> ibs = imageBackingStore;
std::function<intptr_t(SkSurface*)> sbs = surfaceBackingStore;
- static const SkBudgeted kB = SkBudgeted::kNo;
+ static const SkSurface::Budgeted kB = SkSurface::kNo_Budgeted;
{
SkAutoTUnref<SkImage> image(surface->newImageSnapshot(kB, SkSurface::kYes_ForceUnique));
REPORTER_ASSERT(reporter, !same_image_surf(image, surface, ibs, sbs));
@@ -699,18 +699,22 @@
#include "SkImage_Gpu.h"
#include "SkSurface_Gpu.h"
-static SkBudgeted is_budgeted(SkSurface* surf) {
- return ((SkSurface_Gpu*)surf)->getDevice()->accessRenderTarget()->resourcePriv().isBudgeted();
+static SkSurface::Budgeted is_budgeted(SkSurface* surf) {
+ return ((SkSurface_Gpu*)surf)->getDevice()->accessRenderTarget()->resourcePriv().isBudgeted() ?
+ SkSurface::kYes_Budgeted : SkSurface::kNo_Budgeted;
}
-static SkBudgeted is_budgeted(SkImage* image) {
- return ((SkImage_Gpu*)image)->getTexture()->resourcePriv().isBudgeted();
+static SkSurface::Budgeted is_budgeted(SkImage* image) {
+ return ((SkImage_Gpu*)image)->getTexture()->resourcePriv().isBudgeted() ?
+ SkSurface::kYes_Budgeted : SkSurface::kNo_Budgeted;
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceBudget, reporter, context) {
SkImageInfo info = SkImageInfo::MakeN32Premul(8,8);
- for (auto sbudgeted : { SkBudgeted::kNo, SkBudgeted::kYes }) {
- for (auto ibudgeted : { SkBudgeted::kNo, SkBudgeted::kYes }) {
+ for (int i = 0; i < 2; ++i) {
+ SkSurface::Budgeted sbudgeted = i ? SkSurface::kYes_Budgeted : SkSurface::kNo_Budgeted;
+ for (int j = 0; j < 2; ++j) {
+ SkSurface::Budgeted ibudgeted = j ? SkSurface::kYes_Budgeted : SkSurface::kNo_Budgeted;
SkAutoTUnref<SkSurface>
surface(SkSurface::NewRenderTarget(context, sbudgeted, info, 0));
SkASSERT(surface);
diff --git a/tests/TextBlobCacheTest.cpp b/tests/TextBlobCacheTest.cpp
index b7456d6..c2907fc 100644
--- a/tests/TextBlobCacheTest.cpp
+++ b/tests/TextBlobCacheTest.cpp
@@ -66,7 +66,7 @@
}
SkImageInfo info = SkImageInfo::Make(kWidth, kHeight, kN32_SkColorType, kPremul_SkAlphaType);
- SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info,
+ SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info,
0, &props));
REPORTER_ASSERT(reporter, surface);
if (!surface) {
diff --git a/tests/TextureStorageAllocator.cpp b/tests/TextureStorageAllocator.cpp
index 73d9dc0..122839c 100644
--- a/tests/TextureStorageAllocator.cpp
+++ b/tests/TextureStorageAllocator.cpp
@@ -67,7 +67,7 @@
grAllocator.fCtx = &allocator;
SkAutoTUnref<SkSurface> surface(SkSurface_Gpu::NewRenderTarget(
- context, SkBudgeted::kNo, SkImageInfo::MakeN32Premul(kWidth, kHeight), 0,
+ context, SkSurface_Gpu::kNo_Budgeted, SkImageInfo::MakeN32Premul(kWidth, kHeight), 0,
NULL, grAllocator));
REPORTER_ASSERT(reporter, surface);
GrGLuint id = allocator.m_mostRecentlyAllocatedStorage;
@@ -101,7 +101,7 @@
grAllocator.fDeallocateTextureStorage= &TestStorageAllocator::deallocateTextureStorage;
grAllocator.fCtx = &allocator;
SkAutoTUnref<SkSurface> surface(SkSurface_Gpu::NewRenderTarget(
- context, SkBudgeted::kNo, SkImageInfo::MakeN32Premul(kWidth, kHeight), 0,
+ context, SkSurface_Gpu::kNo_Budgeted, SkImageInfo::MakeN32Premul(kWidth, kHeight), 0,
NULL, grAllocator));
REPORTER_ASSERT(reporter, !surface);
}
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index 0141bf3..6d672f7 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -413,8 +413,7 @@
desc.fHeight = DEV_H;
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fOrigin = origin;
- SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(desc,
- SkBudgeted::kNo));
+ SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(desc, false));
SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect(texture->asRenderTarget()));
test_write_pixels(reporter, surface);
}