| 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 "GrInvariantOutput.h" | 10 #include "GrInvariantOutput.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 SkAutoTUnref<GrFragmentProcessor> upmToPM( | 224 SkAutoTUnref<GrFragmentProcessor> upmToPM( |
| 225 SkNEW_ARGS(GrConfigConversionEffect, | 225 SkNEW_ARGS(GrConfigConversionEffect, |
| 226 (readTex, false, *upmToPMRule, SkMatrix::I()))); | 226 (readTex, false, *upmToPMRule, SkMatrix::I()))); |
| 227 SkAutoTUnref<GrFragmentProcessor> pmToUPM2( | 227 SkAutoTUnref<GrFragmentProcessor> pmToUPM2( |
| 228 SkNEW_ARGS(GrConfigConversionEffect, | 228 SkNEW_ARGS(GrConfigConversionEffect, |
| 229 (tempTex, false, *pmToUPMRule, SkMatrix::I()))); | 229 (tempTex, false, *pmToUPMRule, SkMatrix::I()))); |
| 230 | 230 |
| 231 context->setRenderTarget(readTex->asRenderTarget()); | 231 context->setRenderTarget(readTex->asRenderTarget()); |
| 232 GrPaint paint1; | 232 GrPaint paint1; |
| 233 paint1.addColorProcessor(pmToUPM1); | 233 paint1.addColorProcessor(pmToUPM1); |
| 234 context->drawRectToRect(paint1, SkMatrix::I(), kDstRect, kSrcRect); | 234 context->drawNonAARectToRect(paint1, SkMatrix::I(), kDstRect, kSrcRect); |
| 235 | 235 |
| 236 readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, firstRead)
; | 236 readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, firstRead)
; |
| 237 | 237 |
| 238 context->setRenderTarget(tempTex->asRenderTarget()); | 238 context->setRenderTarget(tempTex->asRenderTarget()); |
| 239 GrPaint paint2; | 239 GrPaint paint2; |
| 240 paint2.addColorProcessor(upmToPM); | 240 paint2.addColorProcessor(upmToPM); |
| 241 context->drawRectToRect(paint2, SkMatrix::I(), kDstRect, kSrcRect); | 241 context->drawNonAARectToRect(paint2, SkMatrix::I(), kDstRect, kSrcRect); |
| 242 context->setRenderTarget(readTex->asRenderTarget()); | 242 context->setRenderTarget(readTex->asRenderTarget()); |
| 243 | 243 |
| 244 GrPaint paint3; | 244 GrPaint paint3; |
| 245 paint3.addColorProcessor(pmToUPM2); | 245 paint3.addColorProcessor(pmToUPM2); |
| 246 context->drawRectToRect(paint3, SkMatrix::I(), kDstRect, kSrcRect); | 246 context->drawNonAARectToRect(paint3, SkMatrix::I(), kDstRect, kSrcRect); |
| 247 | 247 |
| 248 readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, secondRead
); | 248 readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, secondRead
); |
| 249 | 249 |
| 250 failed = false; | 250 failed = false; |
| 251 for (int y = 0; y < 256 && !failed; ++y) { | 251 for (int y = 0; y < 256 && !failed; ++y) { |
| 252 for (int x = 0; x <= y; ++x) { | 252 for (int x = 0; x <= y; ++x) { |
| 253 if (firstRead[256 * y + x] != secondRead[256 * y + x]) { | 253 if (firstRead[256 * y + x] != secondRead[256 * y + x]) { |
| 254 failed = true; | 254 failed = true; |
| 255 break; | 255 break; |
| 256 } | 256 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 278 kNone_PMConversion != pmConversion) { | 278 kNone_PMConversion != pmConversion) { |
| 279 // The PM conversions assume colors are 0..255 | 279 // The PM conversions assume colors are 0..255 |
| 280 return NULL; | 280 return NULL; |
| 281 } | 281 } |
| 282 return SkNEW_ARGS(GrConfigConversionEffect, (texture, | 282 return SkNEW_ARGS(GrConfigConversionEffect, (texture, |
| 283 swapRedAndBlue, | 283 swapRedAndBlue, |
| 284 pmConversion, | 284 pmConversion, |
| 285 matrix)); | 285 matrix)); |
| 286 } | 286 } |
| 287 } | 287 } |
| OLD | NEW |