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" | 12 #include "GrClipMaskManager.h" |
13 #include "GrContext.h" | 13 #include "GrContext.h" |
14 #include "GrPathProcessor.h" | 14 #include "GrPathProcessor.h" |
15 #include "GrPrimitiveProcessor.h" | 15 #include "GrPrimitiveProcessor.h" |
16 #include "GrIndexBuffer.h" | 16 #include "GrIndexBuffer.h" |
17 #include "GrPathRendering.h" | 17 #include "GrPathRendering.h" |
18 #include "GrPipelineBuilder.h" | 18 #include "GrPipelineBuilder.h" |
19 #include "GrTraceMarker.h" | 19 #include "GrTraceMarker.h" |
20 #include "GrVertexBuffer.h" | 20 #include "GrVertexBuffer.h" |
| 21 #include "GrXferProcessor.h" |
21 | 22 |
22 #include "SkClipStack.h" | 23 #include "SkClipStack.h" |
23 #include "SkMatrix.h" | 24 #include "SkMatrix.h" |
24 #include "SkPath.h" | 25 #include "SkPath.h" |
25 #include "SkStrokeRec.h" | 26 #include "SkStrokeRec.h" |
26 #include "SkTArray.h" | 27 #include "SkTArray.h" |
27 #include "SkTLazy.h" | 28 #include "SkTLazy.h" |
28 #include "SkTypes.h" | 29 #include "SkTypes.h" |
29 #include "SkXfermode.h" | 30 #include "SkXfermode.h" |
30 | 31 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 224 } |
224 | 225 |
225 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers
; } | 226 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers
; } |
226 | 227 |
227 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required | 228 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required |
228 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it | 229 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it |
229 // needs to be accessed by GLPrograms to setup a correct drawstate | 230 // needs to be accessed by GLPrograms to setup a correct drawstate |
230 bool setupDstReadIfNecessary(const GrPipelineBuilder&, | 231 bool setupDstReadIfNecessary(const GrPipelineBuilder&, |
231 const GrProcOptInfo& colorPOI, | 232 const GrProcOptInfo& colorPOI, |
232 const GrProcOptInfo& coveragePOI, | 233 const GrProcOptInfo& coveragePOI, |
233 GrDeviceCoordTexture* dstCopy, | 234 GrXferProcessor::DstTexture*, |
234 const SkRect* drawBounds); | 235 const SkRect* drawBounds); |
235 | 236 |
236 struct PipelineInfo { | 237 struct PipelineInfo { |
237 PipelineInfo(GrPipelineBuilder* pipelineBuilder, GrScissorState* scissor
, | 238 PipelineInfo(GrPipelineBuilder* pipelineBuilder, GrScissorState* scissor
, |
238 const GrPrimitiveProcessor* primProc, | 239 const GrPrimitiveProcessor* primProc, |
239 const SkRect* devBounds, GrDrawTarget* target); | 240 const SkRect* devBounds, GrDrawTarget* target); |
240 | 241 |
241 PipelineInfo(GrPipelineBuilder* pipelineBuilder, GrScissorState* scissor
, | 242 PipelineInfo(GrPipelineBuilder* pipelineBuilder, GrScissorState* scissor
, |
242 const GrBatch* batch, const SkRect* devBounds, | 243 const GrBatch* batch, const SkRect* devBounds, |
243 GrDrawTarget* target); | 244 GrDrawTarget* target); |
244 | 245 |
245 bool willBlendWithDst(const GrPrimitiveProcessor* primProc) const { | 246 bool willBlendWithDst(const GrPrimitiveProcessor* primProc) const { |
246 return fPipelineBuilder->willBlendWithDst(primProc); | 247 return fPipelineBuilder->willBlendWithDst(primProc); |
247 } | 248 } |
248 private: | 249 private: |
249 friend class GrDrawTarget; | 250 friend class GrDrawTarget; |
250 | 251 |
251 bool mustSkipDraw() const { return (NULL == fPipelineBuilder); } | 252 bool mustSkipDraw() const { return (NULL == fPipelineBuilder); } |
252 | 253 |
253 GrPipelineBuilder* fPipelineBuilder; | 254 GrPipelineBuilder* fPipelineBuilder; |
254 GrScissorState* fScissor; | 255 GrScissorState* fScissor; |
255 GrProcOptInfo fColorPOI; | 256 GrProcOptInfo fColorPOI; |
256 GrProcOptInfo fCoveragePOI; | 257 GrProcOptInfo fCoveragePOI; |
257 GrDeviceCoordTexture fDstCopy; | 258 GrXferProcessor::DstTexture fDstTexture; |
258 }; | 259 }; |
259 | 260 |
260 void setupPipeline(const PipelineInfo& pipelineInfo, GrPipeline* pipeline); | 261 void setupPipeline(const PipelineInfo& pipelineInfo, GrPipeline* pipeline); |
261 | 262 |
262 private: | 263 private: |
263 virtual void onReset() = 0; | 264 virtual void onReset() = 0; |
264 | 265 |
265 virtual void onFlush() = 0; | 266 virtual void onFlush() = 0; |
266 | 267 |
267 virtual void onDrawBatch(GrBatch*, const PipelineInfo&) = 0; | 268 virtual void onDrawBatch(GrBatch*, const PipelineInfo&) = 0; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 virtual bool setupClip(GrPipelineBuilder*, | 362 virtual bool setupClip(GrPipelineBuilder*, |
362 GrPipelineBuilder::AutoRestoreFragmentProcessors*, | 363 GrPipelineBuilder::AutoRestoreFragmentProcessors*, |
363 GrPipelineBuilder::AutoRestoreStencil*, | 364 GrPipelineBuilder::AutoRestoreStencil*, |
364 GrScissorState* scissorState, | 365 GrScissorState* scissorState, |
365 const SkRect* devBounds) override; | 366 const SkRect* devBounds) override; |
366 | 367 |
367 typedef GrDrawTarget INHERITED; | 368 typedef GrDrawTarget INHERITED; |
368 }; | 369 }; |
369 | 370 |
370 #endif | 371 #endif |
OLD | NEW |