Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: tests/SRGBMipMapTest.cpp

Issue 2162973002: Create DCs instead of textures in SRGBMipMaps test (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SRGBMipMapTest.cpp
diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp
index 5001a9e094ba1b6d05743427b7827b158a8663c8..1e62f88be873efc264c7ee724e517bff34357af7 100644
--- a/tests/SRGBMipMapTest.cpp
+++ b/tests/SRGBMipMapTest.cpp
@@ -119,27 +119,18 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
GrTextureProvider* texProvider = context->textureProvider();
SkAutoTUnref<GrTexture> texture(texProvider->createTexture(desc, SkBudgeted::kNo, texData, 0));
- // Create two surfaces (L32 and S32)
- GrSurfaceDesc l32Desc;
- l32Desc.fFlags = kRenderTarget_GrSurfaceFlag;
- l32Desc.fConfig = kSkia8888_GrPixelConfig;
- l32Desc.fWidth = rtS;
- l32Desc.fHeight = rtS;
-
- GrSurfaceDesc s32Desc = l32Desc;
- s32Desc.fConfig = kSkiaGamma8888_GrPixelConfig;
-
- SkAutoTUnref<GrTexture> l32Texture(texProvider->createTexture(l32Desc, SkBudgeted::kNo));
- SkAutoTUnref<GrTexture> s32Texture(texProvider->createTexture(s32Desc, SkBudgeted::kNo));
-
+ // Create two draw contexts (L32 and S32)
SkSurfaceProps l32Props(SkSurfaceProps::kLegacyFontHost_InitType);
SkSurfaceProps s32Props(SkSurfaceProps::kGammaCorrect_Flag,
SkSurfaceProps::kLegacyFontHost_InitType);
-
- sk_sp<GrDrawContext> l32DrawContext(
- context->drawContext(sk_ref_sp(l32Texture->asRenderTarget()), &l32Props));
- sk_sp<GrDrawContext> s32DrawContext(
- context->drawContext(sk_ref_sp(s32Texture->asRenderTarget()), &s32Props));
+ sk_sp<GrDrawContext> l32DrawContext = context->newDrawContext(SkBackingFit::kExact, rtS, rtS,
+ kSkia8888_GrPixelConfig, 0,
+ kDefault_GrSurfaceOrigin,
+ &l32Props);
+ sk_sp<GrDrawContext> s32DrawContext = context->newDrawContext(SkBackingFit::kExact, rtS, rtS,
+ kSkiaGamma8888_GrPixelConfig, 0,
+ kDefault_GrSurfaceOrigin,
+ &s32Props);
SkRect rect = SkRect::MakeWH(SkIntToScalar(rtS), SkIntToScalar(rtS));
GrNoClip noClip;
@@ -151,16 +142,19 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
// 1) Draw texture to S32 surface (should generate/use sRGB mips)
paint.setGammaCorrect(true);
s32DrawContext->drawRect(noClip, paint, SkMatrix::I(), rect);
- read_and_check_pixels(reporter, s32Texture, expectedSRGB, error, "first render of sRGB");
+ read_and_check_pixels(reporter, s32DrawContext->asTexture().get(), expectedSRGB, error,
+ "first render of sRGB");
// 2) Draw texture to L32 surface (should generate/use linear mips)
paint.setGammaCorrect(false);
l32DrawContext->drawRect(noClip, paint, SkMatrix::I(), rect);
- read_and_check_pixels(reporter, l32Texture, expectedLinear, error, "re-render as linear");
+ read_and_check_pixels(reporter, l32DrawContext->asTexture().get(), expectedLinear, error,
+ "re-render as linear");
// 3) Go back to sRGB
paint.setGammaCorrect(true);
s32DrawContext->drawRect(noClip, paint, SkMatrix::I(), rect);
- read_and_check_pixels(reporter, s32Texture, expectedSRGB, error, "re-render as sRGB");
+ read_and_check_pixels(reporter, s32DrawContext->asTexture().get(), expectedSRGB, error,
+ "re-render as sRGB");
}
#endif
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698