| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 GrConfigConversionEffect::GrConfigConversionEffect(GrProcessorDataManager* procD
ataManager, | 99 GrConfigConversionEffect::GrConfigConversionEffect(GrProcessorDataManager* procD
ataManager, |
| 100 GrTexture* texture, | 100 GrTexture* texture, |
| 101 bool swapRedAndBlue, | 101 bool swapRedAndBlue, |
| 102 PMConversion pmConversion, | 102 PMConversion pmConversion, |
| 103 const SkMatrix& matrix) | 103 const SkMatrix& matrix) |
| 104 : INHERITED(procDataManager, texture, matrix) | 104 : INHERITED(procDataManager, texture, matrix) |
| 105 , fSwapRedAndBlue(swapRedAndBlue) | 105 , fSwapRedAndBlue(swapRedAndBlue) |
| 106 , fPMConversion(pmConversion) { | 106 , fPMConversion(pmConversion) { |
| 107 this->initClassID<GrConfigConversionEffect>(); | 107 this->initClassID<GrConfigConversionEffect>(); |
| 108 SkASSERT(kRGBA_8888_GrPixelConfig == texture->config() || | 108 // We expect to get here with non-BGRA/RGBA only if we're doing not doing a
premul/unpremul |
| 109 kBGRA_8888_GrPixelConfig == texture->config()); | 109 // conversion. |
| 110 SkASSERT((kRGBA_8888_GrPixelConfig == texture->config() || |
| 111 kBGRA_8888_GrPixelConfig == texture->config()) || |
| 112 kNone_PMConversion == pmConversion); |
| 110 // Why did we pollute our texture cache instead of using a GrSingleTextureEf
fect? | 113 // Why did we pollute our texture cache instead of using a GrSingleTextureEf
fect? |
| 111 SkASSERT(swapRedAndBlue || kNone_PMConversion != pmConversion); | 114 SkASSERT(swapRedAndBlue || kNone_PMConversion != pmConversion); |
| 112 } | 115 } |
| 113 | 116 |
| 114 bool GrConfigConversionEffect::onIsEqual(const GrFragmentProcessor& s) const { | 117 bool GrConfigConversionEffect::onIsEqual(const GrFragmentProcessor& s) const { |
| 115 const GrConfigConversionEffect& other = s.cast<GrConfigConversionEffect>(); | 118 const GrConfigConversionEffect& other = s.cast<GrConfigConversionEffect>(); |
| 116 return other.fSwapRedAndBlue == fSwapRedAndBlue && | 119 return other.fSwapRedAndBlue == fSwapRedAndBlue && |
| 117 other.fPMConversion == fPMConversion; | 120 other.fPMConversion == fPMConversion; |
| 118 } | 121 } |
| 119 | 122 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // The PM conversions assume colors are 0..255 | 314 // The PM conversions assume colors are 0..255 |
| 312 return NULL; | 315 return NULL; |
| 313 } | 316 } |
| 314 return SkNEW_ARGS(GrConfigConversionEffect, (procDataManager, | 317 return SkNEW_ARGS(GrConfigConversionEffect, (procDataManager, |
| 315 texture, | 318 texture, |
| 316 swapRedAndBlue, | 319 swapRedAndBlue, |
| 317 pmConversion, | 320 pmConversion, |
| 318 matrix)); | 321 matrix)); |
| 319 } | 322 } |
| 320 } | 323 } |
| OLD | NEW |