| 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 |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 static const ResetTimestamp kExpiredTimestamp = 0; | 296 static const ResetTimestamp kExpiredTimestamp = 0; |
| 297 // Returns a timestamp based on the number of times the context was reset. | 297 // Returns a timestamp based on the number of times the context was reset. |
| 298 // This timestamp can be used to lazily detect when cached 3D context state | 298 // This timestamp can be used to lazily detect when cached 3D context state |
| 299 // is dirty. | 299 // is dirty. |
| 300 ResetTimestamp getResetTimestamp() const { return fResetTimestamp; } | 300 ResetTimestamp getResetTimestamp() const { return fResetTimestamp; } |
| 301 | 301 |
| 302 enum DrawType { | 302 enum DrawType { |
| 303 kDrawPoints_DrawType, | 303 kDrawPoints_DrawType, |
| 304 kDrawLines_DrawType, | 304 kDrawLines_DrawType, |
| 305 kDrawTriangles_DrawType, | 305 kDrawTriangles_DrawType, |
| 306 kStencilPath_DrawType, | |
| 307 kDrawPath_DrawType, | 306 kDrawPath_DrawType, |
| 308 kDrawPaths_DrawType, | 307 kDrawPaths_DrawType, |
| 309 }; | 308 }; |
| 310 | 309 |
| 311 static bool IsPathRenderingDrawType(DrawType type) { | 310 static bool IsPathRenderingDrawType(DrawType type) { |
| 312 return kDrawPath_DrawType == type || kDrawPaths_DrawType == type; | 311 return kDrawPath_DrawType == type || kDrawPaths_DrawType == type; |
| 313 } | 312 } |
| 314 | 313 |
| 315 GrContext::GPUStats* gpuStats() { return &fGPUStats; } | 314 GrContext::GPUStats* gpuStats() { return &fGPUStats; } |
| 316 | 315 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 // Called to perform a surface to surface copy. Fallbacks to issuing a draw
from the src to dst | 350 // Called to perform a surface to surface copy. Fallbacks to issuing a draw
from the src to dst |
| 352 // take place at the GrDrawTarget level and this function implement faster c
opy paths. The rect | 351 // take place at the GrDrawTarget level and this function implement faster c
opy paths. The rect |
| 353 // and point are pre-clipped. The src rect and implied dst rect are guarante
ed to be within the | 352 // and point are pre-clipped. The src rect and implied dst rect are guarante
ed to be within the |
| 354 // src/dst bounds and non-empty. | 353 // src/dst bounds and non-empty. |
| 355 virtual bool copySurface(GrSurface* dst, | 354 virtual bool copySurface(GrSurface* dst, |
| 356 GrSurface* src, | 355 GrSurface* src, |
| 357 const SkIRect& srcRect, | 356 const SkIRect& srcRect, |
| 358 const SkIPoint& dstPoint) = 0; | 357 const SkIPoint& dstPoint) = 0; |
| 359 | 358 |
| 360 void draw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&); | 359 void draw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&); |
| 361 void stencilPath(const GrOptDrawState&, const GrPath*, const GrStencilSettin
gs&); | 360 |
| 361 /** None of these params are optional, pointers used just to avoid making co
pies. */ |
| 362 struct StencilPathState { |
| 363 bool fUseHWAA; |
| 364 GrRenderTarget* fRenderTarget; |
| 365 const SkMatrix* fViewMatrix; |
| 366 const GrStencilSettings* fStencil; |
| 367 const GrScissorState* fScissor; |
| 368 }; |
| 369 |
| 370 void stencilPath(const GrPath*, const StencilPathState&); |
| 371 |
| 362 void drawPath(const GrOptDrawState&, const GrPath*, const GrStencilSettings&
); | 372 void drawPath(const GrOptDrawState&, const GrPath*, const GrStencilSettings&
); |
| 363 void drawPaths(const GrOptDrawState&, | 373 void drawPaths(const GrOptDrawState&, |
| 364 const GrPathRange*, | 374 const GrPathRange*, |
| 365 const void* indices, | 375 const void* indices, |
| 366 GrDrawTarget::PathIndexType, | 376 GrDrawTarget::PathIndexType, |
| 367 const float transformValues[], | 377 const float transformValues[], |
| 368 GrDrawTarget::PathTransformType, | 378 GrDrawTarget::PathTransformType, |
| 369 int count, | 379 int count, |
| 370 const GrStencilSettings&); | 380 const GrStencilSettings&); |
| 371 | 381 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 439 |
| 430 | 440 |
| 431 // Overridden by backend specific classes to perform a clear of the stencil
clip bits. This is | 441 // Overridden by backend specific classes to perform a clear of the stencil
clip bits. This is |
| 432 // ONLY used by the the clip target | 442 // ONLY used by the the clip target |
| 433 virtual void onClearStencilClip(GrRenderTarget*, | 443 virtual void onClearStencilClip(GrRenderTarget*, |
| 434 const SkIRect& rect, | 444 const SkIRect& rect, |
| 435 bool insideClip) = 0; | 445 bool insideClip) = 0; |
| 436 | 446 |
| 437 // overridden by backend-specific derived class to perform the draw call. | 447 // overridden by backend-specific derived class to perform the draw call. |
| 438 virtual void onDraw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&) =
0; | 448 virtual void onDraw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&) =
0; |
| 439 virtual void onStencilPath(const GrOptDrawState&, const GrPath*, const GrSte
ncilSettings&) = 0; | 449 virtual void onStencilPath(const GrPath*, const StencilPathState&) = 0; |
| 450 |
| 440 virtual void onDrawPath(const GrOptDrawState&, const GrPath*, const GrStenci
lSettings&) = 0; | 451 virtual void onDrawPath(const GrOptDrawState&, const GrPath*, const GrStenci
lSettings&) = 0; |
| 441 virtual void onDrawPaths(const GrOptDrawState&, | 452 virtual void onDrawPaths(const GrOptDrawState&, |
| 442 const GrPathRange*, | 453 const GrPathRange*, |
| 443 const void* indices, | 454 const void* indices, |
| 444 GrDrawTarget::PathIndexType, | 455 GrDrawTarget::PathIndexType, |
| 445 const float transformValues[], | 456 const float transformValues[], |
| 446 GrDrawTarget::PathTransformType, | 457 GrDrawTarget::PathTransformType, |
| 447 int count, | 458 int count, |
| 448 const GrStencilSettings&) = 0; | 459 const GrStencilSettings&) = 0; |
| 449 | 460 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 int fGpuTrac
eMarkerCount; | 511 int fGpuTrac
eMarkerCount; |
| 501 GrTraceMarkerSet fActiveT
raceMarkers; | 512 GrTraceMarkerSet fActiveT
raceMarkers; |
| 502 GrTraceMarkerSet fStoredT
raceMarkers; | 513 GrTraceMarkerSet fStoredT
raceMarkers; |
| 503 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 514 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
| 504 GrContext* fContext
; | 515 GrContext* fContext
; |
| 505 | 516 |
| 506 typedef SkRefCnt INHERITED; | 517 typedef SkRefCnt INHERITED; |
| 507 }; | 518 }; |
| 508 | 519 |
| 509 #endif | 520 #endif |
| OLD | NEW |