| OLD | NEW | 
|---|
| 1 | 1 | 
| 2 /* | 2 /* | 
| 3  * Copyright 2011 Google Inc. | 3  * Copyright 2011 Google Inc. | 
| 4  * | 4  * | 
| 5  * Use of this source code is governed by a BSD-style license that can be | 5  * Use of this source code is governed by a BSD-style license that can be | 
| 6  * found in the LICENSE file. | 6  * found in the LICENSE file. | 
| 7  */ | 7  */ | 
| 8 | 8 | 
| 9 #include "GrContext.h" | 9 #include "GrContext.h" | 
| 10 | 10 | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 38 #include "GrVertices.h" | 38 #include "GrVertices.h" | 
| 39 #include "SkDashPathPriv.h" | 39 #include "SkDashPathPriv.h" | 
| 40 #include "SkConfig8888.h" | 40 #include "SkConfig8888.h" | 
| 41 #include "SkGrPriv.h" | 41 #include "SkGrPriv.h" | 
| 42 #include "SkRRect.h" | 42 #include "SkRRect.h" | 
| 43 #include "SkStrokeRec.h" | 43 #include "SkStrokeRec.h" | 
| 44 #include "SkSurfacePriv.h" | 44 #include "SkSurfacePriv.h" | 
| 45 #include "SkTLazy.h" | 45 #include "SkTLazy.h" | 
| 46 #include "SkTLS.h" | 46 #include "SkTLS.h" | 
| 47 #include "SkTraceEvent.h" | 47 #include "SkTraceEvent.h" | 
| 48 | 48 #include "SkTTopoSort.h" | 
| 49 | 49 | 
| 50 #include "batches/GrBatch.h" | 50 #include "batches/GrBatch.h" | 
| 51 | 51 | 
| 52 #include "effects/GrConfigConversionEffect.h" | 52 #include "effects/GrConfigConversionEffect.h" | 
| 53 #include "effects/GrDashingEffect.h" | 53 #include "effects/GrDashingEffect.h" | 
| 54 #include "effects/GrSingleTextureEffect.h" | 54 #include "effects/GrSingleTextureEffect.h" | 
| 55 | 55 | 
| 56 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this) | 56 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this) | 
| 57 #define RETURN_IF_ABANDONED if (fDrawingManager->abandoned()) { return; } | 57 #define RETURN_IF_ABANDONED if (fDrawingManager->abandoned()) { return; } | 
| 58 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->abandoned()) { return fal
     se; } | 58 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->abandoned()) { return fal
     se; } | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
