| 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 "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 SkAutoTUnref<GrFragmentProcessor> pmToUPM1(new GrConfigConversionEffect( | 217 SkAutoTUnref<GrFragmentProcessor> pmToUPM1(new GrConfigConversionEffect( |
| 218 dataTex, false, *pmToUPMRule, SkMatrix::I())); | 218 dataTex, false, *pmToUPMRule, SkMatrix::I())); |
| 219 SkAutoTUnref<GrFragmentProcessor> upmToPM(new GrConfigConversionEffect( | 219 SkAutoTUnref<GrFragmentProcessor> upmToPM(new GrConfigConversionEffect( |
| 220 readTex, false, *upmToPMRule, SkMatrix::I())); | 220 readTex, false, *upmToPMRule, SkMatrix::I())); |
| 221 SkAutoTUnref<GrFragmentProcessor> pmToUPM2(new GrConfigConversionEffect( | 221 SkAutoTUnref<GrFragmentProcessor> pmToUPM2(new GrConfigConversionEffect( |
| 222 tempTex, false, *pmToUPMRule, SkMatrix::I())); | 222 tempTex, false, *pmToUPMRule, SkMatrix::I())); |
| 223 | 223 |
| 224 paint1.addColorFragmentProcessor(pmToUPM1); | 224 paint1.addColorFragmentProcessor(pmToUPM1); |
| 225 | 225 |
| 226 | 226 |
| 227 SkAutoTUnref<GrDrawContext> readDrawContext(context->drawContext(readTex
->asRenderTarget())); | 227 SkAutoTUnref<GrDrawContext> readDrawContext( |
| 228 context->drawContext(readTex->asRenderTarget
())); |
| 228 if (!readDrawContext) { | 229 if (!readDrawContext) { |
| 229 failed = true; | 230 failed = true; |
| 230 break; | 231 break; |
| 231 } | 232 } |
| 232 | 233 |
| 233 readDrawContext->drawNonAARectToRect(GrClip::WideOpen(), | 234 readDrawContext->drawNonAARectToRect(GrClip::WideOpen(), |
| 234 paint1, | 235 paint1, |
| 235 SkMatrix::I(), | 236 SkMatrix::I(), |
| 236 kDstRect, | 237 kDstRect, |
| 237 kSrcRect); | 238 kSrcRect); |
| 238 | 239 |
| 239 readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, firstRead)
; | 240 readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, firstRead)
; |
| 240 | 241 |
| 241 paint2.addColorFragmentProcessor(upmToPM); | 242 paint2.addColorFragmentProcessor(upmToPM); |
| 242 | 243 |
| 243 SkAutoTUnref<GrDrawContext> tempDrawContext(context->drawContext(tempTex
->asRenderTarget())); | 244 SkAutoTUnref<GrDrawContext> tempDrawContext( |
| 245 context->drawContext(tempTex->asRenderTarget
())); |
| 244 if (!tempDrawContext) { | 246 if (!tempDrawContext) { |
| 245 failed = true; | 247 failed = true; |
| 246 break; | 248 break; |
| 247 } | 249 } |
| 248 tempDrawContext->drawNonAARectToRect(GrClip::WideOpen(), | 250 tempDrawContext->drawNonAARectToRect(GrClip::WideOpen(), |
| 249 paint2, | 251 paint2, |
| 250 SkMatrix::I(), | 252 SkMatrix::I(), |
| 251 kDstRect, | 253 kDstRect, |
| 252 kSrcRect); | 254 kSrcRect); |
| 253 | 255 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 } else { | 297 } else { |
| 296 if (kRGBA_8888_GrPixelConfig != texture->config() && | 298 if (kRGBA_8888_GrPixelConfig != texture->config() && |
| 297 kBGRA_8888_GrPixelConfig != texture->config() && | 299 kBGRA_8888_GrPixelConfig != texture->config() && |
| 298 kNone_PMConversion != pmConversion) { | 300 kNone_PMConversion != pmConversion) { |
| 299 // The PM conversions assume colors are 0..255 | 301 // The PM conversions assume colors are 0..255 |
| 300 return nullptr; | 302 return nullptr; |
| 301 } | 303 } |
| 302 return new GrConfigConversionEffect(texture, swapRedAndBlue, pmConversio
n, matrix); | 304 return new GrConfigConversionEffect(texture, swapRedAndBlue, pmConversio
n, matrix); |
| 303 } | 305 } |
| 304 } | 306 } |
| OLD | NEW |