OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #ifndef GrDrawingManager_DEFINED | 8 #ifndef GrDrawingManager_DEFINED |
9 #define GrDrawingManager_DEFINED | 9 #define GrDrawingManager_DEFINED |
10 | 10 |
11 #include "text/GrAtlasTextContext.h" | 11 #include "text/GrAtlasTextContext.h" |
12 #include "GrDrawTarget.h" | 12 #include "GrDrawTarget.h" |
13 #include "GrBatchFlushState.h" | 13 #include "GrBatchFlushState.h" |
14 #include "GrPathRendererChain.h" | 14 #include "GrPathRendererChain.h" |
15 #include "GrPathRenderer.h" | 15 #include "GrPathRenderer.h" |
16 #include "GrResourceCache.h" | |
16 #include "SkTDArray.h" | 17 #include "SkTDArray.h" |
17 | 18 |
18 class GrContext; | 19 class GrContext; |
19 class GrDrawContext; | 20 class GrDrawContext; |
20 class GrSingleOWner; | 21 class GrSingleOWner; |
21 class GrSoftwarePathRenderer; | 22 class GrSoftwarePathRenderer; |
22 | 23 |
23 // The GrDrawingManager allocates a new GrDrawContext for each GrRenderTarget | 24 // The GrDrawingManager allocates a new GrDrawContext for each GrRenderTarget |
24 // but all of them still land in the same GrDrawTarget! | 25 // but all of them still land in the same GrDrawTarget! |
25 // | 26 // |
(...skipping 16 matching lines...) Expand all Loading... | |
42 | 43 |
43 GrContext* getContext() { return fContext; } | 44 GrContext* getContext() { return fContext; } |
44 | 45 |
45 GrAtlasTextContext* getAtlasTextContext(); | 46 GrAtlasTextContext* getAtlasTextContext(); |
46 | 47 |
47 GrPathRenderer* getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args, | 48 GrPathRenderer* getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args, |
48 bool allowSW, | 49 bool allowSW, |
49 GrPathRendererChain::DrawType drawType, | 50 GrPathRendererChain::DrawType drawType, |
50 GrPathRenderer::StencilSupport* stencilSuppo rt = NULL); | 51 GrPathRenderer::StencilSupport* stencilSuppo rt = NULL); |
51 | 52 |
53 void flushIfNecessary() { | |
robertphillips
2016/09/02 16:23:06
What happened to "this->caps()->immediateFlush()"
| |
54 if (fContext->getResourceCache()->requestsFlush()) { | |
55 this->internalFlush(GrResourceCache::kCacheRequested); | |
56 } | |
57 } | |
58 | |
52 static bool ProgramUnitTest(GrContext* context, int maxStages); | 59 static bool ProgramUnitTest(GrContext* context, int maxStages); |
53 | 60 |
54 private: | 61 private: |
55 GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsFor DrawTargets, | 62 GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsFor DrawTargets, |
56 GrSingleOwner* singleOwner) | 63 GrSingleOwner* singleOwner) |
57 : fContext(context) | 64 : fContext(context) |
58 , fOptionsForDrawTargets(optionsForDrawTargets) | 65 , fOptionsForDrawTargets(optionsForDrawTargets) |
59 , fSingleOwner(singleOwner) | 66 , fSingleOwner(singleOwner) |
60 , fAbandoned(false) | 67 , fAbandoned(false) |
61 , fAtlasTextContext(nullptr) | 68 , fAtlasTextContext(nullptr) |
62 , fPathRendererChain(nullptr) | 69 , fPathRendererChain(nullptr) |
63 , fSoftwarePathRenderer(nullptr) | 70 , fSoftwarePathRenderer(nullptr) |
64 , fFlushState(context->getGpu(), context->resourceProvider()) | 71 , fFlushState(context->getGpu(), context->resourceProvider()) |
65 , fFlushing(false) { | 72 , fFlushing(false) { |
66 } | 73 } |
67 | 74 |
68 void abandon(); | 75 void abandon(); |
69 void cleanup(); | 76 void cleanup(); |
70 void reset(); | 77 void reset(); |
71 /** Returns true if there was anything to flush and false otherwise */ | 78 void flush() { this->internalFlush(GrResourceCache::FlushType::kExternal); } |
72 bool flush(); | 79 void internalFlush(GrResourceCache::FlushType); |
73 | 80 |
74 friend class GrContext; // for access to: ctor, abandon, reset & flush | 81 friend class GrContext; // for access to: ctor, abandon, reset & flush |
75 | 82 |
76 static const int kNumPixelGeometries = 5; // The different pixel geometries | 83 static const int kNumPixelGeometries = 5; // The different pixel geometries |
77 static const int kNumDFTOptions = 2; // DFT or no DFT | 84 static const int kNumDFTOptions = 2; // DFT or no DFT |
78 | 85 |
79 GrContext* fContext; | 86 GrContext* fContext; |
80 GrDrawTarget::Options fOptionsForDrawTargets; | 87 GrDrawTarget::Options fOptionsForDrawTargets; |
81 | 88 |
82 // In debug builds we guard against improper thread handling | 89 // In debug builds we guard against improper thread handling |
83 GrSingleOwner* fSingleOwner; | 90 GrSingleOwner* fSingleOwner; |
84 | 91 |
85 bool fAbandoned; | 92 bool fAbandoned; |
86 SkTDArray<GrDrawTarget*> fDrawTargets; | 93 SkTDArray<GrDrawTarget*> fDrawTargets; |
87 | 94 |
88 SkAutoTDelete<GrAtlasTextContext> fAtlasTextContext; | 95 SkAutoTDelete<GrAtlasTextContext> fAtlasTextContext; |
89 | 96 |
90 GrPathRendererChain* fPathRendererChain; | 97 GrPathRendererChain* fPathRendererChain; |
91 GrSoftwarePathRenderer* fSoftwarePathRenderer; | 98 GrSoftwarePathRenderer* fSoftwarePathRenderer; |
92 | 99 |
93 GrBatchFlushState fFlushState; | 100 GrBatchFlushState fFlushState; |
94 bool fFlushing; | 101 bool fFlushing; |
95 }; | 102 }; |
96 | 103 |
97 #endif | 104 #endif |
OLD | NEW |