OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
9 | 9 |
10 #include "GrBlurUtils.h" | 10 #include "GrBlurUtils.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 origInfo.width() < 0 || origInfo.height() < 0) { | 206 origInfo.width() < 0 || origInfo.height() < 0) { |
207 return nullptr; | 207 return nullptr; |
208 } | 208 } |
209 | 209 |
210 if (!context) { | 210 if (!context) { |
211 return nullptr; | 211 return nullptr; |
212 } | 212 } |
213 | 213 |
214 SkColorType ct = origInfo.colorType(); | 214 SkColorType ct = origInfo.colorType(); |
215 SkAlphaType at = origInfo.alphaType(); | 215 SkAlphaType at = origInfo.alphaType(); |
216 SkColorProfileType pt = origInfo.profileType(); | 216 SkColorSpace* cs = origInfo.colorSpace(); |
217 if (kRGB_565_SkColorType == ct || kGray_8_SkColorType == ct) { | 217 if (kRGB_565_SkColorType == ct || kGray_8_SkColorType == ct) { |
218 at = kOpaque_SkAlphaType; // force this setting | 218 at = kOpaque_SkAlphaType; // force this setting |
219 } | 219 } |
220 if (kOpaque_SkAlphaType != at) { | 220 if (kOpaque_SkAlphaType != at) { |
221 at = kPremul_SkAlphaType; // force this setting | 221 at = kPremul_SkAlphaType; // force this setting |
222 } | 222 } |
223 | 223 |
224 GrPixelConfig origConfig = SkImageInfo2GrPixelConfig(ct, at, pt, *context->c
aps()); | 224 GrPixelConfig origConfig = SkImageInfo2GrPixelConfig(ct, at, cs, *context->c
aps()); |
225 if (!context->caps()->isConfigRenderable(origConfig, sampleCount > 0)) { | 225 if (!context->caps()->isConfigRenderable(origConfig, sampleCount > 0)) { |
226 // Fall back from whatever ct was to default of kRGBA or kBGRA which is
aliased as kN32 | 226 // Fall back from whatever ct was to default of kRGBA or kBGRA which is
aliased as kN32 |
227 ct = kN32_SkColorType; | 227 ct = kN32_SkColorType; |
228 } | 228 } |
229 | 229 |
230 GrPixelConfig config = SkImageInfo2GrPixelConfig(ct, at, pt, *context->caps(
)); | 230 GrPixelConfig config = SkImageInfo2GrPixelConfig(ct, at, cs, *context->caps(
)); |
231 | 231 |
232 return context->newDrawContext(SkBackingFit::kExact, // Why ex
act? | 232 return context->newDrawContext(SkBackingFit::kExact, // Why ex
act? |
233 origInfo.width(), origInfo.height(), | 233 origInfo.width(), origInfo.height(), |
234 config, sampleCount, | 234 config, sampleCount, |
235 kDefault_GrSurfaceOrigin, surfaceProps, budge
ted); | 235 kDefault_GrSurfaceOrigin, surfaceProps, budge
ted); |
236 | 236 |
237 } | 237 } |
238 | 238 |
239 // This method ensures that we always have a texture-backed "bitmap" when we fin
ally | 239 // This method ensures that we always have a texture-backed "bitmap" when we fin
ally |
240 // call through to the base impl so that the image filtering code will take the | 240 // call through to the base impl so that the image filtering code will take the |
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1926 } | 1926 } |
1927 | 1927 |
1928 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { | 1928 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { |
1929 ASSERT_SINGLE_OWNER | 1929 ASSERT_SINGLE_OWNER |
1930 // We always return a transient cache, so it is freed after each | 1930 // We always return a transient cache, so it is freed after each |
1931 // filter traversal. | 1931 // filter traversal. |
1932 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); | 1932 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); |
1933 } | 1933 } |
1934 | 1934 |
1935 #endif | 1935 #endif |
OLD | NEW |