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

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

Issue 522733003: Make SkGrPixelRef responsible for owning GrSurface's texture rather than RT. (Closed) Base URL: https://skia.googlesource.com/skia.git@cfg
Patch Set: 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 | « no previous file | src/gpu/SkGrPixelRef.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 "effects/GrBicubicEffect.h" 10 #include "effects/GrBicubicEffect.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 SkGpuDevice::SkGpuDevice(GrSurface* surface, unsigned flags) { 143 SkGpuDevice::SkGpuDevice(GrSurface* surface, unsigned flags) {
144 144
145 fDrawProcs = NULL; 145 fDrawProcs = NULL;
146 146
147 fContext = SkRef(surface->getContext()); 147 fContext = SkRef(surface->getContext());
148 148
149 fNeedClear = flags & kNeedClear_Flag; 149 fNeedClear = flags & kNeedClear_Flag;
150 150
151 fRenderTarget = SkRef(surface->asRenderTarget()); 151 fRenderTarget = SkRef(surface->asRenderTarget());
152 152
153 // Hold onto to the texture in the pixel ref (if there is one) because the t exture holds a ref
154 // on the RT but not vice-versa.
155 // TODO: Remove this trickery once we figure out how to make SkGrPixelRef do this without
156 // busting chrome (for a currently unknown reason).
157 surface = fRenderTarget->asTexture();
158 if (NULL == surface) {
159 surface = fRenderTarget;
160 }
161
162 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, 153 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef,
163 (surface->info(), surface, SkToBool(flags & kCac hed_Flag))); 154 (surface->info(), surface, SkToBool(flags & kCac hed_Flag)));
164 fLegacyBitmap.setInfo(surface->info()); 155 fLegacyBitmap.setInfo(surface->info());
165 fLegacyBitmap.setPixelRef(pr)->unref(); 156 fLegacyBitmap.setPixelRef(pr)->unref();
166 157
167 bool useDFFonts = !!(flags & kDFFonts_Flag); 158 bool useDFFonts = !!(flags & kDFFonts_Flag);
168 fMainTextContext = fContext->createTextContext(fRenderTarget, fLeakyProperti es, useDFFonts); 159 fMainTextContext = fContext->createTextContext(fRenderTarget, fLeakyProperti es, useDFFonts);
169 fFallbackTextContext = SkNEW_ARGS(GrBitmapTextContext, (fContext, fLeakyProp erties)); 160 fFallbackTextContext = SkNEW_ARGS(GrBitmapTextContext, (fContext, fLeakyProp erties));
170 } 161 }
171 162
(...skipping 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after
2149 2140
2150 fContext->getLayerCache()->purgeAll(); 2141 fContext->getLayerCache()->purgeAll();
2151 #endif 2142 #endif
2152 } 2143 }
2153 2144
2154 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 2145 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
2155 // We always return a transient cache, so it is freed after each 2146 // We always return a transient cache, so it is freed after each
2156 // filter traversal. 2147 // filter traversal.
2157 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 2148 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
2158 } 2149 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/SkGrPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698