| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 // This test only works with the GPU backend. | 8 // This test only works with the GPU backend. |
| 9 | 9 |
| 10 #include "gm.h" | 10 #include "gm.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 GrTextureParams::ClampBilerp()
, | 87 GrTextureParams::ClampBilerp()
, |
| 88 SkSourceGammaTreatment::kRespe
ct)); | 88 SkSourceGammaTreatment::kRespe
ct)); |
| 89 texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[2], | 89 texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[2], |
| 90 GrTextureParams::ClampBilerp()
, | 90 GrTextureParams::ClampBilerp()
, |
| 91 SkSourceGammaTreatment::kRespe
ct)); | 91 SkSourceGammaTreatment::kRespe
ct)); |
| 92 | 92 |
| 93 if (!texture[0] || !texture[1] || !texture[2]) { | 93 if (!texture[0] || !texture[1] || !texture[2]) { |
| 94 return; | 94 return; |
| 95 } | 95 } |
| 96 | 96 |
| 97 static const SkScalar kDrawPad = 10.f; | 97 constexpr SkScalar kDrawPad = 10.f; |
| 98 static const SkScalar kTestPad = 10.f; | 98 constexpr SkScalar kTestPad = 10.f; |
| 99 static const SkScalar kColorSpaceOffset = 36.f; | 99 constexpr SkScalar kColorSpaceOffset = 36.f; |
| 100 SkISize sizes[3] = {{YSIZE, YSIZE}, {USIZE, USIZE}, {VSIZE, VSIZE}}; | 100 SkISize sizes[3] = {{YSIZE, YSIZE}, {USIZE, USIZE}, {VSIZE, VSIZE}}; |
| 101 | 101 |
| 102 for (int space = kJPEG_SkYUVColorSpace; space <= kLastEnum_SkYUVColorSpa
ce; | 102 for (int space = kJPEG_SkYUVColorSpace; space <= kLastEnum_SkYUVColorSpa
ce; |
| 103 ++space) { | 103 ++space) { |
| 104 SkRect renderRect = SkRect::MakeWH(SkIntToScalar(fBmp[0].width()), | 104 SkRect renderRect = SkRect::MakeWH(SkIntToScalar(fBmp[0].width()), |
| 105 SkIntToScalar(fBmp[0].height())); | 105 SkIntToScalar(fBmp[0].height())); |
| 106 renderRect.outset(kDrawPad, kDrawPad); | 106 renderRect.outset(kDrawPad, kDrawPad); |
| 107 | 107 |
| 108 SkScalar y = kDrawPad + kTestPad + space * kColorSpaceOffset; | 108 SkScalar y = kDrawPad + kTestPad + space * kColorSpaceOffset; |
| 109 SkScalar x = kDrawPad + kTestPad; | 109 SkScalar x = kDrawPad + kTestPad; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 SkSourceGammaTreatment::kRespe
ct)); | 204 SkSourceGammaTreatment::kRespe
ct)); |
| 205 texture[1].reset(GrRefCachedBitmapTexture(context, fBmp[1], GrTexturePar
ams::ClampBilerp(), | 205 texture[1].reset(GrRefCachedBitmapTexture(context, fBmp[1], GrTexturePar
ams::ClampBilerp(), |
| 206 SkSourceGammaTreatment::kRespe
ct)); | 206 SkSourceGammaTreatment::kRespe
ct)); |
| 207 texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[1], GrTexturePar
ams::ClampBilerp(), | 207 texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[1], GrTexturePar
ams::ClampBilerp(), |
| 208 SkSourceGammaTreatment::kRespe
ct)); | 208 SkSourceGammaTreatment::kRespe
ct)); |
| 209 | 209 |
| 210 if (!texture[0] || !texture[1] || !texture[2]) { | 210 if (!texture[0] || !texture[1] || !texture[2]) { |
| 211 return; | 211 return; |
| 212 } | 212 } |
| 213 | 213 |
| 214 static const SkScalar kDrawPad = 10.f; | 214 constexpr SkScalar kDrawPad = 10.f; |
| 215 static const SkScalar kTestPad = 10.f; | 215 constexpr SkScalar kTestPad = 10.f; |
| 216 static const SkScalar kColorSpaceOffset = 36.f; | 216 constexpr SkScalar kColorSpaceOffset = 36.f; |
| 217 SkISize sizes[3] = {{YSIZE, YSIZE}, {USIZE, USIZE}, {VSIZE, VSIZE}}; | 217 SkISize sizes[3] = {{YSIZE, YSIZE}, {USIZE, USIZE}, {VSIZE, VSIZE}}; |
| 218 | 218 |
| 219 for (int space = kJPEG_SkYUVColorSpace; space <= kLastEnum_SkYUVColorSpa
ce; ++space) { | 219 for (int space = kJPEG_SkYUVColorSpace; space <= kLastEnum_SkYUVColorSpa
ce; ++space) { |
| 220 SkRect renderRect = | 220 SkRect renderRect = |
| 221 SkRect::MakeWH(SkIntToScalar(fBmp[0].width()), SkIntToScalar(fBm
p[0].height())); | 221 SkRect::MakeWH(SkIntToScalar(fBmp[0].width()), SkIntToScalar(fBm
p[0].height())); |
| 222 renderRect.outset(kDrawPad, kDrawPad); | 222 renderRect.outset(kDrawPad, kDrawPad); |
| 223 | 223 |
| 224 SkScalar y = kDrawPad + kTestPad + space * kColorSpaceOffset; | 224 SkScalar y = kDrawPad + kTestPad + space * kColorSpaceOffset; |
| 225 SkScalar x = kDrawPad + kTestPad; | 225 SkScalar x = kDrawPad + kTestPad; |
| 226 | 226 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 243 private: | 243 private: |
| 244 SkBitmap fBmp[2]; | 244 SkBitmap fBmp[2]; |
| 245 | 245 |
| 246 typedef GM INHERITED; | 246 typedef GM INHERITED; |
| 247 }; | 247 }; |
| 248 | 248 |
| 249 DEF_GM(return new YUVNV12toRGBEffect;) | 249 DEF_GM(return new YUVNV12toRGBEffect;) |
| 250 } | 250 } |
| 251 | 251 |
| 252 #endif | 252 #endif |
| OLD | NEW |