| 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 virtual void clearStencilClip(const SkIRect& rect, bool insideClip) = 0; | 328 virtual void clearStencilClip(const SkIRect& rect, bool insideClip) = 0; |
| 329 | 329 |
| 330 enum PrivateDrawStateStateBits { | 330 enum PrivateDrawStateStateBits { |
| 331 kFirstBit = (GrDrawState::kLastPublicStateBit << 1), | 331 kFirstBit = (GrDrawState::kLastPublicStateBit << 1), |
| 332 | 332 |
| 333 kModifyStencilClip_StateBit = kFirstBit, // allows draws to modify | 333 kModifyStencilClip_StateBit = kFirstBit, // allows draws to modify |
| 334 // stencil bits used for | 334 // stencil bits used for |
| 335 // clipping. | 335 // clipping. |
| 336 }; | 336 }; |
| 337 | 337 |
| 338 void getPathStencilSettingsForFillType(SkPath::FillType fill, GrStencilSetti
ngs* outStencilSettings); |
| 339 |
| 338 protected: | 340 protected: |
| 339 enum DrawType { | 341 enum DrawType { |
| 340 kDrawPoints_DrawType, | 342 kDrawPoints_DrawType, |
| 341 kDrawLines_DrawType, | 343 kDrawLines_DrawType, |
| 342 kDrawTriangles_DrawType, | 344 kDrawTriangles_DrawType, |
| 343 kStencilPath_DrawType, | 345 kStencilPath_DrawType, |
| 346 kFillPath_DrawType, |
| 344 }; | 347 }; |
| 345 | 348 |
| 346 DrawType PrimTypeToDrawType(GrPrimitiveType type) { | 349 DrawType PrimTypeToDrawType(GrPrimitiveType type) { |
| 347 switch (type) { | 350 switch (type) { |
| 348 case kTriangles_GrPrimitiveType: | 351 case kTriangles_GrPrimitiveType: |
| 349 case kTriangleStrip_GrPrimitiveType: | 352 case kTriangleStrip_GrPrimitiveType: |
| 350 case kTriangleFan_GrPrimitiveType: | 353 case kTriangleFan_GrPrimitiveType: |
| 351 return kDrawTriangles_DrawType; | 354 return kDrawTriangles_DrawType; |
| 352 case kPoints_GrPrimitiveType: | 355 case kPoints_GrPrimitiveType: |
| 353 return kDrawPoints_DrawType; | 356 return kDrawPoints_DrawType; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 virtual GrVertexBuffer* onCreateVertexBuffer(uint32_t size, bool dynamic) =
0; | 436 virtual GrVertexBuffer* onCreateVertexBuffer(uint32_t size, bool dynamic) =
0; |
| 434 virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size, bool dynamic) = 0; | 437 virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size, bool dynamic) = 0; |
| 435 virtual GrPath* onCreatePath(const SkPath& path) = 0; | 438 virtual GrPath* onCreatePath(const SkPath& path) = 0; |
| 436 | 439 |
| 437 // overridden by backend-specific derived class to perform the clear and | 440 // overridden by backend-specific derived class to perform the clear and |
| 438 // clearRect. NULL rect means clear whole target. | 441 // clearRect. NULL rect means clear whole target. |
| 439 virtual void onClear(const SkIRect* rect, GrColor color) = 0; | 442 virtual void onClear(const SkIRect* rect, GrColor color) = 0; |
| 440 | 443 |
| 441 // overridden by backend-specific derived class to perform the draw call. | 444 // overridden by backend-specific derived class to perform the draw call. |
| 442 virtual void onGpuDraw(const DrawInfo&) = 0; | 445 virtual void onGpuDraw(const DrawInfo&) = 0; |
| 443 // when GrDrawTarget::stencilPath is called the draw state's current stencil | 446 |
| 444 // settings are ignored. Instead the GrGpu decides the stencil rules | |
| 445 // necessary to stencil the path. These are still subject to filtering by | |
| 446 // the clip mask manager. | |
| 447 virtual void setStencilPathSettings(const GrPath&, | |
| 448 SkPath::FillType, | |
| 449 GrStencilSettings* settings) = 0; | |
| 450 // overridden by backend-specific derived class to perform the path stencili
ng. | 447 // overridden by backend-specific derived class to perform the path stencili
ng. |
| 451 virtual void onGpuStencilPath(const GrPath*, SkPath::FillType) = 0; | 448 virtual void onGpuStencilPath(const GrPath*, SkPath::FillType) = 0; |
| 449 virtual void onGpuFillPath(const GrPath*, SkPath::FillType) = 0; |
| 452 | 450 |
| 453 // overridden by backend-specific derived class to perform flush | 451 // overridden by backend-specific derived class to perform flush |
| 454 virtual void onForceRenderTargetFlush() = 0; | 452 virtual void onForceRenderTargetFlush() = 0; |
| 455 | 453 |
| 456 // overridden by backend-specific derived class to perform the read pixels. | 454 // overridden by backend-specific derived class to perform the read pixels. |
| 457 virtual bool onReadPixels(GrRenderTarget* target, | 455 virtual bool onReadPixels(GrRenderTarget* target, |
| 458 int left, int top, int width, int height, | 456 int left, int top, int width, int height, |
| 459 GrPixelConfig, | 457 GrPixelConfig, |
| 460 void* buffer, | 458 void* buffer, |
| 461 size_t rowBytes) = 0; | 459 size_t rowBytes) = 0; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 487 virtual void clearStencil() = 0; | 485 virtual void clearStencil() = 0; |
| 488 | 486 |
| 489 // Given a rt, find or create a stencil buffer and attach it | 487 // Given a rt, find or create a stencil buffer and attach it |
| 490 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); | 488 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); |
| 491 | 489 |
| 492 // GrDrawTarget overrides | 490 // GrDrawTarget overrides |
| 493 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; | 491 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; |
| 494 virtual void onStencilPath(const GrPath* path, const SkStrokeRec& stroke, | 492 virtual void onStencilPath(const GrPath* path, const SkStrokeRec& stroke, |
| 495 SkPath::FillType) SK_OVERRIDE; | 493 SkPath::FillType) SK_OVERRIDE; |
| 496 | 494 |
| 495 virtual void onFillPath(const GrPath* path, const SkStrokeRec& stroke, SkPat
h::FillType, |
| 496 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; |
| 497 |
| 497 // readies the pools to provide vertex/index data. | 498 // readies the pools to provide vertex/index data. |
| 498 void prepareVertexPool(); | 499 void prepareVertexPool(); |
| 499 void prepareIndexPool(); | 500 void prepareIndexPool(); |
| 500 | 501 |
| 501 void resetContext() { | 502 void resetContext() { |
| 502 // We call this because the client may have messed with the | 503 // We call this because the client may have messed with the |
| 503 // stencil buffer. Perhaps we should detect whether it is a | 504 // stencil buffer. Perhaps we should detect whether it is a |
| 504 // internally created stencil buffer and if so skip the invalidate. | 505 // internally created stencil buffer and if so skip the invalidate. |
| 505 fClipMaskManager.invalidateStencilMask(); | 506 fClipMaskManager.invalidateStencilMask(); |
| 506 this->onResetContext(fResetBits); | 507 this->onResetContext(fResetBits); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 529 // these are mutable so they can be created on-demand | 530 // these are mutable so they can be created on-demand |
| 530 mutable GrIndexBuffer* fQuadInd
exBuffer; | 531 mutable GrIndexBuffer* fQuadInd
exBuffer; |
| 531 // Used to abandon/release all resources created by this GrGpu. TODO: Move t
his | 532 // Used to abandon/release all resources created by this GrGpu. TODO: Move t
his |
| 532 // functionality to GrResourceCache. | 533 // functionality to GrResourceCache. |
| 533 ResourceList fResourc
eList; | 534 ResourceList fResourc
eList; |
| 534 | 535 |
| 535 typedef GrDrawTarget INHERITED; | 536 typedef GrDrawTarget INHERITED; |
| 536 }; | 537 }; |
| 537 | 538 |
| 538 #endif | 539 #endif |
| OLD | NEW |