| 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 309 |
| 310 static bool IsPathRenderingDrawType(DrawType type) { | 310 static bool IsPathRenderingDrawType(DrawType type) { |
| 311 return kDrawPath_DrawType == type || kDrawPaths_DrawType == type; | 311 return kDrawPath_DrawType == type || kDrawPaths_DrawType == type; |
| 312 } | 312 } |
| 313 | 313 |
| 314 GrContext::GPUStats* gpuStats() { return &fGPUStats; } | 314 GrContext::GPUStats* gpuStats() { return &fGPUStats; } |
| 315 | 315 |
| 316 virtual void buildProgramDesc(const GrOptDrawState&, | 316 virtual void buildProgramDesc(const GrOptDrawState&, |
| 317 const GrProgramDesc::DescInfo&, | 317 const GrProgramDesc::DescInfo&, |
| 318 GrGpu::DrawType, | 318 GrGpu::DrawType, |
| 319 const GrDeviceCoordTexture* dstCopy, | |
| 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); |
| 329 | 328 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 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 GrDrawTarget::DrawInfo&); |
| 361 virtual void stencilPath(const GrOptDrawState&, | 360 virtual void stencilPath(const GrOptDrawState&, |
| 362 const GrPath*, | 361 const GrPath*, |
| 363 const GrStencilSettings&); | 362 const GrStencilSettings&); |
| 364 virtual void drawPath(const GrOptDrawState&, | 363 virtual void drawPath(const GrOptDrawState&, |
| 365 const GrPath*, | 364 const GrPath*, |
| 366 const GrStencilSettings&, | 365 const GrStencilSettings&); |
| 367 const GrDeviceCoordTexture* dstCopy); | |
| 368 virtual void drawPaths(const GrOptDrawState&, | 366 virtual void drawPaths(const GrOptDrawState&, |
| 369 const GrPathRange*, | 367 const GrPathRange*, |
| 370 const uint32_t indices[], | 368 const uint32_t indices[], |
| 371 int count, | 369 int count, |
| 372 const float transforms[], | 370 const float transforms[], |
| 373 GrDrawTarget::PathTransformType, | 371 GrDrawTarget::PathTransformType, |
| 374 const GrStencilSettings&, | 372 const GrStencilSettings&); |
| 375 const GrDeviceCoordTexture*); | |
| 376 | 373 |
| 377 static DrawType PrimTypeToDrawType(GrPrimitiveType type) { | 374 static DrawType PrimTypeToDrawType(GrPrimitiveType type) { |
| 378 switch (type) { | 375 switch (type) { |
| 379 case kTriangles_GrPrimitiveType: | 376 case kTriangles_GrPrimitiveType: |
| 380 case kTriangleStrip_GrPrimitiveType: | 377 case kTriangleStrip_GrPrimitiveType: |
| 381 case kTriangleFan_GrPrimitiveType: | 378 case kTriangleFan_GrPrimitiveType: |
| 382 return kDrawTriangles_DrawType; | 379 return kDrawTriangles_DrawType; |
| 383 case kPoints_GrPrimitiveType: | 380 case kPoints_GrPrimitiveType: |
| 384 return kDrawPoints_DrawType; | 381 return kDrawPoints_DrawType; |
| 385 case kLines_GrPrimitiveType: | 382 case kLines_GrPrimitiveType: |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 // not be created. | 460 // not be created. |
| 464 virtual bool createStencilBufferForRenderTarget(GrRenderTarget*, int width,
int height) = 0; | 461 virtual bool createStencilBufferForRenderTarget(GrRenderTarget*, int width,
int height) = 0; |
| 465 | 462 |
| 466 // attaches an existing SB to an existing RT. | 463 // attaches an existing SB to an existing RT. |
| 467 virtual bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTar
get*) = 0; | 464 virtual bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTar
get*) = 0; |
| 468 | 465 |
| 469 // The GrGpu typically records the clients requested state and then flushes | 466 // The GrGpu typically records the clients requested state and then flushes |
| 470 // deltas from previous state at draw time. This function does the | 467 // deltas from previous state at draw time. This function does the |
| 471 // backend-specific flush of the state. | 468 // backend-specific flush of the state. |
| 472 // returns false if current state is unsupported. | 469 // returns false if current state is unsupported. |
| 473 virtual bool flushGraphicsState(const GrOptDrawState&, | 470 virtual bool flushGraphicsState(const GrOptDrawState&, DrawType) = 0; |
| 474 DrawType, | |
| 475 const GrDeviceCoordTexture* dstCopy) = 0; | |
| 476 | 471 |
| 477 // clears target's entire stencil buffer to 0 | 472 // clears target's entire stencil buffer to 0 |
| 478 virtual void clearStencil(GrRenderTarget* target) = 0; | 473 virtual void clearStencil(GrRenderTarget* target) = 0; |
| 479 | 474 |
| 480 // Given a rt, find or create a stencil buffer and attach it | 475 // Given a rt, find or create a stencil buffer and attach it |
| 481 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); | 476 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); |
| 482 | 477 |
| 483 virtual void didAddGpuTraceMarker() = 0; | 478 virtual void didAddGpuTraceMarker() = 0; |
| 484 virtual void didRemoveGpuTraceMarker() = 0; | 479 virtual void didRemoveGpuTraceMarker() = 0; |
| 485 | 480 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 503 int fGpuTrac
eMarkerCount; | 498 int fGpuTrac
eMarkerCount; |
| 504 GrTraceMarkerSet fActiveT
raceMarkers; | 499 GrTraceMarkerSet fActiveT
raceMarkers; |
| 505 GrTraceMarkerSet fStoredT
raceMarkers; | 500 GrTraceMarkerSet fStoredT
raceMarkers; |
| 506 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 501 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
| 507 GrContext* fContext
; | 502 GrContext* fContext
; |
| 508 | 503 |
| 509 typedef SkRefCnt INHERITED; | 504 typedef SkRefCnt INHERITED; |
| 510 }; | 505 }; |
| 511 | 506 |
| 512 #endif | 507 #endif |
| OLD | NEW |