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

Side by Side Diff: tests/SRGBMipMapTest.cpp

Issue 2154753003: Introduce GrColorSpaceXform, for gamut conversion on textures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More progress & refactoring 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 unified diff | Download patch
« no previous file with comments | « src/image/SkImageShader.cpp ('k') | tools/gpu/GrTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Test.h" 8 #include "Test.h"
9 #if SK_SUPPORT_GPU 9 #if SK_SUPPORT_GPU
10 #include "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 sk_sp<GrDrawContext> l32DrawContext( 139 sk_sp<GrDrawContext> l32DrawContext(
140 context->drawContext(sk_ref_sp(l32Texture->asRenderTarget()), &l32Props) ); 140 context->drawContext(sk_ref_sp(l32Texture->asRenderTarget()), &l32Props) );
141 sk_sp<GrDrawContext> s32DrawContext( 141 sk_sp<GrDrawContext> s32DrawContext(
142 context->drawContext(sk_ref_sp(s32Texture->asRenderTarget()), &s32Props) ); 142 context->drawContext(sk_ref_sp(s32Texture->asRenderTarget()), &s32Props) );
143 143
144 SkRect rect = SkRect::MakeWH(SkIntToScalar(rtS), SkIntToScalar(rtS)); 144 SkRect rect = SkRect::MakeWH(SkIntToScalar(rtS), SkIntToScalar(rtS));
145 GrNoClip noClip; 145 GrNoClip noClip;
146 GrPaint paint; 146 GrPaint paint;
147 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 147 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
148 GrTextureParams mipMapParams(SkShader::kRepeat_TileMode, GrTextureParams::kM ipMap_FilterMode); 148 GrTextureParams mipMapParams(SkShader::kRepeat_TileMode, GrTextureParams::kM ipMap_FilterMode);
149 paint.addColorTextureProcessor(texture, SkMatrix::MakeScale(0.5f), mipMapPar ams); 149 paint.addColorTextureProcessor(texture, nullptr, SkMatrix::MakeScale(0.5f), mipMapParams);
150 150
151 // 1) Draw texture to S32 surface (should generate/use sRGB mips) 151 // 1) Draw texture to S32 surface (should generate/use sRGB mips)
152 paint.setGammaCorrect(true); 152 paint.setGammaCorrect(true);
153 s32DrawContext->drawRect(noClip, paint, SkMatrix::I(), rect); 153 s32DrawContext->drawRect(noClip, paint, SkMatrix::I(), rect);
154 read_and_check_pixels(reporter, s32Texture, expectedSRGB, error, "first rend er of sRGB"); 154 read_and_check_pixels(reporter, s32Texture, expectedSRGB, error, "first rend er of sRGB");
155 155
156 // 2) Draw texture to L32 surface (should generate/use linear mips) 156 // 2) Draw texture to L32 surface (should generate/use linear mips)
157 paint.setGammaCorrect(false); 157 paint.setGammaCorrect(false);
158 l32DrawContext->drawRect(noClip, paint, SkMatrix::I(), rect); 158 l32DrawContext->drawRect(noClip, paint, SkMatrix::I(), rect);
159 read_and_check_pixels(reporter, l32Texture, expectedLinear, error, "re-rende r as linear"); 159 read_and_check_pixels(reporter, l32Texture, expectedLinear, error, "re-rende r as linear");
160 160
161 // 3) Go back to sRGB 161 // 3) Go back to sRGB
162 paint.setGammaCorrect(true); 162 paint.setGammaCorrect(true);
163 s32DrawContext->drawRect(noClip, paint, SkMatrix::I(), rect); 163 s32DrawContext->drawRect(noClip, paint, SkMatrix::I(), rect);
164 read_and_check_pixels(reporter, s32Texture, expectedSRGB, error, "re-render as sRGB"); 164 read_and_check_pixels(reporter, s32Texture, expectedSRGB, error, "re-render as sRGB");
165 } 165 }
166 #endif 166 #endif
OLDNEW
« no previous file with comments | « src/image/SkImageShader.cpp ('k') | tools/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698