| 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 "GrContextOptions.h" | 9 #include "GrContextOptions.h" |
| 10 #include "GrDrawingManager.h" | 10 #include "GrDrawingManager.h" |
| 11 #include "GrDrawContext.h" | 11 #include "GrDrawContext.h" |
| 12 #include "GrLayerCache.h" | 12 #include "GrLayerCache.h" |
| 13 #include "GrResourceCache.h" | 13 #include "GrResourceCache.h" |
| 14 #include "GrResourceProvider.h" | 14 #include "GrResourceProvider.h" |
| 15 #include "GrSoftwarePathRenderer.h" | 15 #include "GrSoftwarePathRenderer.h" |
| 16 #include "GrSurfacePriv.h" | 16 #include "GrSurfacePriv.h" |
| 17 | 17 |
| 18 #include "SkConfig8888.h" | 18 #include "SkConfig8888.h" |
| 19 #include "SkGrPriv.h" | 19 #include "SkGrPriv.h" |
| 20 | 20 |
| 21 #include "batches/GrCopySurfaceBatch.h" | 21 #include "batches/GrCopySurfaceBatch.h" |
| 22 #include "effects/GrConfigConversionEffect.h" | 22 #include "effects/GrConfigConversionEffect.h" |
| 23 #include "effects/GrGammaEffect.h" | 23 #include "effects/GrGammaEffect.h" |
| 24 #include "text/GrTextBlobCache.h" | 24 #include "text/GrTextBlobCache.h" |
| 25 | 25 |
| 26 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this) | 26 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this) |
| 27 #define ASSERT_SINGLE_OWNER \ | 27 #define ASSERT_SINGLE_OWNER \ |
| 28 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(&fSingleOwner);) | 28 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(&fSingleOwner);) |
| 29 #define RETURN_IF_ABANDONED if (fDrawingManager->abandoned()) { return; } | 29 #define RETURN_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return; } |
| 30 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->abandoned()) { return fal
se; } | 30 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return
false; } |
| 31 #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->abandoned()) { return null
ptr; } | 31 #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return n
ullptr; } |
| 32 | 32 |
| 33 //////////////////////////////////////////////////////////////////////////////// | 33 //////////////////////////////////////////////////////////////////////////////// |
| 34 | 34 |
| 35 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext)
{ | 35 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext)
{ |
| 36 GrContextOptions defaultOptions; | 36 GrContextOptions defaultOptions; |
| 37 return Create(backend, backendContext, defaultOptions); | 37 return Create(backend, backendContext, defaultOptions); |
| 38 } | 38 } |
| 39 | 39 |
| 40 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext, | 40 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext, |
| 41 const GrContextOptions& options) { | 41 const GrContextOptions& options) { |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 surfaceProps)); | 679 surfaceProps)); |
| 680 if (!drawContext) { | 680 if (!drawContext) { |
| 681 return nullptr; | 681 return nullptr; |
| 682 } | 682 } |
| 683 | 683 |
| 684 return drawContext; | 684 return drawContext; |
| 685 } | 685 } |
| 686 | 686 |
| 687 bool GrContext::abandoned() const { | 687 bool GrContext::abandoned() const { |
| 688 ASSERT_SINGLE_OWNER | 688 ASSERT_SINGLE_OWNER |
| 689 return fDrawingManager->abandoned(); | 689 return fDrawingManager->wasAbandoned(); |
| 690 } | 690 } |
| 691 | 691 |
| 692 namespace { | 692 namespace { |
| 693 void test_pm_conversions(GrContext* ctx, int* pmToUPMValue, int* upmToPMValue) { | 693 void test_pm_conversions(GrContext* ctx, int* pmToUPMValue, int* upmToPMValue) { |
| 694 GrConfigConversionEffect::PMConversion pmToUPM; | 694 GrConfigConversionEffect::PMConversion pmToUPM; |
| 695 GrConfigConversionEffect::PMConversion upmToPM; | 695 GrConfigConversionEffect::PMConversion upmToPM; |
| 696 GrConfigConversionEffect::TestForPreservingPMConversions(ctx, &pmToUPM, &upm
ToPM); | 696 GrConfigConversionEffect::TestForPreservingPMConversions(ctx, &pmToUPM, &upm
ToPM); |
| 697 *pmToUPMValue = pmToUPM; | 697 *pmToUPMValue = pmToUPM; |
| 698 *upmToPMValue = upmToPM; | 698 *upmToPMValue = upmToPM; |
| 699 } | 699 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 ASSERT_SINGLE_OWNER | 764 ASSERT_SINGLE_OWNER |
| 765 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 765 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
| 766 } | 766 } |
| 767 | 767 |
| 768 ////////////////////////////////////////////////////////////////////////////// | 768 ////////////////////////////////////////////////////////////////////////////// |
| 769 | 769 |
| 770 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 770 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
| 771 ASSERT_SINGLE_OWNER | 771 ASSERT_SINGLE_OWNER |
| 772 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 772 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
| 773 } | 773 } |
| OLD | NEW |