| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 SkAlphaType at = origInfo.alphaType(); | 165 SkAlphaType at = origInfo.alphaType(); |
| 166 SkColorSpace* cs = origInfo.colorSpace(); | 166 SkColorSpace* cs = origInfo.colorSpace(); |
| 167 if (kRGB_565_SkColorType == ct || kGray_8_SkColorType == ct) { | 167 if (kRGB_565_SkColorType == ct || kGray_8_SkColorType == ct) { |
| 168 at = kOpaque_SkAlphaType; // force this setting | 168 at = kOpaque_SkAlphaType; // force this setting |
| 169 } | 169 } |
| 170 if (kOpaque_SkAlphaType != at) { | 170 if (kOpaque_SkAlphaType != at) { |
| 171 at = kPremul_SkAlphaType; // force this setting | 171 at = kPremul_SkAlphaType; // force this setting |
| 172 } | 172 } |
| 173 | 173 |
| 174 GrPixelConfig config = SkImageInfo2GrPixelConfig(ct, at, cs, *context->caps(
)); | 174 GrPixelConfig config = SkImageInfo2GrPixelConfig(ct, at, cs, *context->caps(
)); |
| 175 if (!context->caps()->isConfigRenderable(config, sampleCount > 0)) { | |
| 176 return nullptr; | |
| 177 } | |
| 178 | 175 |
| 179 return context->makeDrawContext(SkBackingFit::kExact, // Why e
xact? | 176 return context->makeDrawContext(SkBackingFit::kExact, // Why e
xact? |
| 180 origInfo.width(), origInfo.height(), | 177 origInfo.width(), origInfo.height(), |
| 181 config, sk_ref_sp(cs), sampleCount, | 178 config, sk_ref_sp(cs), sampleCount, |
| 182 origin, surfaceProps, budgeted); | 179 origin, surfaceProps, budgeted); |
| 183 } | 180 } |
| 184 | 181 |
| 185 sk_sp<SkSpecialImage> SkGpuDevice::filterTexture(const SkDraw& draw, | 182 sk_sp<SkSpecialImage> SkGpuDevice::filterTexture(const SkDraw& draw, |
| 186 SkSpecialImage* srcImg, | 183 SkSpecialImage* srcImg, |
| 187 int left, int top, | 184 int left, int top, |
| (...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 } | 1794 } |
| 1798 | 1795 |
| 1799 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { | 1796 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { |
| 1800 ASSERT_SINGLE_OWNER | 1797 ASSERT_SINGLE_OWNER |
| 1801 // We always return a transient cache, so it is freed after each | 1798 // We always return a transient cache, so it is freed after each |
| 1802 // filter traversal. | 1799 // filter traversal. |
| 1803 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); | 1800 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); |
| 1804 } | 1801 } |
| 1805 | 1802 |
| 1806 #endif | 1803 #endif |
| OLD | NEW |