bsalomon@google.com | aeb2160 | 2011-08-30 18:13:44 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
| 9 | #ifndef GrAAHairLinePathRenderer_DEFINED |
| 10 | #define GrAAHairLinePathRenderer_DEFINED |
| 11 | |
| 12 | #include "GrPathRenderer.h" |
| 13 | |
| 14 | class GrAAHairLinePathRenderer : public GrPathRenderer { |
| 15 | public: |
| 16 | virtual ~GrAAHairLinePathRenderer(); |
| 17 | |
| 18 | static GrPathRenderer* Create(GrContext* context); |
| 19 | // GrPathRenderer overrides |
bsalomon@google.com | 289533a | 2011-10-27 12:34:25 +0000 | [diff] [blame] | 20 | virtual bool canDrawPath(const GrDrawTarget::Caps& targetCaps, |
bsalomon@google.com | aeb2160 | 2011-08-30 18:13:44 +0000 | [diff] [blame] | 21 | const SkPath& path, |
bsalomon@google.com | 289533a | 2011-10-27 12:34:25 +0000 | [diff] [blame] | 22 | GrPathFill fill, |
| 23 | bool antiAlias) const SK_OVERRIDE; |
bsalomon@google.com | 39ee0ff | 2011-12-06 15:32:52 +0000 | [diff] [blame] | 24 | virtual void drawPath(GrDrawState::StageMask stages) SK_OVERRIDE; |
bsalomon@google.com | aeb2160 | 2011-08-30 18:13:44 +0000 | [diff] [blame] | 25 | |
| 26 | protected: |
| 27 | |
| 28 | // GrPathRenderer overrides |
bsalomon@google.com | 289533a | 2011-10-27 12:34:25 +0000 | [diff] [blame] | 29 | virtual void pathWillClear() SK_OVERRIDE; |
bsalomon@google.com | aeb2160 | 2011-08-30 18:13:44 +0000 | [diff] [blame] | 30 | |
| 31 | private: |
| 32 | void resetGeom(); |
| 33 | |
bsalomon@google.com | aeb2160 | 2011-08-30 18:13:44 +0000 | [diff] [blame] | 34 | GrAAHairLinePathRenderer(const GrContext* context, |
| 35 | const GrIndexBuffer* fLinesIndexBuffer, |
| 36 | const GrIndexBuffer* fQuadsIndexBuffer); |
| 37 | |
bsalomon@google.com | 39ee0ff | 2011-12-06 15:32:52 +0000 | [diff] [blame] | 38 | bool createGeom(GrDrawState::StageMask stages); |
bsalomon@google.com | aeb2160 | 2011-08-30 18:13:44 +0000 | [diff] [blame] | 39 | |
bsalomon@google.com | aeb2160 | 2011-08-30 18:13:44 +0000 | [diff] [blame] | 40 | const GrIndexBuffer* fLinesIndexBuffer; |
| 41 | const GrIndexBuffer* fQuadsIndexBuffer; |
| 42 | |
| 43 | // have to recreate geometry if stages in use changes :( |
bsalomon@google.com | 39ee0ff | 2011-12-06 15:32:52 +0000 | [diff] [blame] | 44 | GrDrawState::StageMask fPreviousStages; |
bsalomon@google.com | aeb2160 | 2011-08-30 18:13:44 +0000 | [diff] [blame] | 45 | int fPreviousRTHeight; |
bsalomon@google.com | dbeeac3 | 2011-09-12 14:59:34 +0000 | [diff] [blame] | 46 | SkVector fPreviousTranslate; |
bsalomon@google.com | aeb2160 | 2011-08-30 18:13:44 +0000 | [diff] [blame] | 47 | GrIRect fClipRect; |
| 48 | |
| 49 | // this path renderer draws everything in device coordinates |
| 50 | GrMatrix fPreviousViewMatrix; |
| 51 | int fLineSegmentCnt; |
| 52 | int fQuadCnt; |
| 53 | |
| 54 | typedef GrPathRenderer INHERITED; |
| 55 | }; |
| 56 | |
| 57 | |
| 58 | #endif |
| 59 | |