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

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

Issue 2296193005: Add a makeDrawContextWithFallback that handles config fallback (Closed)
Patch Set: update 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 | « src/gpu/GrTextureToYUVPlanes.cpp ('k') | 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « src/gpu/GrTextureToYUVPlanes.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698