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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 for (int x = 0; x < 256; ++x) { | 174 for (int x = 0; x < 256; ++x) { |
175 uint8_t* color = reinterpret_cast<uint8_t*>(&srcData[256*y + x]); | 175 uint8_t* color = reinterpret_cast<uint8_t*>(&srcData[256*y + x]); |
176 color[3] = y; | 176 color[3] = y; |
177 color[2] = SkTMin(x, y); | 177 color[2] = SkTMin(x, y); |
178 color[1] = SkTMin(x, y); | 178 color[1] = SkTMin(x, y); |
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 kNoStencil_GrSurfaceFlag; | |
186 desc.fWidth = 256; | 185 desc.fWidth = 256; |
187 desc.fHeight = 256; | 186 desc.fHeight = 256; |
188 desc.fConfig = kRGBA_8888_GrPixelConfig; | 187 desc.fConfig = kRGBA_8888_GrPixelConfig; |
189 | 188 |
190 SkAutoTUnref<GrTexture> readTex(context->createTexture(desc, true, NULL, 0))
; | 189 SkAutoTUnref<GrTexture> readTex(context->createTexture(desc, true, NULL, 0))
; |
191 if (!readTex.get()) { | 190 if (!readTex.get()) { |
192 return; | 191 return; |
193 } | 192 } |
194 SkAutoTUnref<GrTexture> tempTex(context->createTexture(desc, true, NULL, 0))
; | 193 SkAutoTUnref<GrTexture> tempTex(context->createTexture(desc, true, NULL, 0))
; |
195 if (!tempTex.get()) { | 194 if (!tempTex.get()) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 kNone_PMConversion != pmConversion) { | 279 kNone_PMConversion != pmConversion) { |
281 // The PM conversions assume colors are 0..255 | 280 // The PM conversions assume colors are 0..255 |
282 return NULL; | 281 return NULL; |
283 } | 282 } |
284 return SkNEW_ARGS(GrConfigConversionEffect, (texture, | 283 return SkNEW_ARGS(GrConfigConversionEffect, (texture, |
285 swapRedAndBlue, | 284 swapRedAndBlue, |
286 pmConversion, | 285 pmConversion, |
287 matrix)); | 286 matrix)); |
288 } | 287 } |
289 } | 288 } |
OLD | NEW |