| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 } | 118 } |
| 119 | 119 |
| 120 void GrConfigConversionEffect::onComputeInvariantOutput(GrInvariantOutput* inout
) const { | 120 void GrConfigConversionEffect::onComputeInvariantOutput(GrInvariantOutput* inout
) const { |
| 121 this->updateInvariantOutputForModulation(inout); | 121 this->updateInvariantOutputForModulation(inout); |
| 122 } | 122 } |
| 123 | 123 |
| 124 /////////////////////////////////////////////////////////////////////////////// | 124 /////////////////////////////////////////////////////////////////////////////// |
| 125 | 125 |
| 126 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConfigConversionEffect); | 126 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConfigConversionEffect); |
| 127 | 127 |
| 128 #if !defined(__clang__) && _MSC_FULL_VER >= 190024213 |
| 129 // Work around VS 2015 Update 3 optimizer bug that causes internal compiler erro
r |
| 130 //https://connect.microsoft.com/VisualStudio/feedback/details/3100520/internal-c
ompiler-error |
| 131 #pragma optimize("t", off) |
| 132 #endif |
| 133 |
| 128 sk_sp<GrFragmentProcessor> GrConfigConversionEffect::TestCreate(GrProcessorTestD
ata* d) { | 134 sk_sp<GrFragmentProcessor> GrConfigConversionEffect::TestCreate(GrProcessorTestD
ata* d) { |
| 129 PMConversion pmConv = static_cast<PMConversion>(d->fRandom->nextULessThan(kP
MConversionCnt)); | 135 PMConversion pmConv = static_cast<PMConversion>(d->fRandom->nextULessThan(kP
MConversionCnt)); |
| 130 GrSwizzle swizzle; | 136 GrSwizzle swizzle; |
| 131 do { | 137 do { |
| 132 swizzle = GrSwizzle::CreateRandom(d->fRandom); | 138 swizzle = GrSwizzle::CreateRandom(d->fRandom); |
| 133 } while (pmConv == kNone_PMConversion && swizzle == GrSwizzle::RGBA()); | 139 } while (pmConv == kNone_PMConversion && swizzle == GrSwizzle::RGBA()); |
| 134 return sk_sp<GrFragmentProcessor>( | 140 return sk_sp<GrFragmentProcessor>( |
| 135 new GrConfigConversionEffect(d->fTextures[GrProcessorUnitTest::kSkiaPMTe
xtureIdx], | 141 new GrConfigConversionEffect(d->fTextures[GrProcessorUnitTest::kSkiaPMTe
xtureIdx], |
| 136 swizzle, pmConv, GrTest::TestMatrix(d->fRan
dom))); | 142 swizzle, pmConv, GrTest::TestMatrix(d->fRan
dom))); |
| 137 } | 143 } |
| 138 | 144 |
| 145 #if !defined(__clang__) && _MSC_FULL_VER >= 190024213 |
| 146 // Restore optimization settings. |
| 147 #pragma optimize("", on) |
| 148 #endif |
| 149 |
| 139 /////////////////////////////////////////////////////////////////////////////// | 150 /////////////////////////////////////////////////////////////////////////////// |
| 140 | 151 |
| 141 void GrConfigConversionEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, | 152 void GrConfigConversionEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, |
| 142 GrProcessorKeyBuilder* b) c
onst { | 153 GrProcessorKeyBuilder* b) c
onst { |
| 143 GrGLConfigConversionEffect::GenKey(*this, caps, b); | 154 GrGLConfigConversionEffect::GenKey(*this, caps, b); |
| 144 } | 155 } |
| 145 | 156 |
| 146 GrGLSLFragmentProcessor* GrConfigConversionEffect::onCreateGLSLInstance() const
{ | 157 GrGLSLFragmentProcessor* GrConfigConversionEffect::onCreateGLSLInstance() const
{ |
| 147 return new GrGLConfigConversionEffect(); | 158 return new GrGLConfigConversionEffect(); |
| 148 } | 159 } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 if (kRGBA_8888_GrPixelConfig != texture->config() && | 276 if (kRGBA_8888_GrPixelConfig != texture->config() && |
| 266 kBGRA_8888_GrPixelConfig != texture->config() && | 277 kBGRA_8888_GrPixelConfig != texture->config() && |
| 267 kNone_PMConversion != pmConversion) { | 278 kNone_PMConversion != pmConversion) { |
| 268 // The PM conversions assume colors are 0..255 | 279 // The PM conversions assume colors are 0..255 |
| 269 return nullptr; | 280 return nullptr; |
| 270 } | 281 } |
| 271 return sk_sp<GrFragmentProcessor>( | 282 return sk_sp<GrFragmentProcessor>( |
| 272 new GrConfigConversionEffect(texture, swizzle, pmConversion, matrix)
); | 283 new GrConfigConversionEffect(texture, swizzle, pmConversion, matrix)
); |
| 273 } | 284 } |
| 274 } | 285 } |
| OLD | NEW |