| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 | 7 |
| 9 #include "GrContext.h" | 8 #include "GrContext.h" |
| 10 #include "GrContextOptions.h" | 9 #include "GrContextOptions.h" |
| 11 #include "GrDrawingManager.h" | 10 #include "GrDrawingManager.h" |
| 12 #include "GrDrawContext.h" | 11 #include "GrDrawContext.h" |
| 13 #include "GrLayerCache.h" | 12 #include "GrLayerCache.h" |
| 14 #include "GrResourceCache.h" | 13 #include "GrResourceCache.h" |
| 15 #include "GrResourceProvider.h" | 14 #include "GrResourceProvider.h" |
| 16 #include "GrSoftwarePathRenderer.h" | 15 #include "GrSoftwarePathRenderer.h" |
| 17 #include "GrSurfacePriv.h" | 16 #include "GrSurfacePriv.h" |
| 18 | 17 |
| 19 #include "SkConfig8888.h" | 18 #include "SkConfig8888.h" |
| 20 #include "SkGrPriv.h" | 19 #include "SkGrPriv.h" |
| 20 #include "SkTypes.h" |
| 21 | 21 |
| 22 #include "effects/GrConfigConversionEffect.h" | 22 #include "effects/GrConfigConversionEffect.h" |
| 23 #include "text/GrTextBlobCache.h" | 23 #include "text/GrTextBlobCache.h" |
| 24 | 24 |
| 25 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this) | 25 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this) |
| 26 #define ASSERT_SINGLE_OWNER \ | 26 #define ASSERT_SINGLE_OWNER \ |
| 27 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(&fSingleOwner);) | 27 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(&fSingleOwner);) |
| 28 #define RETURN_IF_ABANDONED if (fDrawingManager->abandoned()) { return; } | 28 #define RETURN_IF_ABANDONED if (fDrawingManager->abandoned()) { return; } |
| 29 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->abandoned()) { return fal
se; } | 29 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->abandoned()) { return fal
se; } |
| 30 #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->abandoned()) { return null
ptr; } | 30 #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->abandoned()) { return null
ptr; } |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 } | 260 } |
| 261 | 261 |
| 262 GrGpu::DrawPreference drawPreference = GrGpu::kNoDraw_DrawPreference; | 262 GrGpu::DrawPreference drawPreference = GrGpu::kNoDraw_DrawPreference; |
| 263 // Don't prefer to draw for the conversion (and thereby access a texture fro
m the cache) when | 263 // Don't prefer to draw for the conversion (and thereby access a texture fro
m the cache) when |
| 264 // we've already determined that there isn't a roundtrip preserving conversi
on processor pair. | 264 // we've already determined that there isn't a roundtrip preserving conversi
on processor pair. |
| 265 if (applyPremulToSrc && !this->didFailPMUPMConversionTest()) { | 265 if (applyPremulToSrc && !this->didFailPMUPMConversionTest()) { |
| 266 drawPreference = GrGpu::kCallerPrefersDraw_DrawPreference; | 266 drawPreference = GrGpu::kCallerPrefersDraw_DrawPreference; |
| 267 } | 267 } |
| 268 | 268 |
| 269 GrGpu::WritePixelTempDrawInfo tempDrawInfo; | 269 GrGpu::WritePixelTempDrawInfo tempDrawInfo; |
| 270 if (!fGpu->getWritePixelsInfo(surface, width, height, rowBytes, srcConfig, &
drawPreference, | 270 if (!fGpu->getWritePixelsInfo(surface, width, height, srcConfig, &drawPrefer
ence, |
| 271 &tempDrawInfo)) { | 271 &tempDrawInfo)) { |
| 272 return false; | 272 return false; |
| 273 } | 273 } |
| 274 | 274 |
| 275 if (!(kDontFlush_PixelOpsFlag & pixelOpsFlags) && surface->surfacePriv().has
PendingIO()) { | 275 if (!(kDontFlush_PixelOpsFlag & pixelOpsFlags) && surface->surfacePriv().has
PendingIO()) { |
| 276 this->flush(); | 276 this->flush(); |
| 277 } | 277 } |
| 278 | 278 |
| 279 SkAutoTUnref<GrTexture> tempTexture; | 279 SkAutoTUnref<GrTexture> tempTexture; |
| 280 if (GrGpu::kNoDraw_DrawPreference != drawPreference) { | 280 if (GrGpu::kNoDraw_DrawPreference != drawPreference) { |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 ASSERT_SINGLE_OWNER | 658 ASSERT_SINGLE_OWNER |
| 659 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 659 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
| 660 } | 660 } |
| 661 | 661 |
| 662 ////////////////////////////////////////////////////////////////////////////// | 662 ////////////////////////////////////////////////////////////////////////////// |
| 663 | 663 |
| 664 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 664 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
| 665 ASSERT_SINGLE_OWNER | 665 ASSERT_SINGLE_OWNER |
| 666 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 666 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
| 667 } | 667 } |
| OLD | NEW |