| 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 330 |
| 331 void getPathStencilSettingsForFillType(SkPath::FillType fill, GrStencilSetti
ngs* outStencilSettings); | 331 void getPathStencilSettingsForFillType(SkPath::FillType fill, GrStencilSetti
ngs* outStencilSettings); |
| 332 | 332 |
| 333 protected: | 333 protected: |
| 334 enum DrawType { | 334 enum DrawType { |
| 335 kDrawPoints_DrawType, | 335 kDrawPoints_DrawType, |
| 336 kDrawLines_DrawType, | 336 kDrawLines_DrawType, |
| 337 kDrawTriangles_DrawType, | 337 kDrawTriangles_DrawType, |
| 338 kStencilPath_DrawType, | 338 kStencilPath_DrawType, |
| 339 kDrawPath_DrawType, | 339 kDrawPath_DrawType, |
| 340 kDrawPaths_DrawType, |
| 340 }; | 341 }; |
| 341 | 342 |
| 342 DrawType PrimTypeToDrawType(GrPrimitiveType type) { | 343 DrawType PrimTypeToDrawType(GrPrimitiveType type) { |
| 343 switch (type) { | 344 switch (type) { |
| 344 case kTriangles_GrPrimitiveType: | 345 case kTriangles_GrPrimitiveType: |
| 345 case kTriangleStrip_GrPrimitiveType: | 346 case kTriangleStrip_GrPrimitiveType: |
| 346 case kTriangleFan_GrPrimitiveType: | 347 case kTriangleFan_GrPrimitiveType: |
| 347 return kDrawTriangles_DrawType; | 348 return kDrawTriangles_DrawType; |
| 348 case kPoints_GrPrimitiveType: | 349 case kPoints_GrPrimitiveType: |
| 349 return kDrawPoints_DrawType; | 350 return kDrawPoints_DrawType; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 // clearRect. NULL rect means clear whole target. If canIgnoreRect is | 432 // clearRect. NULL rect means clear whole target. If canIgnoreRect is |
| 432 // true, it is okay to perform a full clear instead of a partial clear | 433 // true, it is okay to perform a full clear instead of a partial clear |
| 433 virtual void onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect)
= 0; | 434 virtual void onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect)
= 0; |
| 434 | 435 |
| 435 // overridden by backend-specific derived class to perform the draw call. | 436 // overridden by backend-specific derived class to perform the draw call. |
| 436 virtual void onGpuDraw(const DrawInfo&) = 0; | 437 virtual void onGpuDraw(const DrawInfo&) = 0; |
| 437 | 438 |
| 438 // overridden by backend-specific derived class to perform the path stencili
ng. | 439 // overridden by backend-specific derived class to perform the path stencili
ng. |
| 439 virtual void onGpuStencilPath(const GrPath*, SkPath::FillType) = 0; | 440 virtual void onGpuStencilPath(const GrPath*, SkPath::FillType) = 0; |
| 440 virtual void onGpuDrawPath(const GrPath*, SkPath::FillType) = 0; | 441 virtual void onGpuDrawPath(const GrPath*, SkPath::FillType) = 0; |
| 442 virtual void onGpuDrawPaths(size_t, const GrPath**, const SkMatrix*, |
| 443 SkPath::FillType, SkStrokeRec::Style) = 0; |
| 441 | 444 |
| 442 // overridden by backend-specific derived class to perform flush | 445 // overridden by backend-specific derived class to perform flush |
| 443 virtual void onForceRenderTargetFlush() = 0; | 446 virtual void onForceRenderTargetFlush() = 0; |
| 444 | 447 |
| 445 // overridden by backend-specific derived class to perform the read pixels. | 448 // overridden by backend-specific derived class to perform the read pixels. |
| 446 virtual bool onReadPixels(GrRenderTarget* target, | 449 virtual bool onReadPixels(GrRenderTarget* target, |
| 447 int left, int top, int width, int height, | 450 int left, int top, int width, int height, |
| 448 GrPixelConfig, | 451 GrPixelConfig, |
| 449 void* buffer, | 452 void* buffer, |
| 450 size_t rowBytes) = 0; | 453 size_t rowBytes) = 0; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 476 virtual void clearStencil() = 0; | 479 virtual void clearStencil() = 0; |
| 477 | 480 |
| 478 // Given a rt, find or create a stencil buffer and attach it | 481 // Given a rt, find or create a stencil buffer and attach it |
| 479 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); | 482 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); |
| 480 | 483 |
| 481 // GrDrawTarget overrides | 484 // GrDrawTarget overrides |
| 482 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; | 485 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; |
| 483 virtual void onStencilPath(const GrPath*, SkPath::FillType) SK_OVERRIDE; | 486 virtual void onStencilPath(const GrPath*, SkPath::FillType) SK_OVERRIDE; |
| 484 virtual void onDrawPath(const GrPath*, SkPath::FillType, | 487 virtual void onDrawPath(const GrPath*, SkPath::FillType, |
| 485 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; | 488 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; |
| 489 virtual void onDrawPaths(size_t, const GrPath**, const SkMatrix*, |
| 490 SkPath::FillType, SkStrokeRec::Style, |
| 491 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; |
| 486 | 492 |
| 487 // readies the pools to provide vertex/index data. | 493 // readies the pools to provide vertex/index data. |
| 488 void prepareVertexPool(); | 494 void prepareVertexPool(); |
| 489 void prepareIndexPool(); | 495 void prepareIndexPool(); |
| 490 | 496 |
| 491 void resetContext() { | 497 void resetContext() { |
| 492 // We call this because the client may have messed with the | 498 // We call this because the client may have messed with the |
| 493 // stencil buffer. Perhaps we should detect whether it is a | 499 // stencil buffer. Perhaps we should detect whether it is a |
| 494 // internally created stencil buffer and if so skip the invalidate. | 500 // internally created stencil buffer and if so skip the invalidate. |
| 495 fClipMaskManager.invalidateStencilMask(); | 501 fClipMaskManager.invalidateStencilMask(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 519 // these are mutable so they can be created on-demand | 525 // these are mutable so they can be created on-demand |
| 520 mutable GrIndexBuffer* fQuadInd
exBuffer; | 526 mutable GrIndexBuffer* fQuadInd
exBuffer; |
| 521 // Used to abandon/release all resources created by this GrGpu. TODO: Move t
his | 527 // Used to abandon/release all resources created by this GrGpu. TODO: Move t
his |
| 522 // functionality to GrResourceCache. | 528 // functionality to GrResourceCache. |
| 523 ResourceList fResourc
eList; | 529 ResourceList fResourc
eList; |
| 524 | 530 |
| 525 typedef GrDrawTarget INHERITED; | 531 typedef GrDrawTarget INHERITED; |
| 526 }; | 532 }; |
| 527 | 533 |
| 528 #endif | 534 #endif |
| OLD | NEW |