| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |