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

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

Issue 2186073002: Rename GrContext's newDrawContext & drawContext to makeDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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/GrYUVProvider.cpp ('k') | src/gpu/effects/GrConfigConversionEffect.cpp » ('j') | 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 unsigned flags; 97 unsigned flags;
98 if (!CheckAlphaTypeAndGetFlags(nullptr, init, &flags)) { 98 if (!CheckAlphaTypeAndGetFlags(nullptr, init, &flags)) {
99 return nullptr; 99 return nullptr;
100 } 100 }
101 101
102 const int width = rt->width(); 102 const int width = rt->width();
103 const int height = rt->height(); 103 const int height = rt->height();
104 104
105 GrContext* context = rt->getContext(); 105 GrContext* context = rt->getContext();
106 106
107 sk_sp<GrDrawContext> drawContext(context->drawContext(std::move(rt), std::mo ve(colorSpace), 107 sk_sp<GrDrawContext> drawContext(context->makeDrawContext(std::move(rt), std ::move(colorSpace),
108 props)); 108 props));
109 return sk_sp<SkGpuDevice>(new SkGpuDevice(std::move(drawContext), width, hei ght, flags)); 109 return sk_sp<SkGpuDevice>(new SkGpuDevice(std::move(drawContext), width, hei ght, flags));
110 } 110 }
111 111
112 sk_sp<SkBaseDevice> SkGpuDevice::Make(sk_sp<GrDrawContext> drawContext, 112 sk_sp<SkBaseDevice> SkGpuDevice::Make(sk_sp<GrDrawContext> drawContext,
113 int width, int height, 113 int width, int height,
114 InitContents init) { 114 InitContents init) {
115 if (!drawContext || drawContext->wasAbandoned()) { 115 if (!drawContext || drawContext->wasAbandoned()) {
116 return nullptr; 116 return nullptr;
117 } 117 }
118 unsigned flags; 118 unsigned flags;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 180 }
181 181
182 GrPixelConfig origConfig = SkImageInfo2GrPixelConfig(ct, at, cs, *context->c aps()); 182 GrPixelConfig origConfig = SkImageInfo2GrPixelConfig(ct, at, cs, *context->c aps());
183 if (!context->caps()->isConfigRenderable(origConfig, sampleCount > 0)) { 183 if (!context->caps()->isConfigRenderable(origConfig, sampleCount > 0)) {
184 // Fall back from whatever ct was to default of kRGBA or kBGRA which is aliased as kN32 184 // Fall back from whatever ct was to default of kRGBA or kBGRA which is aliased as kN32
185 ct = kN32_SkColorType; 185 ct = kN32_SkColorType;
186 } 186 }
187 187
188 GrPixelConfig config = SkImageInfo2GrPixelConfig(ct, at, cs, *context->caps( )); 188 GrPixelConfig config = SkImageInfo2GrPixelConfig(ct, at, cs, *context->caps( ));
189 189
190 return context->newDrawContext(SkBackingFit::kExact, // Why ex act? 190 return context->makeDrawContext(SkBackingFit::kExact, // Why e xact?
191 origInfo.width(), origInfo.height(), 191 origInfo.width(), origInfo.height(),
192 config, sk_ref_sp(cs), sampleCount, 192 config, sk_ref_sp(cs), sampleCount,
193 origin, surfaceProps, budgeted); 193 origin, surfaceProps, budgeted);
194 } 194 }
195 195
196 sk_sp<SkSpecialImage> SkGpuDevice::filterTexture(const SkDraw& draw, 196 sk_sp<SkSpecialImage> SkGpuDevice::filterTexture(const SkDraw& draw,
197 SkSpecialImage* srcImg, 197 SkSpecialImage* srcImg,
198 int left, int top, 198 int left, int top,
199 SkIPoint* offset, 199 SkIPoint* offset,
200 const SkImageFilter* filter) { 200 const SkImageFilter* filter) {
201 SkASSERT(srcImg->isTextureBacked()); 201 SkASSERT(srcImg->isTextureBacked());
202 SkASSERT(filter); 202 SkASSERT(filter);
203 203
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 SkBaseDevice* SkGpuDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint *) { 1738 SkBaseDevice* SkGpuDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint *) {
1739 ASSERT_SINGLE_OWNER 1739 ASSERT_SINGLE_OWNER
1740 1740
1741 SkSurfaceProps props(this->surfaceProps().flags(), cinfo.fPixelGeometry); 1741 SkSurfaceProps props(this->surfaceProps().flags(), cinfo.fPixelGeometry);
1742 1742
1743 // layers are never drawn in repeat modes, so we can request an approx 1743 // layers are never drawn in repeat modes, so we can request an approx
1744 // match and ignore any padding. 1744 // match and ignore any padding.
1745 SkBackingFit fit = kNever_TileUsage == cinfo.fTileUsage ? SkBackingFit::kApp rox 1745 SkBackingFit fit = kNever_TileUsage == cinfo.fTileUsage ? SkBackingFit::kApp rox
1746 : SkBackingFit::kExa ct; 1746 : SkBackingFit::kExa ct;
1747 1747
1748 sk_sp<GrDrawContext> dc(fContext->newDrawContext(fit, 1748 sk_sp<GrDrawContext> dc(fContext->makeDrawContext(fit,
1749 cinfo.fInfo.width(), cinfo. fInfo.height(), 1749 cinfo.fInfo.width(), cinfo .fInfo.height(),
1750 fDrawContext->config(), 1750 fDrawContext->config(),
1751 sk_ref_sp(fDrawContext->get ColorSpace()), 1751 sk_ref_sp(fDrawContext->ge tColorSpace()),
1752 fDrawContext->desc().fSampl eCnt, 1752 fDrawContext->desc().fSamp leCnt,
1753 kDefault_GrSurfaceOrigin, 1753 kDefault_GrSurfaceOrigin,
1754 &props)); 1754 &props));
1755 if (!dc) { 1755 if (!dc) {
1756 SkErrorInternals::SetError( kInternalError_SkError, 1756 SkErrorInternals::SetError( kInternalError_SkError,
1757 "---- failed to create gpu device texture [% d %d]\n", 1757 "---- failed to create gpu device texture [% d %d]\n",
1758 cinfo.fInfo.width(), cinfo.fInfo.height()); 1758 cinfo.fInfo.width(), cinfo.fInfo.height());
1759 return nullptr; 1759 return nullptr;
1760 } 1760 }
1761 1761
1762 // Skia's convention is to only clear a device if it is non-opaque. 1762 // Skia's convention is to only clear a device if it is non-opaque.
1763 InitContents init = cinfo.fInfo.isOpaque() ? kUninit_InitContents : kClear_I nitContents; 1763 InitContents init = cinfo.fInfo.isOpaque() ? kUninit_InitContents : kClear_I nitContents;
1764 1764
(...skipping 11 matching lines...) Expand all
1776 } 1776 }
1777 1777
1778 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { 1778 SkImageFilterCache* SkGpuDevice::getImageFilterCache() {
1779 ASSERT_SINGLE_OWNER 1779 ASSERT_SINGLE_OWNER
1780 // We always return a transient cache, so it is freed after each 1780 // We always return a transient cache, so it is freed after each
1781 // filter traversal. 1781 // filter traversal.
1782 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); 1782 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize);
1783 } 1783 }
1784 1784
1785 #endif 1785 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrYUVProvider.cpp ('k') | src/gpu/effects/GrConfigConversionEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698