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 "GrInvariantOutput.h" | 10 #include "GrInvariantOutput.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 color[0] = SkTMin(x, y); | 179 color[0] = SkTMin(x, y); |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
183 GrSurfaceDesc desc; | 183 GrSurfaceDesc desc; |
184 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 184 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
185 desc.fWidth = 256; | 185 desc.fWidth = 256; |
186 desc.fHeight = 256; | 186 desc.fHeight = 256; |
187 desc.fConfig = kRGBA_8888_GrPixelConfig; | 187 desc.fConfig = kRGBA_8888_GrPixelConfig; |
188 | 188 |
189 SkAutoTUnref<GrTexture> readTex(context->createTexture(desc, true, NULL, 0))
; | 189 SkAutoTUnref<GrTexture> readTex(context->textureProvider()->createTexture(de
sc, true, NULL, 0)); |
190 if (!readTex.get()) { | 190 if (!readTex.get()) { |
191 return; | 191 return; |
192 } | 192 } |
193 SkAutoTUnref<GrTexture> tempTex(context->createTexture(desc, true, NULL, 0))
; | 193 SkAutoTUnref<GrTexture> tempTex(context->textureProvider()->createTexture(de
sc, true, NULL, 0)); |
194 if (!tempTex.get()) { | 194 if (!tempTex.get()) { |
195 return; | 195 return; |
196 } | 196 } |
197 desc.fFlags = kNone_GrSurfaceFlags; | 197 desc.fFlags = kNone_GrSurfaceFlags; |
198 SkAutoTUnref<GrTexture> dataTex(context->createTexture(desc, true, data, 0))
; | 198 SkAutoTUnref<GrTexture> dataTex(context->textureProvider()->createTexture(de
sc, true, data, 0)); |
199 if (!dataTex.get()) { | 199 if (!dataTex.get()) { |
200 return; | 200 return; |
201 } | 201 } |
202 | 202 |
203 static const PMConversion kConversionRules[][2] = { | 203 static const PMConversion kConversionRules[][2] = { |
204 {kDivByAlpha_RoundDown_PMConversion, kMulByAlpha_RoundUp_PMConversion}, | 204 {kDivByAlpha_RoundDown_PMConversion, kMulByAlpha_RoundUp_PMConversion}, |
205 {kDivByAlpha_RoundUp_PMConversion, kMulByAlpha_RoundDown_PMConversion}, | 205 {kDivByAlpha_RoundUp_PMConversion, kMulByAlpha_RoundDown_PMConversion}, |
206 }; | 206 }; |
207 | 207 |
208 bool failed = true; | 208 bool failed = true; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 kNone_PMConversion != pmConversion) { | 289 kNone_PMConversion != pmConversion) { |
290 // The PM conversions assume colors are 0..255 | 290 // The PM conversions assume colors are 0..255 |
291 return NULL; | 291 return NULL; |
292 } | 292 } |
293 return SkNEW_ARGS(GrConfigConversionEffect, (texture, | 293 return SkNEW_ARGS(GrConfigConversionEffect, (texture, |
294 swapRedAndBlue, | 294 swapRedAndBlue, |
295 pmConversion, | 295 pmConversion, |
296 matrix)); | 296 matrix)); |
297 } | 297 } |
298 } | 298 } |
OLD | NEW |