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

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

Issue 578563002: Remove createPath* from GrGpu and GrContext (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_glyphmemorypath
Patch Set: Simple quick change Created 6 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 | « include/gpu/GrContext.h ('k') | src/gpu/GrGpu.h » ('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 /* 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"
(...skipping 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 } 1903 }
1904 GrConfigConversionEffect::PMConversion upmToPM = 1904 GrConfigConversionEffect::PMConversion upmToPM =
1905 static_cast<GrConfigConversionEffect::PMConversion>(fUPMToPMConversion); 1905 static_cast<GrConfigConversionEffect::PMConversion>(fUPMToPMConversion);
1906 if (GrConfigConversionEffect::kNone_PMConversion != upmToPM) { 1906 if (GrConfigConversionEffect::kNone_PMConversion != upmToPM) {
1907 return GrConfigConversionEffect::Create(texture, swapRAndB, upmToPM, mat rix); 1907 return GrConfigConversionEffect::Create(texture, swapRAndB, upmToPM, mat rix);
1908 } else { 1908 } else {
1909 return NULL; 1909 return NULL;
1910 } 1910 }
1911 } 1911 }
1912 1912
1913 GrPath* GrContext::createPath(const SkPath& inPath, const SkStrokeRec& stroke) {
1914 SkASSERT(fGpu->caps()->pathRenderingSupport());
1915
1916 // TODO: now we add to fResourceCache. This should change to fResourceCache.
1917 GrResourceKey resourceKey = GrPath::ComputeKey(inPath, stroke);
1918 GrPath* path = static_cast<GrPath*>(fResourceCache->find(resourceKey));
1919 if (path && path->isEqualTo(inPath, stroke)) {
1920 path->ref();
1921 } else {
1922 path = fGpu->createPath(inPath, stroke);
1923 fResourceCache->purgeAsNeeded(1, path->gpuMemorySize());
1924 fResourceCache->addResource(resourceKey, path);
1925 }
1926 return path;
1927 }
1928
1929 void GrContext::addResourceToCache(const GrResourceKey& resourceKey, GrGpuResour ce* resource) { 1913 void GrContext::addResourceToCache(const GrResourceKey& resourceKey, GrGpuResour ce* resource) {
1930 fResourceCache->purgeAsNeeded(1, resource->gpuMemorySize()); 1914 fResourceCache->purgeAsNeeded(1, resource->gpuMemorySize());
1931 fResourceCache->addResource(resourceKey, resource); 1915 fResourceCache->addResource(resourceKey, resource);
1932 } 1916 }
1933 1917
1934 GrGpuResource* GrContext::findAndRefCachedResource(const GrResourceKey& resource Key) { 1918 GrGpuResource* GrContext::findAndRefCachedResource(const GrResourceKey& resource Key) {
1935 GrGpuResource* resource = fResourceCache->find(resourceKey); 1919 GrGpuResource* resource = fResourceCache->find(resourceKey);
1936 SkSafeRef(resource); 1920 SkSafeRef(resource);
1937 return resource; 1921 return resource;
1938 } 1922 }
(...skipping 11 matching lines...) Expand all
1950 fDrawBuffer->removeGpuTraceMarker(marker); 1934 fDrawBuffer->removeGpuTraceMarker(marker);
1951 } 1935 }
1952 } 1936 }
1953 1937
1954 /////////////////////////////////////////////////////////////////////////////// 1938 ///////////////////////////////////////////////////////////////////////////////
1955 #if GR_CACHE_STATS 1939 #if GR_CACHE_STATS
1956 void GrContext::printCacheStats() const { 1940 void GrContext::printCacheStats() const {
1957 fResourceCache->printStats(); 1941 fResourceCache->printStats();
1958 } 1942 }
1959 #endif 1943 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698