| 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 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 class GrBatch; | 32 class GrBatch; |
| 33 class GrClip; | 33 class GrClip; |
| 34 class GrCaps; | 34 class GrCaps; |
| 35 class GrPath; | 35 class GrPath; |
| 36 class GrDrawBatch; | 36 class GrDrawBatch; |
| 37 class GrDrawPathBatchBase; | 37 class GrDrawPathBatchBase; |
| 38 class GrPathRangeDraw; | 38 class GrPathRangeDraw; |
| 39 | 39 |
| 40 class GrDrawTarget : public SkRefCnt { | 40 class GrDrawTarget : public SkRefCnt { |
| 41 public: | 41 public: |
| 42 | |
| 43 | |
| 44 typedef GrPathRange::PathIndexType PathIndexType; | |
| 45 typedef GrPathRendering::PathTransformType PathTransformType; | |
| 46 | |
| 47 /////////////////////////////////////////////////////////////////////////// | |
| 48 | |
| 49 // The context may not be fully constructed and should not be used during Gr
DrawTarget | 42 // The context may not be fully constructed and should not be used during Gr
DrawTarget |
| 50 // construction. | 43 // construction. |
| 51 GrDrawTarget(GrGpu* gpu, GrResourceProvider*); | 44 GrDrawTarget(GrGpu* gpu, GrResourceProvider*); |
| 52 | 45 |
| 53 virtual ~GrDrawTarget(); | 46 ~GrDrawTarget() override; |
| 54 | 47 |
| 55 /** | 48 /** |
| 56 * Empties the draw buffer of any queued up draws. | 49 * Empties the draw buffer of any queued up draws. |
| 57 */ | 50 */ |
| 58 void reset() { this->onReset(); } | 51 void reset(); |
| 59 | 52 |
| 60 /** | 53 /** |
| 61 * This plays any queued up draws to its GrGpu target. It also resets this o
bject (i.e. flushing | 54 * This plays any queued up draws to its GrGpu target. It also resets this o
bject (i.e. flushing |
| 62 * is destructive). | 55 * is destructive). |
| 63 */ | 56 */ |
| 64 void flush(); | 57 void flush(); |
| 65 | 58 |
| 66 /** | 59 /** |
| 67 * Gets the capabilities of the draw target. | 60 * Gets the capabilities of the draw target. |
| 68 */ | 61 */ |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 197 |
| 205 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required | 198 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required |
| 206 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it | 199 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it |
| 207 // needs to be accessed by GLPrograms to setup a correct drawstate | 200 // needs to be accessed by GLPrograms to setup a correct drawstate |
| 208 bool setupDstReadIfNecessary(const GrPipelineBuilder&, | 201 bool setupDstReadIfNecessary(const GrPipelineBuilder&, |
| 209 const GrProcOptInfo& colorPOI, | 202 const GrProcOptInfo& colorPOI, |
| 210 const GrProcOptInfo& coveragePOI, | 203 const GrProcOptInfo& coveragePOI, |
| 211 GrXferProcessor::DstTexture*, | 204 GrXferProcessor::DstTexture*, |
| 212 const SkRect* drawBounds); | 205 const SkRect* drawBounds); |
| 213 | 206 |
| 214 virtual void onDrawBatch(GrBatch*) = 0; | 207 void recordBatch(GrBatch*); |
| 215 | 208 |
| 216 private: | 209 private: |
| 217 virtual void onReset() = 0; | 210 SkSTArray<256, SkAutoTUnref<GrBatch>, true> fBatches; |
| 218 | |
| 219 virtual void onFlush() = 0; | |
| 220 | 211 |
| 221 void drawPathBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawPathBatch
Base* batch, | 212 void drawPathBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawPathBatch
Base* batch, |
| 222 GrPathRendering::FillType fill); | 213 GrPathRendering::FillType fill); |
| 223 // Check to see if this set of draw commands has been sent out | 214 // Check to see if this set of draw commands has been sent out |
| 224 void getPathStencilSettingsForFilltype(GrPathRendering::FillType, | 215 void getPathStencilSettingsForFilltype(GrPathRendering::FillType, |
| 225 const GrStencilAttachment*, | 216 const GrStencilAttachment*, |
| 226 GrStencilSettings*); | 217 GrStencilSettings*); |
| 227 virtual GrClipMaskManager* clipMaskManager() = 0; | 218 virtual GrClipMaskManager* clipMaskManager() = 0; |
| 228 virtual bool setupClip(const GrPipelineBuilder&, | 219 virtual bool setupClip(const GrPipelineBuilder&, |
| 229 GrPipelineBuilder::AutoRestoreFragmentProcessorState*
, | 220 GrPipelineBuilder::AutoRestoreFragmentProcessorState*
, |
| 230 GrPipelineBuilder::AutoRestoreStencil*, | 221 GrPipelineBuilder::AutoRestoreStencil*, |
| 231 GrScissorState*, | 222 GrScissorState*, |
| 232 const SkRect* devBounds) = 0; | 223 const SkRect* devBounds) = 0; |
| 233 | 224 |
| 234 GrGpu* fGpu; | 225 GrGpu* fGpu; |
| 235 const GrCaps* fCaps; | 226 const GrCaps* fCaps; |
| 236 GrResourceProvider* fResourceProvider; | 227 GrResourceProvider* fResourceProvider; |
| 237 bool fFlushing; | 228 bool fFlushing; |
| 229 GrBatchToken fLastFlushToken; |
| 238 | 230 |
| 239 typedef SkRefCnt INHERITED; | 231 typedef SkRefCnt INHERITED; |
| 240 }; | 232 }; |
| 241 | 233 |
| 242 /* | 234 /* |
| 243 * This class is JUST for clip mask manager. Everyone else should just use draw
target above. | 235 * This class is JUST for clip mask manager. Everyone else should just use draw
target above. |
| 244 */ | 236 */ |
| 245 class GrClipTarget : public GrDrawTarget { | 237 class GrClipTarget : public GrDrawTarget { |
| 246 public: | 238 public: |
| 247 GrClipTarget(GrContext*); | 239 GrClipTarget(GrContext*); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 276 bool setupClip(const GrPipelineBuilder&, | 268 bool setupClip(const GrPipelineBuilder&, |
| 277 GrPipelineBuilder::AutoRestoreFragmentProcessorState*, | 269 GrPipelineBuilder::AutoRestoreFragmentProcessorState*, |
| 278 GrPipelineBuilder::AutoRestoreStencil*, | 270 GrPipelineBuilder::AutoRestoreStencil*, |
| 279 GrScissorState* scissorState, | 271 GrScissorState* scissorState, |
| 280 const SkRect* devBounds) override; | 272 const SkRect* devBounds) override; |
| 281 | 273 |
| 282 typedef GrDrawTarget INHERITED; | 274 typedef GrDrawTarget INHERITED; |
| 283 }; | 275 }; |
| 284 | 276 |
| 285 #endif | 277 #endif |
| OLD | NEW |