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 "GrDrawTarget.h" | 11 #include "GrDrawTarget.h" |
12 #include "GrBatchFlushState.h" | 12 #include "GrBatchFlushState.h" |
13 #include "GrPathRendererChain.h" | 13 #include "GrPathRendererChain.h" |
14 #include "GrPathRenderer.h" | 14 #include "GrPathRenderer.h" |
15 #include "SkTDArray.h" | 15 #include "SkTDArray.h" |
16 | 16 |
17 class GrContext; | 17 class GrContext; |
18 class GrDrawContext; | 18 class GrDrawContext; |
| 19 class GrSingleOWner; |
19 class GrSoftwarePathRenderer; | 20 class GrSoftwarePathRenderer; |
20 class GrTextContext; | 21 class GrTextContext; |
21 | 22 |
22 // Currently the DrawingManager creates a separate GrTextContext for each | 23 // Currently the DrawingManager creates a separate GrTextContext for each |
23 // combination of text drawing options (pixel geometry x DFT use) | 24 // combination of text drawing options (pixel geometry x DFT use) |
24 // and hands the appropriate one back given the DrawContext's request. | 25 // and hands the appropriate one back given the DrawContext's request. |
25 // | 26 // |
26 // It allocates a new GrDrawContext for each GrRenderTarget | 27 // It allocates a new GrDrawContext for each GrRenderTarget |
27 // but all of them still land in the same GrDrawTarget! | 28 // but all of them still land in the same GrDrawTarget! |
28 // | 29 // |
(...skipping 17 matching lines...) Expand all Loading... |
46 GrContext* getContext() { return fContext; } | 47 GrContext* getContext() { return fContext; } |
47 | 48 |
48 GrPathRenderer* getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args, | 49 GrPathRenderer* getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args, |
49 bool allowSW, | 50 bool allowSW, |
50 GrPathRendererChain::DrawType drawType, | 51 GrPathRendererChain::DrawType drawType, |
51 GrPathRenderer::StencilSupport* stencilSuppo
rt = NULL); | 52 GrPathRenderer::StencilSupport* stencilSuppo
rt = NULL); |
52 | 53 |
53 static bool ProgramUnitTest(GrContext* context, int maxStages); | 54 static bool ProgramUnitTest(GrContext* context, int maxStages); |
54 | 55 |
55 private: | 56 private: |
56 GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsFor
DrawTargets) | 57 GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsFor
DrawTargets, |
| 58 GrSingleOwner* singleOwner) |
57 : fContext(context) | 59 : fContext(context) |
58 , fOptionsForDrawTargets(optionsForDrawTargets) | 60 , fOptionsForDrawTargets(optionsForDrawTargets) |
| 61 , fSingleOwner(singleOwner) |
59 , fAbandoned(false) | 62 , fAbandoned(false) |
60 , fNVPRTextContext(nullptr) | 63 , fNVPRTextContext(nullptr) |
61 , fPathRendererChain(nullptr) | 64 , fPathRendererChain(nullptr) |
62 , fSoftwarePathRenderer(nullptr) | 65 , fSoftwarePathRenderer(nullptr) |
63 , fFlushState(context->getGpu(), context->resourceProvider()) | 66 , fFlushState(context->getGpu(), context->resourceProvider()) |
64 , fFlushing(false) { | 67 , fFlushing(false) { |
65 sk_bzero(fTextContexts, sizeof(fTextContexts)); | 68 sk_bzero(fTextContexts, sizeof(fTextContexts)); |
66 } | 69 } |
67 | 70 |
68 void abandon(); | 71 void abandon(); |
69 void cleanup(); | 72 void cleanup(); |
70 void reset(); | 73 void reset(); |
71 void flush(); | 74 void flush(); |
72 | 75 |
73 friend class GrContext; // for access to: ctor, abandon, reset & flush | 76 friend class GrContext; // for access to: ctor, abandon, reset & flush |
74 | 77 |
75 static const int kNumPixelGeometries = 5; // The different pixel geometries | 78 static const int kNumPixelGeometries = 5; // The different pixel geometries |
76 static const int kNumDFTOptions = 2; // DFT or no DFT | 79 static const int kNumDFTOptions = 2; // DFT or no DFT |
77 | 80 |
78 GrContext* fContext; | 81 GrContext* fContext; |
79 GrDrawTarget::Options fOptionsForDrawTargets; | 82 GrDrawTarget::Options fOptionsForDrawTargets; |
80 | 83 |
| 84 // In debug builds we guard against improper thread handling |
| 85 GrSingleOwner* fSingleOwner; |
| 86 |
81 bool fAbandoned; | 87 bool fAbandoned; |
82 SkTDArray<GrDrawTarget*> fDrawTargets; | 88 SkTDArray<GrDrawTarget*> fDrawTargets; |
83 | 89 |
84 GrTextContext* fNVPRTextContext; | 90 GrTextContext* fNVPRTextContext; |
85 GrTextContext* fTextContexts[kNumPixelGeometries][kNumDFTOption
s]; | 91 GrTextContext* fTextContexts[kNumPixelGeometries][kNumDFTOption
s]; |
86 | 92 |
87 GrPathRendererChain* fPathRendererChain; | 93 GrPathRendererChain* fPathRendererChain; |
88 GrSoftwarePathRenderer* fSoftwarePathRenderer; | 94 GrSoftwarePathRenderer* fSoftwarePathRenderer; |
89 | 95 |
90 GrBatchFlushState fFlushState; | 96 GrBatchFlushState fFlushState; |
91 bool fFlushing; | 97 bool fFlushing; |
92 }; | 98 }; |
93 | 99 |
94 #endif | 100 #endif |
OLD | NEW |