OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrGpu_DEFINED | 8 #ifndef GrGpu_DEFINED |
9 #define GrGpu_DEFINED | 9 #define GrGpu_DEFINED |
10 | 10 |
11 #include "GrDrawTarget.h" | 11 #include "GrDrawTarget.h" |
12 #include "GrPathRendering.h" | 12 #include "GrPathRendering.h" |
13 #include "GrProgramDesc.h" | 13 #include "GrProgramDesc.h" |
14 #include "SkPath.h" | 14 #include "SkPath.h" |
15 | 15 |
16 class GrContext; | 16 class GrContext; |
17 class GrIndexBufferAllocPool; | 17 class GrIndexBufferAllocPool; |
18 class GrPath; | 18 class GrPath; |
19 class GrPathRange; | 19 class GrPathRange; |
20 class GrPathRenderer; | 20 class GrPathRenderer; |
21 class GrPathRendererChain; | 21 class GrPathRendererChain; |
22 class GrPipeline; | 22 class GrPipeline; |
23 class GrPrimitiveProcessor; | 23 class GrPrimitiveProcessor; |
24 class GrStencilAttachment; | 24 class GrStencilAttachment; |
25 class GrVertexBufferAllocPool; | 25 class GrVertexBufferAllocPool; |
| 26 class GrVertices; |
26 | 27 |
27 class GrGpu : public SkRefCnt { | 28 class GrGpu : public SkRefCnt { |
28 public: | 29 public: |
29 /** | 30 /** |
30 * Create an instance of GrGpu that matches the specified backend. If the re
quested backend is | 31 * Create an instance of GrGpu that matches the specified backend. If the re
quested backend is |
31 * not supported (at compile-time or run-time) this returns NULL. The contex
t will not be | 32 * not supported (at compile-time or run-time) this returns NULL. The contex
t will not be |
32 * fully constructed and should not be used by GrGpu until after this functi
on returns. | 33 * fully constructed and should not be used by GrGpu until after this functi
on returns. |
33 */ | 34 */ |
34 static GrGpu* Create(GrBackend, GrBackendContext, GrContext* context); | 35 static GrGpu* Create(GrBackend, GrBackendContext, GrContext* context); |
35 | 36 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 // src/dst bounds and non-empty. | 274 // src/dst bounds and non-empty. |
274 virtual bool copySurface(GrSurface* dst, | 275 virtual bool copySurface(GrSurface* dst, |
275 GrSurface* src, | 276 GrSurface* src, |
276 const SkIRect& srcRect, | 277 const SkIRect& srcRect, |
277 const SkIPoint& dstPoint) = 0; | 278 const SkIPoint& dstPoint) = 0; |
278 | 279 |
279 // Called before certain draws in order to guarantee coherent results from d
st reads. | 280 // Called before certain draws in order to guarantee coherent results from d
st reads. |
280 virtual void xferBarrier(GrXferBarrierType) = 0; | 281 virtual void xferBarrier(GrXferBarrierType) = 0; |
281 | 282 |
282 struct DrawArgs { | 283 struct DrawArgs { |
283 typedef GrDrawTarget::DrawInfo DrawInfo; | |
284 DrawArgs(const GrPrimitiveProcessor* primProc, | 284 DrawArgs(const GrPrimitiveProcessor* primProc, |
285 const GrPipeline* pipeline, | 285 const GrPipeline* pipeline, |
286 const GrProgramDesc* desc, | 286 const GrProgramDesc* desc, |
287 const GrBatchTracker* batchTracker) | 287 const GrBatchTracker* batchTracker) |
288 : fPrimitiveProcessor(primProc) | 288 : fPrimitiveProcessor(primProc) |
289 , fPipeline(pipeline) | 289 , fPipeline(pipeline) |
290 , fDesc(desc) | 290 , fDesc(desc) |
291 , fBatchTracker(batchTracker) { | 291 , fBatchTracker(batchTracker) { |
292 SkASSERT(primProc && pipeline && desc && batchTracker); | 292 SkASSERT(primProc && pipeline && desc && batchTracker); |
293 } | 293 } |
294 const GrPrimitiveProcessor* fPrimitiveProcessor; | 294 const GrPrimitiveProcessor* fPrimitiveProcessor; |
295 const GrPipeline* fPipeline; | 295 const GrPipeline* fPipeline; |
296 const GrProgramDesc* fDesc; | 296 const GrProgramDesc* fDesc; |
297 const GrBatchTracker* fBatchTracker; | 297 const GrBatchTracker* fBatchTracker; |
298 }; | 298 }; |
299 | 299 |
300 void draw(const DrawArgs&, const GrDrawTarget::DrawInfo&); | 300 void draw(const DrawArgs&, const GrVertices&); |
301 | 301 |
302 /** None of these params are optional, pointers used just to avoid making co
pies. */ | 302 /** None of these params are optional, pointers used just to avoid making co
pies. */ |
303 struct StencilPathState { | 303 struct StencilPathState { |
304 bool fUseHWAA; | 304 bool fUseHWAA; |
305 GrRenderTarget* fRenderTarget; | 305 GrRenderTarget* fRenderTarget; |
306 const SkMatrix* fViewMatrix; | 306 const SkMatrix* fViewMatrix; |
307 const GrStencilSettings* fStencil; | 307 const GrStencilSettings* fStencil; |
308 const GrScissorState* fScissor; | 308 const GrScissorState* fScissor; |
309 }; | 309 }; |
310 | 310 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 // overridden by backend-specific derived class to perform the clear. | 428 // overridden by backend-specific derived class to perform the clear. |
429 virtual void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, | 429 virtual void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, |
430 bool canIgnoreRect) = 0; | 430 bool canIgnoreRect) = 0; |
431 | 431 |
432 | 432 |
433 // Overridden by backend specific classes to perform a clear of the stencil
clip bits. This is | 433 // Overridden by backend specific classes to perform a clear of the stencil
clip bits. This is |
434 // ONLY used by the the clip target | 434 // ONLY used by the the clip target |
435 virtual void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool i
nsideClip) = 0; | 435 virtual void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool i
nsideClip) = 0; |
436 | 436 |
437 // overridden by backend-specific derived class to perform the draw call. | 437 // overridden by backend-specific derived class to perform the draw call. |
438 virtual void onDraw(const DrawArgs&, const GrDrawTarget::DrawInfo&) = 0; | 438 virtual void onDraw(const DrawArgs&, const GrVertices&) = 0; |
439 virtual void onStencilPath(const GrPath*, const StencilPathState&) = 0; | 439 virtual void onStencilPath(const GrPath*, const StencilPathState&) = 0; |
440 | 440 |
441 virtual void onDrawPath(const DrawArgs&, const GrPath*, const GrStencilSetti
ngs&) = 0; | 441 virtual void onDrawPath(const DrawArgs&, const GrPath*, const GrStencilSetti
ngs&) = 0; |
442 virtual void onDrawPaths(const DrawArgs&, | 442 virtual void onDrawPaths(const DrawArgs&, |
443 const GrPathRange*, | 443 const GrPathRange*, |
444 const void* indices, | 444 const void* indices, |
445 GrDrawTarget::PathIndexType, | 445 GrDrawTarget::PathIndexType, |
446 const float transformValues[], | 446 const float transformValues[], |
447 GrDrawTarget::PathTransformType, | 447 GrDrawTarget::PathTransformType, |
448 int count, | 448 int count, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 int fGpuTrac
eMarkerCount; | 496 int fGpuTrac
eMarkerCount; |
497 GrTraceMarkerSet fActiveT
raceMarkers; | 497 GrTraceMarkerSet fActiveT
raceMarkers; |
498 GrTraceMarkerSet fStoredT
raceMarkers; | 498 GrTraceMarkerSet fStoredT
raceMarkers; |
499 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 499 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
500 GrContext* fContext
; | 500 GrContext* fContext
; |
501 | 501 |
502 typedef SkRefCnt INHERITED; | 502 typedef SkRefCnt INHERITED; |
503 }; | 503 }; |
504 | 504 |
505 #endif | 505 #endif |
OLD | NEW |