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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 231 } |
231 | 232 |
232 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers
; } | 233 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers
; } |
233 | 234 |
234 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required | 235 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required |
235 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it | 236 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it |
236 // needs to be accessed by GLPrograms to setup a correct drawstate | 237 // needs to be accessed by GLPrograms to setup a correct drawstate |
237 bool setupDstReadIfNecessary(const GrPipelineBuilder&, | 238 bool setupDstReadIfNecessary(const GrPipelineBuilder&, |
238 const GrProcOptInfo& colorPOI, | 239 const GrProcOptInfo& colorPOI, |
239 const GrProcOptInfo& coveragePOI, | 240 const GrProcOptInfo& coveragePOI, |
240 GrDeviceCoordTexture* dstCopy, | 241 GrXferProcessor::DstTexture*, |
241 const SkRect* drawBounds); | 242 const SkRect* drawBounds); |
242 | 243 |
243 struct PipelineInfo { | 244 struct PipelineInfo { |
244 PipelineInfo(GrPipelineBuilder* pipelineBuilder, GrScissorState* scissor
, | 245 PipelineInfo(GrPipelineBuilder* pipelineBuilder, GrScissorState* scissor
, |
245 const GrPrimitiveProcessor* primProc, | 246 const GrPrimitiveProcessor* primProc, |
246 const SkRect* devBounds, GrDrawTarget* target); | 247 const SkRect* devBounds, GrDrawTarget* target); |
247 | 248 |
248 PipelineInfo(GrPipelineBuilder* pipelineBuilder, GrScissorState* scissor
, | 249 PipelineInfo(GrPipelineBuilder* pipelineBuilder, GrScissorState* scissor
, |
249 const GrBatch* batch, const SkRect* devBounds, | 250 const GrBatch* batch, const SkRect* devBounds, |
250 GrDrawTarget* target); | 251 GrDrawTarget* target); |
251 | 252 |
252 bool willBlendWithDst(const GrPrimitiveProcessor* primProc) const { | 253 bool willBlendWithDst(const GrPrimitiveProcessor* primProc) const { |
253 return fPipelineBuilder->willBlendWithDst(primProc); | 254 return fPipelineBuilder->willBlendWithDst(primProc); |
254 } | 255 } |
255 private: | 256 private: |
256 friend class GrDrawTarget; | 257 friend class GrDrawTarget; |
257 | 258 |
258 bool mustSkipDraw() const { return (NULL == fPipelineBuilder); } | 259 bool mustSkipDraw() const { return (NULL == fPipelineBuilder); } |
259 | 260 |
260 GrPipelineBuilder* fPipelineBuilder; | 261 GrPipelineBuilder* fPipelineBuilder; |
261 GrScissorState* fScissor; | 262 GrScissorState* fScissor; |
262 GrProcOptInfo fColorPOI; | 263 GrProcOptInfo fColorPOI; |
263 GrProcOptInfo fCoveragePOI; | 264 GrProcOptInfo fCoveragePOI; |
264 GrDeviceCoordTexture fDstCopy; | 265 GrXferProcessor::DstTexture fDstTexture; |
265 }; | 266 }; |
266 | 267 |
267 void setupPipeline(const PipelineInfo& pipelineInfo, GrPipeline* pipeline); | 268 void setupPipeline(const PipelineInfo& pipelineInfo, GrPipeline* pipeline); |
268 | 269 |
269 private: | 270 private: |
270 virtual void onReset() = 0; | 271 virtual void onReset() = 0; |
271 | 272 |
272 virtual void onFlush() = 0; | 273 virtual void onFlush() = 0; |
273 | 274 |
274 virtual void onDrawBatch(GrBatch*, const PipelineInfo&) = 0; | 275 virtual void onDrawBatch(GrBatch*, const PipelineInfo&) = 0; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 virtual bool setupClip(GrPipelineBuilder*, | 369 virtual bool setupClip(GrPipelineBuilder*, |
369 GrPipelineBuilder::AutoRestoreFragmentProcessors*, | 370 GrPipelineBuilder::AutoRestoreFragmentProcessors*, |
370 GrPipelineBuilder::AutoRestoreStencil*, | 371 GrPipelineBuilder::AutoRestoreStencil*, |
371 GrScissorState* scissorState, | 372 GrScissorState* scissorState, |
372 const SkRect* devBounds) override; | 373 const SkRect* devBounds) override; |
373 | 374 |
374 typedef GrDrawTarget INHERITED; | 375 typedef GrDrawTarget INHERITED; |
375 }; | 376 }; |
376 | 377 |
377 #endif | 378 #endif |
OLD | NEW |