| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrConfigConversionEffect.h" | 8 #include "GrConfigConversionEffect.h" |
| 9 #include "GrContext.h" | 9 #include "GrContext.h" |
| 10 #include "GrTBackendEffectFactory.h" | 10 #include "GrTBackendEffectFactory.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 }; | 206 }; |
| 207 | 207 |
| 208 GrContext::AutoWideOpenIdentityDraw awoid(context, NULL); | 208 GrContext::AutoWideOpenIdentityDraw awoid(context, NULL); |
| 209 | 209 |
| 210 bool failed = true; | 210 bool failed = true; |
| 211 | 211 |
| 212 for (size_t i = 0; i < GR_ARRAY_COUNT(kConversionRules) && failed; ++i) { | 212 for (size_t i = 0; i < GR_ARRAY_COUNT(kConversionRules) && failed; ++i) { |
| 213 *pmToUPMRule = kConversionRules[i][0]; | 213 *pmToUPMRule = kConversionRules[i][0]; |
| 214 *upmToPMRule = kConversionRules[i][1]; | 214 *upmToPMRule = kConversionRules[i][1]; |
| 215 | 215 |
| 216 static const GrRect kDstRect = GrRect::MakeWH(SkIntToScalar(256), SkIntT
oScalar(256)); | 216 static const SkRect kDstRect = SkRect::MakeWH(SkIntToScalar(256), SkIntT
oScalar(256)); |
| 217 static const GrRect kSrcRect = GrRect::MakeWH(SK_Scalar1, SK_Scalar1); | 217 static const SkRect kSrcRect = SkRect::MakeWH(SK_Scalar1, SK_Scalar1); |
| 218 // We do a PM->UPM draw from dataTex to readTex and read the data. Then
we do a UPM->PM draw | 218 // We do a PM->UPM draw from dataTex to readTex and read the data. Then
we do a UPM->PM draw |
| 219 // from readTex to tempTex followed by a PM->UPM draw to readTex and fin
ally read the data. | 219 // from readTex to tempTex followed by a PM->UPM draw to readTex and fin
ally read the data. |
| 220 // We then verify that two reads produced the same values. | 220 // We then verify that two reads produced the same values. |
| 221 | 221 |
| 222 AutoEffectUnref pmToUPM1(SkNEW_ARGS(GrConfigConversionEffect, (dataTex, | 222 AutoEffectUnref pmToUPM1(SkNEW_ARGS(GrConfigConversionEffect, (dataTex, |
| 223 false, | 223 false, |
| 224 *pmToUPMR
ule, | 224 *pmToUPMR
ule, |
| 225 SkMatrix:
:I()))); | 225 SkMatrix:
:I()))); |
| 226 AutoEffectUnref upmToPM(SkNEW_ARGS(GrConfigConversionEffect, (readTex, | 226 AutoEffectUnref upmToPM(SkNEW_ARGS(GrConfigConversionEffect, (readTex, |
| 227 false, | 227 false, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 // The PM conversions assume colors are 0..255 | 287 // The PM conversions assume colors are 0..255 |
| 288 return NULL; | 288 return NULL; |
| 289 } | 289 } |
| 290 AutoEffectUnref effect(SkNEW_ARGS(GrConfigConversionEffect, (texture, | 290 AutoEffectUnref effect(SkNEW_ARGS(GrConfigConversionEffect, (texture, |
| 291 swapRedAndB
lue, | 291 swapRedAndB
lue, |
| 292 pmConversio
n, | 292 pmConversio
n, |
| 293 matrix))); | 293 matrix))); |
| 294 return CreateEffectRef(effect); | 294 return CreateEffectRef(effect); |
| 295 } | 295 } |
| 296 } | 296 } |
| OLD | NEW |