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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 origInfo.width() < 0 || origInfo.height() < 0) { | 186 origInfo.width() < 0 || origInfo.height() < 0) { |
187 return nullptr; | 187 return nullptr; |
188 } | 188 } |
189 | 189 |
190 if (!context) { | 190 if (!context) { |
191 return nullptr; | 191 return nullptr; |
192 } | 192 } |
193 | 193 |
194 SkColorType ct = origInfo.colorType(); | 194 SkColorType ct = origInfo.colorType(); |
195 SkAlphaType at = origInfo.alphaType(); | 195 SkAlphaType at = origInfo.alphaType(); |
| 196 SkColorProfileType pt = origInfo.profileType(); |
196 if (kRGB_565_SkColorType == ct) { | 197 if (kRGB_565_SkColorType == ct) { |
197 at = kOpaque_SkAlphaType; // force this setting | 198 at = kOpaque_SkAlphaType; // force this setting |
198 } else if (ct != kBGRA_8888_SkColorType && ct != kRGBA_8888_SkColorType) { | 199 } else if (ct != kBGRA_8888_SkColorType && ct != kRGBA_8888_SkColorType) { |
199 // Fall back from whatever ct was to default of kRGBA or kBGRA which is
aliased as kN32 | 200 // Fall back from whatever ct was to default of kRGBA or kBGRA which is
aliased as kN32 |
200 ct = kN32_SkColorType; | 201 ct = kN32_SkColorType; |
201 } | 202 } |
202 if (kOpaque_SkAlphaType != at) { | 203 if (kOpaque_SkAlphaType != at) { |
203 at = kPremul_SkAlphaType; // force this setting | 204 at = kPremul_SkAlphaType; // force this setting |
204 } | 205 } |
205 const SkImageInfo info = SkImageInfo::Make(origInfo.width(), origInfo.height
(), ct, at); | 206 const SkImageInfo info = SkImageInfo::Make(origInfo.width(), origInfo.height
(), ct, at, pt); |
206 | 207 |
207 GrSurfaceDesc desc; | 208 GrSurfaceDesc desc; |
208 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 209 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
209 desc.fWidth = info.width(); | 210 desc.fWidth = info.width(); |
210 desc.fHeight = info.height(); | 211 desc.fHeight = info.height(); |
211 desc.fConfig = SkImageInfo2GrPixelConfig(info); | 212 desc.fConfig = SkImageInfo2GrPixelConfig(info); |
212 desc.fSampleCnt = sampleCount; | 213 desc.fSampleCnt = sampleCount; |
213 desc.fTextureStorageAllocator = textureStorageAllocator; | 214 desc.fTextureStorageAllocator = textureStorageAllocator; |
214 desc.fIsMipMapped = false; | 215 desc.fIsMipMapped = false; |
215 GrTexture* texture = context->textureProvider()->createTexture(desc, budgete
d, nullptr, 0); | 216 GrTexture* texture = context->textureProvider()->createTexture(desc, budgete
d, nullptr, 0); |
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 } | 1879 } |
1879 | 1880 |
1880 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1881 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
1881 ASSERT_SINGLE_OWNER | 1882 ASSERT_SINGLE_OWNER |
1882 // We always return a transient cache, so it is freed after each | 1883 // We always return a transient cache, so it is freed after each |
1883 // filter traversal. | 1884 // filter traversal. |
1884 return SkGpuDevice::NewImageFilterCache(); | 1885 return SkGpuDevice::NewImageFilterCache(); |
1885 } | 1886 } |
1886 | 1887 |
1887 #endif | 1888 #endif |
OLD | NEW |