| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 kDrawPaths_DrawType, | 308 kDrawPaths_DrawType, |
| 309 }; | 309 }; |
| 310 | 310 |
| 311 static bool IsPathRenderingDrawType(DrawType type) { | 311 static bool IsPathRenderingDrawType(DrawType type) { |
| 312 return kDrawPath_DrawType == type || kDrawPaths_DrawType == type; | 312 return kDrawPath_DrawType == type || kDrawPaths_DrawType == type; |
| 313 } | 313 } |
| 314 | 314 |
| 315 GrContext::GPUStats* gpuStats() { return &fGPUStats; } | 315 GrContext::GPUStats* gpuStats() { return &fGPUStats; } |
| 316 | 316 |
| 317 virtual void buildProgramDesc(const GrOptDrawState&, | 317 virtual void buildProgramDesc(const GrOptDrawState&, |
| 318 const GrProgramDesc::DescInfo&, | |
| 319 GrGpu::DrawType, | 318 GrGpu::DrawType, |
| 320 GrProgramDesc*) = 0; | 319 GrProgramDesc*) = 0; |
| 321 | 320 |
| 322 /** | 321 /** |
| 323 * Called at start and end of gpu trace marking | 322 * Called at start and end of gpu trace marking |
| 324 * GR_CREATE_GPU_TRACE_MARKER(marker_str, target) will automatically call th
ese at the start | 323 * GR_CREATE_GPU_TRACE_MARKER(marker_str, target) will automatically call th
ese at the start |
| 325 * and end of a code block respectively | 324 * and end of a code block respectively |
| 326 */ | 325 */ |
| 327 void addGpuTraceMarker(const GrGpuTraceMarker* marker); | 326 void addGpuTraceMarker(const GrGpuTraceMarker* marker); |
| 328 void removeGpuTraceMarker(const GrGpuTraceMarker* marker); | 327 void removeGpuTraceMarker(const GrGpuTraceMarker* marker); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 350 | 349 |
| 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 virtual void draw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&); | 359 virtual void draw(const GrOptDrawState&, const GrProgramDesc&, const GrDrawT
arget::DrawInfo&); |
| 361 virtual void stencilPath(const GrOptDrawState&, | 360 virtual void stencilPath(const GrOptDrawState&, |
| 361 const GrProgramDesc&, |
| 362 const GrPath*, | 362 const GrPath*, |
| 363 const GrStencilSettings&); | 363 const GrStencilSettings&); |
| 364 virtual void drawPath(const GrOptDrawState&, | 364 virtual void drawPath(const GrOptDrawState&, |
| 365 const GrProgramDesc&, |
| 365 const GrPath*, | 366 const GrPath*, |
| 366 const GrStencilSettings&); | 367 const GrStencilSettings&); |
| 367 virtual void drawPaths(const GrOptDrawState&, | 368 virtual void drawPaths(const GrOptDrawState&, |
| 369 const GrProgramDesc&, |
| 368 const GrPathRange*, | 370 const GrPathRange*, |
| 369 const void* indices, | 371 const void* indices, |
| 370 GrDrawTarget::PathIndexType, | 372 GrDrawTarget::PathIndexType, |
| 371 const float transformValues[], | 373 const float transformValues[], |
| 372 GrDrawTarget::PathTransformType, | 374 GrDrawTarget::PathTransformType, |
| 373 int count, | 375 int count, |
| 374 const GrStencilSettings&); | 376 const GrStencilSettings&); |
| 375 | 377 |
| 376 static DrawType PrimTypeToDrawType(GrPrimitiveType type) { | 378 static DrawType PrimTypeToDrawType(GrPrimitiveType type) { |
| 377 switch (type) { | 379 switch (type) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 // not be created. | 464 // not be created. |
| 463 virtual bool createStencilBufferForRenderTarget(GrRenderTarget*, int width,
int height) = 0; | 465 virtual bool createStencilBufferForRenderTarget(GrRenderTarget*, int width,
int height) = 0; |
| 464 | 466 |
| 465 // attaches an existing SB to an existing RT. | 467 // attaches an existing SB to an existing RT. |
| 466 virtual bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTar
get*) = 0; | 468 virtual bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTar
get*) = 0; |
| 467 | 469 |
| 468 // The GrGpu typically records the clients requested state and then flushes | 470 // The GrGpu typically records the clients requested state and then flushes |
| 469 // deltas from previous state at draw time. This function does the | 471 // deltas from previous state at draw time. This function does the |
| 470 // backend-specific flush of the state. | 472 // backend-specific flush of the state. |
| 471 // returns false if current state is unsupported. | 473 // returns false if current state is unsupported. |
| 472 virtual bool flushGraphicsState(const GrOptDrawState&, DrawType) = 0; | 474 virtual bool flushGraphicsState(const GrOptDrawState&, const GrProgramDesc&,
DrawType) = 0; |
| 473 | 475 |
| 474 // clears target's entire stencil buffer to 0 | 476 // clears target's entire stencil buffer to 0 |
| 475 virtual void clearStencil(GrRenderTarget* target) = 0; | 477 virtual void clearStencil(GrRenderTarget* target) = 0; |
| 476 | 478 |
| 477 // Given a rt, find or create a stencil buffer and attach it | 479 // Given a rt, find or create a stencil buffer and attach it |
| 478 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); | 480 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); |
| 479 | 481 |
| 480 virtual void didAddGpuTraceMarker() = 0; | 482 virtual void didAddGpuTraceMarker() = 0; |
| 481 virtual void didRemoveGpuTraceMarker() = 0; | 483 virtual void didRemoveGpuTraceMarker() = 0; |
| 482 | 484 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 500 int fGpuTrac
eMarkerCount; | 502 int fGpuTrac
eMarkerCount; |
| 501 GrTraceMarkerSet fActiveT
raceMarkers; | 503 GrTraceMarkerSet fActiveT
raceMarkers; |
| 502 GrTraceMarkerSet fStoredT
raceMarkers; | 504 GrTraceMarkerSet fStoredT
raceMarkers; |
| 503 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 505 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
| 504 GrContext* fContext
; | 506 GrContext* fContext
; |
| 505 | 507 |
| 506 typedef SkRefCnt INHERITED; | 508 typedef SkRefCnt INHERITED; |
| 507 }; | 509 }; |
| 508 | 510 |
| 509 #endif | 511 #endif |
| OLD | NEW |