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