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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 color[0] = SkTMin(x, y); | 169 color[0] = SkTMin(x, y); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 GrSurfaceDesc desc; | 173 GrSurfaceDesc desc; |
174 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 174 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
175 desc.fWidth = 256; | 175 desc.fWidth = 256; |
176 desc.fHeight = 256; | 176 desc.fHeight = 256; |
177 desc.fConfig = kRGBA_8888_GrPixelConfig; | 177 desc.fConfig = kRGBA_8888_GrPixelConfig; |
178 | 178 |
179 SkAutoTUnref<GrTexture> readTex(context->textureProvider()->createTexture(de
sc, true, nullptr, 0)); | 179 SkAutoTUnref<GrTexture> readTex(context->textureProvider()->createTexture( |
| 180 desc, SkBudgeted::kYes, nullptr, 0)); |
180 if (!readTex.get()) { | 181 if (!readTex.get()) { |
181 return; | 182 return; |
182 } | 183 } |
183 SkAutoTUnref<GrTexture> tempTex(context->textureProvider()->createTexture(de
sc, true, nullptr, 0)); | 184 SkAutoTUnref<GrTexture> tempTex(context->textureProvider()->createTexture( |
| 185 desc, SkBudgeted::kYes, nullptr, 0)); |
184 if (!tempTex.get()) { | 186 if (!tempTex.get()) { |
185 return; | 187 return; |
186 } | 188 } |
187 desc.fFlags = kNone_GrSurfaceFlags; | 189 desc.fFlags = kNone_GrSurfaceFlags; |
188 SkAutoTUnref<GrTexture> dataTex(context->textureProvider()->createTexture(de
sc, true, data, 0)); | 190 SkAutoTUnref<GrTexture> dataTex(context->textureProvider()->createTexture( |
| 191 desc, SkBudgeted::kYes, data, 0)); |
189 if (!dataTex.get()) { | 192 if (!dataTex.get()) { |
190 return; | 193 return; |
191 } | 194 } |
192 | 195 |
193 static const PMConversion kConversionRules[][2] = { | 196 static const PMConversion kConversionRules[][2] = { |
194 {kDivByAlpha_RoundDown_PMConversion, kMulByAlpha_RoundUp_PMConversion}, | 197 {kDivByAlpha_RoundDown_PMConversion, kMulByAlpha_RoundUp_PMConversion}, |
195 {kDivByAlpha_RoundUp_PMConversion, kMulByAlpha_RoundDown_PMConversion}, | 198 {kDivByAlpha_RoundUp_PMConversion, kMulByAlpha_RoundDown_PMConversion}, |
196 }; | 199 }; |
197 | 200 |
198 bool failed = true; | 201 bool failed = true; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } else { | 299 } else { |
297 if (kRGBA_8888_GrPixelConfig != texture->config() && | 300 if (kRGBA_8888_GrPixelConfig != texture->config() && |
298 kBGRA_8888_GrPixelConfig != texture->config() && | 301 kBGRA_8888_GrPixelConfig != texture->config() && |
299 kNone_PMConversion != pmConversion) { | 302 kNone_PMConversion != pmConversion) { |
300 // The PM conversions assume colors are 0..255 | 303 // The PM conversions assume colors are 0..255 |
301 return nullptr; | 304 return nullptr; |
302 } | 305 } |
303 return new GrConfigConversionEffect(texture, swizzle, pmConversion, matr
ix); | 306 return new GrConfigConversionEffect(texture, swizzle, pmConversion, matr
ix); |
304 } | 307 } |
305 } | 308 } |
OLD | NEW |