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 |
(...skipping 20 matching lines...) Expand all Loading... |
31 // each GrRenderTarget/GrDrawTarget and manage the DAG. | 31 // each GrRenderTarget/GrDrawTarget and manage the DAG. |
32 class GrDrawingManager { | 32 class GrDrawingManager { |
33 public: | 33 public: |
34 ~GrDrawingManager(); | 34 ~GrDrawingManager(); |
35 | 35 |
36 bool abandoned() const { return fAbandoned; } | 36 bool abandoned() const { return fAbandoned; } |
37 void freeGpuResources(); | 37 void freeGpuResources(); |
38 | 38 |
39 GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps*); | 39 GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps*); |
40 | 40 |
41 GrTextContext* textContext(const SkSurfaceProps& props, GrRenderTarget* rt); | |
42 | |
43 // The caller automatically gets a ref on the returned drawTarget. It must | 41 // The caller automatically gets a ref on the returned drawTarget. It must |
44 // be balanced by an unref call. | 42 // be balanced by an unref call. |
45 GrDrawTarget* newDrawTarget(GrRenderTarget* rt); | 43 GrDrawTarget* newDrawTarget(GrRenderTarget* rt); |
46 | 44 |
47 GrContext* getContext() { return fContext; } | 45 GrContext* getContext() { return fContext; } |
48 | 46 |
49 GrPathRenderer* getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args, | 47 GrPathRenderer* getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args, |
50 bool allowSW, | 48 bool allowSW, |
51 GrPathRendererChain::DrawType drawType, | 49 GrPathRendererChain::DrawType drawType, |
52 GrPathRenderer::StencilSupport* stencilSuppo
rt = NULL); | 50 GrPathRenderer::StencilSupport* stencilSuppo
rt = NULL); |
53 | 51 |
54 static bool ProgramUnitTest(GrContext* context, int maxStages); | 52 static bool ProgramUnitTest(GrContext* context, int maxStages); |
55 | 53 |
56 private: | 54 private: |
57 GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsFor
DrawTargets, | 55 GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsFor
DrawTargets, |
58 GrSingleOwner* singleOwner) | 56 GrSingleOwner* singleOwner) |
59 : fContext(context) | 57 : fContext(context) |
60 , fOptionsForDrawTargets(optionsForDrawTargets) | 58 , fOptionsForDrawTargets(optionsForDrawTargets) |
61 , fSingleOwner(singleOwner) | 59 , fSingleOwner(singleOwner) |
62 , fAbandoned(false) | 60 , fAbandoned(false) |
63 , fNVPRTextContext(nullptr) | |
64 , fAtlasTextContext(nullptr) | |
65 , fPathRendererChain(nullptr) | 61 , fPathRendererChain(nullptr) |
66 , fSoftwarePathRenderer(nullptr) | 62 , fSoftwarePathRenderer(nullptr) |
67 , fFlushState(context->getGpu(), context->resourceProvider()) | 63 , fFlushState(context->getGpu(), context->resourceProvider()) |
68 , fFlushing(false) { | 64 , fFlushing(false) { |
69 } | 65 } |
70 | 66 |
71 void abandon(); | 67 void abandon(); |
72 void cleanup(); | 68 void cleanup(); |
73 void reset(); | 69 void reset(); |
74 void flush(); | 70 void flush(); |
75 | 71 |
76 friend class GrContext; // for access to: ctor, abandon, reset & flush | 72 friend class GrContext; // for access to: ctor, abandon, reset & flush |
77 | 73 |
78 static const int kNumPixelGeometries = 5; // The different pixel geometries | 74 static const int kNumPixelGeometries = 5; // The different pixel geometries |
79 static const int kNumDFTOptions = 2; // DFT or no DFT | 75 static const int kNumDFTOptions = 2; // DFT or no DFT |
80 | 76 |
81 GrContext* fContext; | 77 GrContext* fContext; |
82 GrDrawTarget::Options fOptionsForDrawTargets; | 78 GrDrawTarget::Options fOptionsForDrawTargets; |
83 | 79 |
84 // In debug builds we guard against improper thread handling | 80 // In debug builds we guard against improper thread handling |
85 GrSingleOwner* fSingleOwner; | 81 GrSingleOwner* fSingleOwner; |
86 | 82 |
87 bool fAbandoned; | 83 bool fAbandoned; |
88 SkTDArray<GrDrawTarget*> fDrawTargets; | 84 SkTDArray<GrDrawTarget*> fDrawTargets; |
89 | 85 |
90 GrTextContext* fNVPRTextContext; | |
91 GrTextContext* fAtlasTextContext; | |
92 | |
93 GrPathRendererChain* fPathRendererChain; | 86 GrPathRendererChain* fPathRendererChain; |
94 GrSoftwarePathRenderer* fSoftwarePathRenderer; | 87 GrSoftwarePathRenderer* fSoftwarePathRenderer; |
95 | 88 |
96 GrBatchFlushState fFlushState; | 89 GrBatchFlushState fFlushState; |
97 bool fFlushing; | 90 bool fFlushing; |
98 }; | 91 }; |
99 | 92 |
100 #endif | 93 #endif |
OLD | NEW |