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