| 88     this->cleanup(); | 88     this->cleanup(); | 
| 89 } | 89 } | 
| 90 | 90 | 
| 91 void GrDrawingManager::reset() { | 91 void GrDrawingManager::reset() { | 
| 92     for (int i = 0; i < fDrawTargets.count(); ++i) { | 92     for (int i = 0; i < fDrawTargets.count(); ++i) { | 
| 93         fDrawTargets[i]->reset(); | 93         fDrawTargets[i]->reset(); | 
| 94     } | 94     } | 
| 95 } | 95 } | 
| 96 | 96 | 
| 97 void GrDrawingManager::flush() { | 97 void GrDrawingManager::flush() { | 
|  | 98     SkDEBUGCODE(bool result =) | 
|  | 99                         SkTTopoSort<GrDrawTarget, GrDrawTarget::TopoSortTraits>(
     &fDrawTargets); | 
|  | 100     SkASSERT(result); | 
|  | 101 | 
| 98     for (int i = 0; i < fDrawTargets.count(); ++i) { | 102     for (int i = 0; i < fDrawTargets.count(); ++i) { | 
| 99         fDrawTargets[i]->flush(); | 103         fDrawTargets[i]->flush(); | 
| 100     } | 104     } | 
|  | 105 | 
|  | 106 #ifndef ENABLE_MDB | 
|  | 107     // When MDB is disabled we keep reusing the same drawTarget | 
|  | 108     if (fDrawTargets.count()) { | 
|  | 109         SkASSERT(fDrawTargets.count() == 1); | 
|  | 110         fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag); | 
|  | 111     } | 
|  | 112 #endif | 
| 101 } | 113 } | 
| 102 | 114 | 
| 103 GrTextContext* GrDrawingManager::textContext(const SkSurfaceProps& props, | 115 GrTextContext* GrDrawingManager::textContext(const SkSurfaceProps& props, | 
| 104                                              GrRenderTarget* rt) { | 116                                              GrRenderTarget* rt) { | 
| 105     if (this->abandoned()) { | 117     if (this->abandoned()) { | 
| 106         return nullptr; | 118         return nullptr; | 
| 107     } | 119     } | 
| 108 | 120 | 
| 109     SkASSERT(props.pixelGeometry() < kNumPixelGeometries); | 121     SkASSERT(props.pixelGeometry() < kNumPixelGeometries); | 
| 110     bool useDIF = props.isUseDeviceIndependentFonts(); | 122     bool useDIF = props.isUseDeviceIndependentFonts(); | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 124     if (!fTextContexts[props.pixelGeometry()][useDIF]) { | 136     if (!fTextContexts[props.pixelGeometry()][useDIF]) { | 
| 125         fTextContexts[props.pixelGeometry()][useDIF] = GrAtlasTextContext::Creat
     e(fContext, props); | 137         fTextContexts[props.pixelGeometry()][useDIF] = GrAtlasTextContext::Creat
     e(fContext, props); | 
| 126     } | 138     } | 
| 127 | 139 | 
| 128     return fTextContexts[props.pixelGeometry()][useDIF]; | 140     return fTextContexts[props.pixelGeometry()][useDIF]; | 
| 129 } | 141 } | 
| 130 | 142 | 
| 131 GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) { | 143 GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) { | 
| 132     SkASSERT(fContext); | 144     SkASSERT(fContext); | 
| 133 | 145 | 
|  | 146 #ifndef ENABLE_MDB | 
| 134     // When MDB is disabled we always just return the single drawTarget | 147     // When MDB is disabled we always just return the single drawTarget | 
| 135 #ifndef ENABLE_MDB |  | 
| 136     if (fDrawTargets.count()) { | 148     if (fDrawTargets.count()) { | 
| 137         SkASSERT(fDrawTargets.count() == 1); | 149         SkASSERT(fDrawTargets.count() == 1); | 
| 138         // DrawingManager gets the creation ref - this ref is for the caller | 150         // DrawingManager gets the creation ref - this ref is for the caller | 
| 139         return SkRef(fDrawTargets[0]); | 151         return SkRef(fDrawTargets[0]); | 
| 140     } | 152     } | 
| 141 #endif | 153 #endif | 
| 142 | 154 | 
| 143     GrDrawTarget* dt = new GrDrawTarget(fContext->getGpu(), fContext->resourcePr
     ovider()); | 155     GrDrawTarget* dt = new GrDrawTarget(fContext->getGpu(), fContext->resourcePr
     ovider()); | 
| 144 | 156 | 
| 145     *fDrawTargets.append() = dt; | 157     *fDrawTargets.append() = dt; | 
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 796 | 808 | 
| 797 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes) 
     { | 809 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes) 
     { | 
| 798     fResourceCache->setLimits(maxTextures, maxTextureBytes); | 810     fResourceCache->setLimits(maxTextures, maxTextureBytes); | 
| 799 } | 811 } | 
| 800 | 812 | 
| 801 ////////////////////////////////////////////////////////////////////////////// | 813 ////////////////////////////////////////////////////////////////////////////// | 
| 802 | 814 | 
| 803 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 815 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 
| 804     fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 816     fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 
| 805 } | 817 } | 
| OLD | NEW | 
|---|