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