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