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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 color[0] = SkTMin(x, y); | 175 color[0] = SkTMin(x, y); |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
179 GrSurfaceDesc desc; | 179 GrSurfaceDesc desc; |
180 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 180 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
181 desc.fWidth = 256; | 181 desc.fWidth = 256; |
182 desc.fHeight = 256; | 182 desc.fHeight = 256; |
183 desc.fConfig = kRGBA_8888_GrPixelConfig; | 183 desc.fConfig = kRGBA_8888_GrPixelConfig; |
184 | 184 |
185 SkAutoTUnref<GrTexture> readTex(context->textureProvider()->createTexture(de
sc, true, NULL, 0)); | 185 SkAutoTUnref<GrTexture> readTex(context->textureProvider()->createTexture(de
sc, true, nullptr, 0)); |
186 if (!readTex.get()) { | 186 if (!readTex.get()) { |
187 return; | 187 return; |
188 } | 188 } |
189 SkAutoTUnref<GrTexture> tempTex(context->textureProvider()->createTexture(de
sc, true, NULL, 0)); | 189 SkAutoTUnref<GrTexture> tempTex(context->textureProvider()->createTexture(de
sc, true, nullptr, 0)); |
190 if (!tempTex.get()) { | 190 if (!tempTex.get()) { |
191 return; | 191 return; |
192 } | 192 } |
193 desc.fFlags = kNone_GrSurfaceFlags; | 193 desc.fFlags = kNone_GrSurfaceFlags; |
194 SkAutoTUnref<GrTexture> dataTex(context->textureProvider()->createTexture(de
sc, true, data, 0)); | 194 SkAutoTUnref<GrTexture> dataTex(context->textureProvider()->createTexture(de
sc, true, data, 0)); |
195 if (!dataTex.get()) { | 195 if (!dataTex.get()) { |
196 return; | 196 return; |
197 } | 197 } |
198 | 198 |
199 static const PMConversion kConversionRules[][2] = { | 199 static const PMConversion kConversionRules[][2] = { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 if (!swapRedAndBlue && kNone_PMConversion == pmConversion) { | 296 if (!swapRedAndBlue && kNone_PMConversion == pmConversion) { |
297 // If we returned a GrConfigConversionEffect that was equivalent to a Gr
SimpleTextureEffect | 297 // If we returned a GrConfigConversionEffect that was equivalent to a Gr
SimpleTextureEffect |
298 // then we may pollute our texture cache with redundant shaders. So in t
he case that no | 298 // then we may pollute our texture cache with redundant shaders. So in t
he case that no |
299 // conversions were requested we instead return a GrSimpleTextureEffect. | 299 // conversions were requested we instead return a GrSimpleTextureEffect. |
300 return GrSimpleTextureEffect::Create(procDataManager, texture, matrix); | 300 return GrSimpleTextureEffect::Create(procDataManager, texture, matrix); |
301 } else { | 301 } else { |
302 if (kRGBA_8888_GrPixelConfig != texture->config() && | 302 if (kRGBA_8888_GrPixelConfig != texture->config() && |
303 kBGRA_8888_GrPixelConfig != texture->config() && | 303 kBGRA_8888_GrPixelConfig != texture->config() && |
304 kNone_PMConversion != pmConversion) { | 304 kNone_PMConversion != pmConversion) { |
305 // The PM conversions assume colors are 0..255 | 305 // The PM conversions assume colors are 0..255 |
306 return NULL; | 306 return nullptr; |
307 } | 307 } |
308 return new GrConfigConversionEffect(procDataManager, texture, swapRedAnd
Blue, pmConversion, | 308 return new GrConfigConversionEffect(procDataManager, texture, swapRedAnd
Blue, pmConversion, |
309 matrix); | 309 matrix); |
310 } | 310 } |
311 } | 311 } |
OLD | NEW |