| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |