| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 SkMatrix::I()))); | 225 SkMatrix::I()))); |
| 226 SkAutoTUnref<GrFragmentProcessor> upmToPM( | 226 SkAutoTUnref<GrFragmentProcessor> upmToPM( |
| 227 SkNEW_ARGS(GrConfigConversionEffect, | 227 SkNEW_ARGS(GrConfigConversionEffect, |
| 228 (paint2.getProcessorDataManager(), readTex, false, *u
pmToPMRule, | 228 (paint2.getProcessorDataManager(), readTex, false, *u
pmToPMRule, |
| 229 SkMatrix::I()))); | 229 SkMatrix::I()))); |
| 230 SkAutoTUnref<GrFragmentProcessor> pmToUPM2( | 230 SkAutoTUnref<GrFragmentProcessor> pmToUPM2( |
| 231 SkNEW_ARGS(GrConfigConversionEffect, | 231 SkNEW_ARGS(GrConfigConversionEffect, |
| 232 (paint3.getProcessorDataManager(), tempTex, false, *p
mToUPMRule, | 232 (paint3.getProcessorDataManager(), tempTex, false, *p
mToUPMRule, |
| 233 SkMatrix::I()))); | 233 SkMatrix::I()))); |
| 234 | 234 |
| 235 paint1.addColorFragmentProcessor(pmToUPM1); | 235 paint1.addColorProcessor(pmToUPM1); |
| 236 | 236 |
| 237 | 237 |
| 238 GrDrawContext* readDrawContext = context->drawContext(); | 238 GrDrawContext* readDrawContext = context->drawContext(); |
| 239 if (!readDrawContext) { | 239 if (!readDrawContext) { |
| 240 failed = true; | 240 failed = true; |
| 241 break; | 241 break; |
| 242 } | 242 } |
| 243 | 243 |
| 244 readDrawContext->drawNonAARectToRect(readTex->asRenderTarget(), | 244 readDrawContext->drawNonAARectToRect(readTex->asRenderTarget(), |
| 245 GrClip::WideOpen(), | 245 GrClip::WideOpen(), |
| 246 paint1, | 246 paint1, |
| 247 SkMatrix::I(), | 247 SkMatrix::I(), |
| 248 kDstRect, | 248 kDstRect, |
| 249 kSrcRect); | 249 kSrcRect); |
| 250 | 250 |
| 251 readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, firstRead)
; | 251 readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, firstRead)
; |
| 252 | 252 |
| 253 paint2.addColorFragmentProcessor(upmToPM); | 253 paint2.addColorProcessor(upmToPM); |
| 254 | 254 |
| 255 GrDrawContext* tempDrawContext = context->drawContext(); | 255 GrDrawContext* tempDrawContext = context->drawContext(); |
| 256 if (!tempDrawContext) { | 256 if (!tempDrawContext) { |
| 257 failed = true; | 257 failed = true; |
| 258 break; | 258 break; |
| 259 } | 259 } |
| 260 tempDrawContext->drawNonAARectToRect(tempTex->asRenderTarget(), | 260 tempDrawContext->drawNonAARectToRect(tempTex->asRenderTarget(), |
| 261 GrClip::WideOpen(), | 261 GrClip::WideOpen(), |
| 262 paint2, | 262 paint2, |
| 263 SkMatrix::I(), | 263 SkMatrix::I(), |
| 264 kDstRect, | 264 kDstRect, |
| 265 kSrcRect); | 265 kSrcRect); |
| 266 | 266 |
| 267 paint3.addColorFragmentProcessor(pmToUPM2); | 267 paint3.addColorProcessor(pmToUPM2); |
| 268 | 268 |
| 269 readDrawContext = context->drawContext(); | 269 readDrawContext = context->drawContext(); |
| 270 if (!readDrawContext) { | 270 if (!readDrawContext) { |
| 271 failed = true; | 271 failed = true; |
| 272 break; | 272 break; |
| 273 } | 273 } |
| 274 | 274 |
| 275 readDrawContext->drawNonAARectToRect(readTex->asRenderTarget(), | 275 readDrawContext->drawNonAARectToRect(readTex->asRenderTarget(), |
| 276 GrClip::WideOpen(), | 276 GrClip::WideOpen(), |
| 277 paint3, | 277 paint3, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 // The PM conversions assume colors are 0..255 | 314 // The PM conversions assume colors are 0..255 |
| 315 return NULL; | 315 return NULL; |
| 316 } | 316 } |
| 317 return SkNEW_ARGS(GrConfigConversionEffect, (procDataManager, | 317 return SkNEW_ARGS(GrConfigConversionEffect, (procDataManager, |
| 318 texture, | 318 texture, |
| 319 swapRedAndBlue, | 319 swapRedAndBlue, |
| 320 pmConversion, | 320 pmConversion, |
| 321 matrix)); | 321 matrix)); |
| 322 } | 322 } |
| 323 } | 323 } |
| OLD | NEW |