Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 2272423004: Remove pixel config fallback - failing is a better option. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 SkColorType ct = origInfo.colorType(); 164 SkColorType ct = origInfo.colorType();
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 origConfig = SkImageInfo2GrPixelConfig(ct, at, cs, *context->c aps()); 174 GrPixelConfig config = SkImageInfo2GrPixelConfig(ct, at, cs, *context->caps( ));
175 if (!context->caps()->isConfigRenderable(origConfig, sampleCount > 0)) { 175 if (!context->caps()->isConfigRenderable(config, sampleCount > 0)) {
176 // Fall back from whatever ct was to default of kRGBA or kBGRA which is aliased as kN32 176 return nullptr;
177 ct = kN32_SkColorType;
178 } 177 }
179 178
180 GrPixelConfig config = SkImageInfo2GrPixelConfig(ct, at, cs, *context->caps( ));
181
182 return context->makeDrawContext(SkBackingFit::kExact, // Why e xact? 179 return context->makeDrawContext(SkBackingFit::kExact, // Why e xact?
183 origInfo.width(), origInfo.height(), 180 origInfo.width(), origInfo.height(),
184 config, sk_ref_sp(cs), sampleCount, 181 config, sk_ref_sp(cs), sampleCount,
185 origin, surfaceProps, budgeted); 182 origin, surfaceProps, budgeted);
186 } 183 }
187 184
188 sk_sp<SkSpecialImage> SkGpuDevice::filterTexture(const SkDraw& draw, 185 sk_sp<SkSpecialImage> SkGpuDevice::filterTexture(const SkDraw& draw,
189 SkSpecialImage* srcImg, 186 SkSpecialImage* srcImg,
190 int left, int top, 187 int left, int top,
191 SkIPoint* offset, 188 SkIPoint* offset,
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after
1807 } 1804 }
1808 1805
1809 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { 1806 SkImageFilterCache* SkGpuDevice::getImageFilterCache() {
1810 ASSERT_SINGLE_OWNER 1807 ASSERT_SINGLE_OWNER
1811 // We always return a transient cache, so it is freed after each 1808 // We always return a transient cache, so it is freed after each
1812 // filter traversal. 1809 // filter traversal.
1813 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); 1810 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize);
1814 } 1811 }
1815 1812
1816 #endif 1813 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698