| 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 "GrClip.h" | 11 #include "GrClip.h" |
| 12 #include "GrClipMaskManager.h" | |
| 13 #include "GrContext.h" | 12 #include "GrContext.h" |
| 14 #include "GrPathProcessor.h" | 13 #include "GrPathProcessor.h" |
| 15 #include "GrPrimitiveProcessor.h" | 14 #include "GrPrimitiveProcessor.h" |
| 16 #include "GrPathRendering.h" | 15 #include "GrPathRendering.h" |
| 17 #include "GrPipelineBuilder.h" | 16 #include "GrPipelineBuilder.h" |
| 18 #include "GrXferProcessor.h" | 17 #include "GrXferProcessor.h" |
| 19 | 18 |
| 20 #include "batches/GrDrawBatch.h" | 19 #include "batches/GrDrawBatch.h" |
| 21 | 20 |
| 22 #include "SkClipStack.h" | 21 #include "SkClipStack.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 * Together these two functions flush all queued up draws to the Gpu. | 97 * Together these two functions flush all queued up draws to the Gpu. |
| 99 */ | 98 */ |
| 100 void prepareBatches(GrBatchFlushState* flushState); | 99 void prepareBatches(GrBatchFlushState* flushState); |
| 101 void drawBatches(GrBatchFlushState* flushState); | 100 void drawBatches(GrBatchFlushState* flushState); |
| 102 | 101 |
| 103 /** | 102 /** |
| 104 * Gets the capabilities of the draw target. | 103 * Gets the capabilities of the draw target. |
| 105 */ | 104 */ |
| 106 const GrCaps* caps() const { return fGpu->caps(); } | 105 const GrCaps* caps() const { return fGpu->caps(); } |
| 107 | 106 |
| 108 void drawBatch(const GrPipelineBuilder&, const GrClip&, GrDrawBatch*); | 107 void drawBatch(const GrPipelineBuilder&, GrDrawContext*, const GrClip&, GrDr
awBatch*); |
| 109 | 108 |
| 110 /** | 109 /** |
| 111 * Draws path into the stencil buffer. The fill must be either even/odd or | 110 * Draws path into the stencil buffer. The fill must be either even/odd or |
| 112 * winding (not inverse or hairline). It will respect the HW antialias flag | 111 * winding (not inverse or hairline). It will respect the HW antialias flag |
| 113 * on the GrPipelineBuilder (if possible in the 3D API). Note, we will neve
r have an inverse | 112 * on the GrPipelineBuilder (if possible in the 3D API). Note, we will neve
r have an inverse |
| 114 * fill with stencil path | 113 * fill with stencil path |
| 115 */ | 114 */ |
| 116 void stencilPath(const GrPipelineBuilder&, const GrClip&, const SkMatrix& vi
ewMatrix, | 115 void stencilPath(const GrPipelineBuilder&, GrDrawContext*, |
| 116 const GrClip&, const SkMatrix& viewMatrix, |
| 117 const GrPath*, GrPathRendering::FillType); | 117 const GrPath*, GrPathRendering::FillType); |
| 118 | 118 |
| 119 /** | 119 /** |
| 120 * Clear the passed in render target. Ignores the GrPipelineBuilder and clip
. Clears the whole | 120 * Clear the passed in render target. Ignores the GrPipelineBuilder and clip
. Clears the whole |
| 121 * thing if rect is nullptr, otherwise just the rect. If canIgnoreRect is se
t then the entire | 121 * thing if rect is nullptr, otherwise just the rect. If canIgnoreRect is se
t then the entire |
| 122 * render target can be optionally cleared. | 122 * render target can be optionally cleared. |
| 123 */ | 123 */ |
| 124 void clear(const SkIRect* rect, | 124 void clear(const SkIRect* rect, |
| 125 GrColor color, | 125 GrColor color, |
| 126 bool canIgnoreRect, | 126 bool canIgnoreRect, |
| 127 GrRenderTarget* renderTarget); | 127 GrDrawContext*); |
| 128 | 128 |
| 129 /** Discards the contents render target. */ | 129 /** Discards the contents render target. */ |
| 130 void discard(GrRenderTarget*); | 130 void discard(GrRenderTarget*); |
| 131 | 131 |
| 132 /** | 132 /** |
| 133 * Copies a pixel rectangle from one surface to another. This call may final
ize | 133 * Copies a pixel rectangle from one surface to another. This call may final
ize |
| 134 * reserved vertex/index data (as though a draw call was made). The src pixe
ls | 134 * reserved vertex/index data (as though a draw call was made). The src pixe
ls |
| 135 * copied are specified by srcRect. They are copied to a rect of the same | 135 * copied are specified by srcRect. They are copied to a rect of the same |
| 136 * size in dst with top left at dstPoint. If the src rect is clipped by the | 136 * size in dst with top left at dstPoint. If the src rect is clipped by the |
| 137 * src bounds then pixel values in the dst rect corresponding to area clipp
ed | 137 * src bounds then pixel values in the dst rect corresponding to area clipp
ed |
| (...skipping 21 matching lines...) Expand all Loading... |
| 159 GrDrawTarget* fDrawTarget; | 159 GrDrawTarget* fDrawTarget; |
| 160 friend class GrClipMaskManager; | 160 friend class GrClipMaskManager; |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 const CMMAccess cmmAccess() { return CMMAccess(this); } | 163 const CMMAccess cmmAccess() { return CMMAccess(this); } |
| 164 | 164 |
| 165 GrAuditTrail* getAuditTrail() const { return fAuditTrail; } | 165 GrAuditTrail* getAuditTrail() const { return fAuditTrail; } |
| 166 | 166 |
| 167 private: | 167 private: |
| 168 friend class GrDrawingManager; // for resetFlag & TopoSortTraits | 168 friend class GrDrawingManager; // for resetFlag & TopoSortTraits |
| 169 friend class GrDrawContextPriv; // for clearStencilClip |
| 169 | 170 |
| 170 enum Flags { | 171 enum Flags { |
| 171 kClosed_Flag = 0x01, //!< This drawTarget can't accept any more bat
ches | 172 kClosed_Flag = 0x01, //!< This drawTarget can't accept any more bat
ches |
| 172 | 173 |
| 173 kWasOutput_Flag = 0x02, //!< Flag for topological sorting | 174 kWasOutput_Flag = 0x02, //!< Flag for topological sorting |
| 174 kTempMark_Flag = 0x04, //!< Flag for topological sorting | 175 kTempMark_Flag = 0x04, //!< Flag for topological sorting |
| 175 }; | 176 }; |
| 176 | 177 |
| 177 void setFlag(uint32_t flag) { | 178 void setFlag(uint32_t flag) { |
| 178 fFlags |= flag; | 179 fFlags |= flag; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 const GrPipelineOptimizations& optimizations, | 222 const GrPipelineOptimizations& optimizations, |
| 222 GrXferProcessor::DstTexture*, | 223 GrXferProcessor::DstTexture*, |
| 223 const SkRect& batchBounds); | 224 const SkRect& batchBounds); |
| 224 | 225 |
| 225 void addDependency(GrDrawTarget* dependedOn); | 226 void addDependency(GrDrawTarget* dependedOn); |
| 226 | 227 |
| 227 // Used only by CMM. | 228 // Used only by CMM. |
| 228 void clearStencilClip(const SkIRect&, bool insideClip, GrRenderTarget*); | 229 void clearStencilClip(const SkIRect&, bool insideClip, GrRenderTarget*); |
| 229 | 230 |
| 230 SkSTArray<256, SkAutoTUnref<GrBatch>, true> fBatches; | 231 SkSTArray<256, SkAutoTUnref<GrBatch>, true> fBatches; |
| 231 SkAutoTDelete<GrClipMaskManager> fClipMaskManager; | |
| 232 // The context is only in service of the clip mask manager, remove once CMM
doesn't need this. | 232 // The context is only in service of the clip mask manager, remove once CMM
doesn't need this. |
| 233 GrContext* fContext; | 233 GrContext* fContext; |
| 234 GrGpu* fGpu; | 234 GrGpu* fGpu; |
| 235 GrResourceProvider* fResourceProvider; | 235 GrResourceProvider* fResourceProvider; |
| 236 GrAuditTrail* fAuditTrail; | 236 GrAuditTrail* fAuditTrail; |
| 237 | 237 |
| 238 SkDEBUGCODE(int fDebugID;) | 238 SkDEBUGCODE(int fDebugID;) |
| 239 uint32_t fFlags; | 239 uint32_t fFlags; |
| 240 | 240 |
| 241 // 'this' drawTarget relies on the output of the drawTargets in 'fDependenci
es' | 241 // 'this' drawTarget relies on the output of the drawTargets in 'fDependenci
es' |
| 242 SkTDArray<GrDrawTarget*> fDependencies; | 242 SkTDArray<GrDrawTarget*> fDependencies; |
| 243 GrRenderTarget* fRenderTarget; | 243 GrRenderTarget* fRenderTarget; |
| 244 | 244 |
| 245 bool fClipBatchToBounds; | 245 bool fClipBatchToBounds; |
| 246 bool fDrawBatchBounds; | 246 bool fDrawBatchBounds; |
| 247 int fMaxBatchLookback; | 247 int fMaxBatchLookback; |
| 248 int fMaxBatchLookahead; | 248 int fMaxBatchLookahead; |
| 249 | 249 |
| 250 typedef SkRefCnt INHERITED; | 250 typedef SkRefCnt INHERITED; |
| 251 }; | 251 }; |
| 252 | 252 |
| 253 #endif | 253 #endif |
| OLD | NEW |