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 |
| 20 | virtual bool supportsAA(GrDrawTarget* target, |
| 21 | const SkPath& path, |
| 22 | GrPathFill fill); |
| 23 | virtual bool canDrawPath(const GrDrawTarget* target, |
| 24 | const SkPath& path, |
| 25 | GrPathFill fill) const; |
| 26 | virtual void drawPath(GrDrawTarget::StageBitfield stages); |
| 27 | |
| 28 | protected: |
| 29 | |
| 30 | // GrPathRenderer overrides |
| 31 | virtual void pathWillClear(); |
| 32 | |
| 33 | private: |
| 34 | void resetGeom(); |
| 35 | |
| 36 | static bool CanBeUsed(const GrContext* context); |
| 37 | GrAAHairLinePathRenderer(const GrContext* context, |
| 38 | const GrIndexBuffer* fLinesIndexBuffer, |
| 39 | const GrIndexBuffer* fQuadsIndexBuffer); |
| 40 | |
| 41 | bool createGeom(GrDrawTarget::StageBitfield stages); |
| 42 | |
| 43 | GrContext* fContext; |
| 44 | const GrIndexBuffer* fLinesIndexBuffer; |
| 45 | const GrIndexBuffer* fQuadsIndexBuffer; |
| 46 | |
| 47 | // have to recreate geometry if stages in use changes :( |
| 48 | GrDrawTarget::StageBitfield fPreviousStages; |
| 49 | int fPreviousRTHeight; |
| 50 | GrIRect fClipRect; |
| 51 | |
| 52 | // this path renderer draws everything in device coordinates |
| 53 | GrMatrix fPreviousViewMatrix; |
| 54 | int fLineSegmentCnt; |
| 55 | int fQuadCnt; |
| 56 | |
| 57 | typedef GrPathRenderer INHERITED; |
| 58 | }; |
| 59 | |
| 60 | |
| 61 | #endif |
| 62 | |