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

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

Issue 2298003003: Don't purge resources for trivial GrContext flushes (Closed)
Patch Set: Fix speeling 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 | « no previous file | src/gpu/GrDrawTarget.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 * 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 "GrContext.h" 8 #include "GrContext.h"
9 #include "GrContextPriv.h" 9 #include "GrContextPriv.h"
10 #include "GrContextOptions.h" 10 #include "GrContextOptions.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // drawPath on SkGpuDevice 221 // drawPath on SkGpuDevice
222 GrContext* context = reinterpret_cast<GrContext*>(data); 222 GrContext* context = reinterpret_cast<GrContext*>(data);
223 context->flush(); 223 context->flush();
224 } 224 }
225 225
226 //////////////////////////////////////////////////////////////////////////////// 226 ////////////////////////////////////////////////////////////////////////////////
227 227
228 void GrContext::flush(int flagsBitfield) { 228 void GrContext::flush(int flagsBitfield) {
229 ASSERT_SINGLE_OWNER 229 ASSERT_SINGLE_OWNER
230 RETURN_IF_ABANDONED 230 RETURN_IF_ABANDONED
231 231 bool flushed = false;
232 if (kDiscard_FlushBit & flagsBitfield) { 232 if (kDiscard_FlushBit & flagsBitfield) {
233 fDrawingManager->reset(); 233 fDrawingManager->reset();
234 } else { 234 } else {
235 fDrawingManager->flush(); 235 flushed = fDrawingManager->flush();
236 } 236 }
237 fResourceCache->notifyFlushOccurred(); 237 if (flushed) {
238 fResourceCache->notifyFlushOccurred();
239 }
238 fFlushToReduceCacheSize = false; 240 fFlushToReduceCacheSize = false;
239 } 241 }
240 242
241 bool sw_convert_to_premul(GrPixelConfig srcConfig, int width, int height, size_t inRowBytes, 243 bool sw_convert_to_premul(GrPixelConfig srcConfig, int width, int height, size_t inRowBytes,
242 const void* inPixels, size_t outRowBytes, void* outPix els) { 244 const void* inPixels, size_t outRowBytes, void* outPix els) {
243 SkSrcPixelInfo srcPI; 245 SkSrcPixelInfo srcPI;
244 if (!GrPixelConfigToColorType(srcConfig, &srcPI.fColorType)) { 246 if (!GrPixelConfigToColorType(srcConfig, &srcPI.fColorType)) {
245 return false; 247 return false;
246 } 248 }
247 srcPI.fAlphaType = kUnpremul_SkAlphaType; 249 srcPI.fAlphaType = kUnpremul_SkAlphaType;
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 ASSERT_SINGLE_OWNER 797 ASSERT_SINGLE_OWNER
796 fResourceCache->setLimits(maxTextures, maxTextureBytes); 798 fResourceCache->setLimits(maxTextures, maxTextureBytes);
797 } 799 }
798 800
799 ////////////////////////////////////////////////////////////////////////////// 801 //////////////////////////////////////////////////////////////////////////////
800 802
801 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { 803 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const {
802 ASSERT_SINGLE_OWNER 804 ASSERT_SINGLE_OWNER
803 fResourceCache->dumpMemoryStatistics(traceMemoryDump); 805 fResourceCache->dumpMemoryStatistics(traceMemoryDump);
804 } 806 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698