| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 GrDrawTarget_DEFINED | 8 #ifndef GrDrawTarget_DEFINED |
| 9 #define GrDrawTarget_DEFINED | 9 #define GrDrawTarget_DEFINED |
| 10 | 10 |
| 11 #include "GrBatchFlushState.h" | |
| 12 #include "GrClip.h" | 11 #include "GrClip.h" |
| 13 #include "GrClipMaskManager.h" | 12 #include "GrClipMaskManager.h" |
| 14 #include "GrContext.h" | 13 #include "GrContext.h" |
| 15 #include "GrPathProcessor.h" | 14 #include "GrPathProcessor.h" |
| 16 #include "GrPrimitiveProcessor.h" | 15 #include "GrPrimitiveProcessor.h" |
| 17 #include "GrIndexBuffer.h" | 16 #include "GrIndexBuffer.h" |
| 18 #include "GrPathRendering.h" | 17 #include "GrPathRendering.h" |
| 19 #include "GrPipelineBuilder.h" | 18 #include "GrPipelineBuilder.h" |
| 20 #include "GrPipeline.h" | 19 #include "GrPipeline.h" |
| 21 #include "GrVertexBuffer.h" | 20 #include "GrVertexBuffer.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 37 | 36 |
| 38 class GrBatch; | 37 class GrBatch; |
| 39 class GrClip; | 38 class GrClip; |
| 40 class GrCaps; | 39 class GrCaps; |
| 41 class GrPath; | 40 class GrPath; |
| 42 class GrDrawPathBatchBase; | 41 class GrDrawPathBatchBase; |
| 43 class GrPathRangeDraw; | 42 class GrPathRangeDraw; |
| 44 | 43 |
| 45 class GrDrawTarget final : public SkRefCnt { | 44 class GrDrawTarget final : public SkRefCnt { |
| 46 public: | 45 public: |
| 47 struct Options { | |
| 48 bool fImmediateMode; | |
| 49 }; | |
| 50 | |
| 51 // The context may not be fully constructed and should not be used during Gr
DrawTarget | 46 // The context may not be fully constructed and should not be used during Gr
DrawTarget |
| 52 // construction. | 47 // construction. |
| 53 GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider*, const Opti
ons& options); | 48 GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider*); |
| 54 | 49 |
| 55 ~GrDrawTarget() override; | 50 ~GrDrawTarget() override; |
| 56 | 51 |
| 57 void makeClosed() { | 52 void makeClosed() { |
| 58 // We only close drawTargets When MDB is enabled. When MDB is disabled t
here is only | 53 // We only close drawTargets When MDB is enabled. When MDB is disabled t
here is only |
| 59 // ever one drawTarget and all calls will be funnelled into it. | 54 // ever one drawTarget and all calls will be funnelled into it. |
| 60 #ifdef ENABLE_MDB | 55 #ifdef ENABLE_MDB |
| 61 this->setFlag(kClosed_Flag); | 56 this->setFlag(kClosed_Flag); |
| 62 #endif | 57 #endif |
| 63 } | 58 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 83 * Dump out the drawTarget dependency DAG | 78 * Dump out the drawTarget dependency DAG |
| 84 */ | 79 */ |
| 85 SkDEBUGCODE(void dump() const;) | 80 SkDEBUGCODE(void dump() const;) |
| 86 | 81 |
| 87 /** | 82 /** |
| 88 * Empties the draw buffer of any queued up draws. | 83 * Empties the draw buffer of any queued up draws. |
| 89 */ | 84 */ |
| 90 void reset(); | 85 void reset(); |
| 91 | 86 |
| 92 /** | 87 /** |
| 93 * This plays any queued up draws to its GrGpu target. It also resets this o
bject (i.e. flushing | 88 * Together these two functions flush all queued up draws to the Gpu. |
| 94 * is destructive). | |
| 95 */ | 89 */ |
| 96 void flush(); | 90 void prepareBatches(GrBatchFlushState* flushState); |
| 91 void drawBatches(GrBatchFlushState* flushState); |
| 97 | 92 |
| 98 /** | 93 /** |
| 99 * Gets the capabilities of the draw target. | 94 * Gets the capabilities of the draw target. |
| 100 */ | 95 */ |
| 101 const GrCaps* caps() const { return fGpu->caps(); } | 96 const GrCaps* caps() const { return fGpu->caps(); } |
| 102 | 97 |
| 103 void drawBatch(const GrPipelineBuilder&, GrDrawBatch*); | 98 void drawBatch(const GrPipelineBuilder&, GrDrawBatch*); |
| 104 | 99 |
| 105 /** | 100 /** |
| 106 * Draws path into the stencil buffer. The fill must be either even/odd or | 101 * Draws path into the stencil buffer. The fill must be either even/odd or |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 * src bounds then pixel values in the dst rect corresponding to area clipp
ed | 198 * src bounds then pixel values in the dst rect corresponding to area clipp
ed |
| 204 * by the src rect are not overwritten. This method is not guaranteed to suc
ceed | 199 * by the src rect are not overwritten. This method is not guaranteed to suc
ceed |
| 205 * depending on the type of surface, configs, etc, and the backend-specific | 200 * depending on the type of surface, configs, etc, and the backend-specific |
| 206 * limitations. | 201 * limitations. |
| 207 */ | 202 */ |
| 208 void copySurface(GrSurface* dst, | 203 void copySurface(GrSurface* dst, |
| 209 GrSurface* src, | 204 GrSurface* src, |
| 210 const SkIRect& srcRect, | 205 const SkIRect& srcRect, |
| 211 const SkIPoint& dstPoint); | 206 const SkIPoint& dstPoint); |
| 212 | 207 |
| 213 bool programUnitTest(GrContext* owner, int maxStages); | |
| 214 | |
| 215 /** Provides access to internal functions to GrClipMaskManager without frien
ding all of | 208 /** Provides access to internal functions to GrClipMaskManager without frien
ding all of |
| 216 GrDrawTarget to CMM. */ | 209 GrDrawTarget to CMM. */ |
| 217 class CMMAccess { | 210 class CMMAccess { |
| 218 public: | 211 public: |
| 219 CMMAccess(GrDrawTarget* drawTarget) : fDrawTarget(drawTarget) {} | 212 CMMAccess(GrDrawTarget* drawTarget) : fDrawTarget(drawTarget) {} |
| 220 private: | 213 private: |
| 221 void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarg
et* rt) const { | 214 void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarg
et* rt) const { |
| 222 fDrawTarget->clearStencilClip(rect, insideClip, rt); | 215 fDrawTarget->clearStencilClip(rect, insideClip, rt); |
| 223 } | 216 } |
| 224 | 217 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 297 |
| 305 // Used only by CMM. | 298 // Used only by CMM. |
| 306 void clearStencilClip(const SkIRect&, bool insideClip, GrRenderTarget*); | 299 void clearStencilClip(const SkIRect&, bool insideClip, GrRenderTarget*); |
| 307 | 300 |
| 308 SkSTArray<256, SkAutoTUnref<GrBatch>, true> fBatches; | 301 SkSTArray<256, SkAutoTUnref<GrBatch>, true> fBatches; |
| 309 SkAutoTDelete<GrClipMaskManager> fClipMaskManager; | 302 SkAutoTDelete<GrClipMaskManager> fClipMaskManager; |
| 310 // The context is only in service of the clip mask manager, remove once CMM
doesn't need this. | 303 // The context is only in service of the clip mask manager, remove once CMM
doesn't need this. |
| 311 GrContext* fContext; | 304 GrContext* fContext; |
| 312 GrGpu* fGpu; | 305 GrGpu* fGpu; |
| 313 GrResourceProvider* fResourceProvider; | 306 GrResourceProvider* fResourceProvider; |
| 314 GrBatchFlushState fFlushState; | |
| 315 bool fFlushing; | 307 bool fFlushing; |
| 316 | 308 |
| 317 SkDEBUGCODE(int fDebugID;) | 309 SkDEBUGCODE(int fDebugID;) |
| 318 uint32_t fFlags; | 310 uint32_t fFlags; |
| 319 Options fOptions; | |
| 320 | 311 |
| 321 // 'this' drawTarget relies on the output of the drawTargets in 'fDependenci
es' | 312 // 'this' drawTarget relies on the output of the drawTargets in 'fDependenci
es' |
| 322 SkTDArray<GrDrawTarget*> fDependencies; | 313 SkTDArray<GrDrawTarget*> fDependencies; |
| 323 GrRenderTarget* fRenderTarget; | 314 GrRenderTarget* fRenderTarget; |
| 324 | 315 |
| 325 typedef SkRefCnt INHERITED; | 316 typedef SkRefCnt INHERITED; |
| 326 }; | 317 }; |
| 327 | 318 |
| 328 #endif | 319 #endif |
| OLD | NEW |