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

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

Issue 196133014: Implement text rendering with NVPR (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove path drawing from the patch Created 6 years, 9 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
11 11
12 #include "effects/GrSingleTextureEffect.h" 12 #include "effects/GrSingleTextureEffect.h"
13 #include "effects/GrConfigConversionEffect.h" 13 #include "effects/GrConfigConversionEffect.h"
14 14
15 #include "GrAARectRenderer.h" 15 #include "GrAARectRenderer.h"
16 #include "GrBufferAllocPool.h" 16 #include "GrBufferAllocPool.h"
17 #include "GrDistanceFieldTextContext.h"
18 #include "GrDrawTargetCaps.h"
17 #include "GrGpu.h" 19 #include "GrGpu.h"
18 #include "GrDrawTargetCaps.h" 20 #include "GrInOrderDrawBuffer.h"
19 #include "GrIndexBuffer.h" 21 #include "GrIndexBuffer.h"
20 #include "GrInOrderDrawBuffer.h"
21 #include "GrOvalRenderer.h" 22 #include "GrOvalRenderer.h"
22 #include "GrPathRenderer.h" 23 #include "GrPathRenderer.h"
23 #include "GrPathUtils.h" 24 #include "GrPathUtils.h"
24 #include "GrResourceCache.h" 25 #include "GrResourceCache.h"
25 #include "GrSoftwarePathRenderer.h" 26 #include "GrSoftwarePathRenderer.h"
27 #include "GrStencilAndCoverTextContext.h"
26 #include "GrStencilBuffer.h" 28 #include "GrStencilBuffer.h"
27 #include "GrTextStrike.h" 29 #include "GrTextStrike.h"
30 #include "SkRRect.h"
28 #include "SkRTConf.h" 31 #include "SkRTConf.h"
29 #include "SkRRect.h"
30 #include "SkStrokeRec.h" 32 #include "SkStrokeRec.h"
33 #include "SkTLS.h"
31 #include "SkTLazy.h" 34 #include "SkTLazy.h"
32 #include "SkTLS.h"
33 #include "SkTrace.h" 35 #include "SkTrace.h"
34 36
35 // It can be useful to set this to false to test whether a bug is caused by usin g the 37 // It can be useful to set this to false to test whether a bug is caused by usin g the
36 // InOrderDrawBuffer, to compare performance of using/not using InOrderDrawBuffe r, or to make 38 // InOrderDrawBuffer, to compare performance of using/not using InOrderDrawBuffe r, or to make
37 // debugging simpler. 39 // debugging simpler.
38 SK_CONF_DECLARE(bool, c_Defer, "gpu.deferContext", true, 40 SK_CONF_DECLARE(bool, c_Defer, "gpu.deferContext", true,
39 "Defers rendering in GrContext via GrInOrderDrawBuffer."); 41 "Defers rendering in GrContext via GrInOrderDrawBuffer.");
40 42
41 #define BUFFERED_DRAW (c_Defer ? kYes_BufferedDraw : kNo_BufferedDraw) 43 #define BUFFERED_DRAW (c_Defer ? kYes_BufferedDraw : kNo_BufferedDraw)
42 44
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 219 }
218 220
219 size_t GrContext::getGpuTextureCacheBytes() const { 221 size_t GrContext::getGpuTextureCacheBytes() const {
220 return fTextureCache->getCachedResourceBytes(); 222 return fTextureCache->getCachedResourceBytes();
221 } 223 }
222 224
223 int GrContext::getGpuTextureCacheResourceCount() const { 225 int GrContext::getGpuTextureCacheResourceCount() const {
224 return fTextureCache->getCachedResourceCount(); 226 return fTextureCache->getCachedResourceCount();
225 } 227 }
226 228
229 GrTextContext* GrContext::createTextContext(GrRenderTarget* renderTarget,
230 const SkDeviceProperties&
231 leakyProperties) {
232 if (fGpu->caps()->pathRenderingSupport()) {
233 if (renderTarget->getStencilBuffer() && renderTarget->isMultisampled()) {
234 return SkNEW_ARGS(GrStencilAndCoverTextContext, (this, leakyProperti es));
235 }
236 }
237 return SkNEW_ARGS(GrDistanceFieldTextContext, (this, leakyProperties));
238 }
239
227 //////////////////////////////////////////////////////////////////////////////// 240 ////////////////////////////////////////////////////////////////////////////////
228 241
229 GrTexture* GrContext::findAndRefTexture(const GrTextureDesc& desc, 242 GrTexture* GrContext::findAndRefTexture(const GrTextureDesc& desc,
230 const GrCacheID& cacheID, 243 const GrCacheID& cacheID,
231 const GrTextureParams* params) { 244 const GrTextureParams* params) {
232 GrResourceKey resourceKey = GrTexture::ComputeKey(fGpu, params, desc, cacheI D); 245 GrResourceKey resourceKey = GrTexture::ComputeKey(fGpu, params, desc, cacheI D);
233 GrResource* resource = fTextureCache->find(resourceKey); 246 GrResource* resource = fTextureCache->find(resourceKey);
234 SkSafeRef(resource); 247 SkSafeRef(resource);
235 return static_cast<GrTexture*>(resource); 248 return static_cast<GrTexture*>(resource);
236 } 249 }
(...skipping 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 } 1823 }
1811 return path; 1824 return path;
1812 } 1825 }
1813 1826
1814 /////////////////////////////////////////////////////////////////////////////// 1827 ///////////////////////////////////////////////////////////////////////////////
1815 #if GR_CACHE_STATS 1828 #if GR_CACHE_STATS
1816 void GrContext::printCacheStats() const { 1829 void GrContext::printCacheStats() const {
1817 fTextureCache->printStats(); 1830 fTextureCache->printStats();
1818 } 1831 }
1819 #endif 1832 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698