Home | History | Annotate | Download | only in gpu
      1 /*
      2  * Copyright 2013 Google Inc.
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 #ifndef GrOvalRenderer_DEFINED
      9 #define GrOvalRenderer_DEFINED
     10 
     11 #include "GrContext.h"
     12 #include "GrPaint.h"
     13 
     14 class GrContext;
     15 class GrDrawTarget;
     16 class GrPaint;
     17 struct SkRect;
     18 class SkStrokeRec;
     19 
     20 /*
     21  * This class wraps helper functions that draw ovals and roundrects (filled & stroked)
     22  */
     23 class GrOvalRenderer : public SkRefCnt {
     24 public:
     25     SK_DECLARE_INST_COUNT(GrOvalRenderer)
     26 
     27     bool drawOval(GrDrawTarget*,
     28                   GrPipelineBuilder*,
     29                   GrColor,
     30                   const SkMatrix& viewMatrix,
     31                   bool useAA,
     32                   const SkRect& oval,
     33                   const SkStrokeRec& stroke);
     34     bool drawRRect(GrDrawTarget*,
     35                    GrPipelineBuilder*,
     36                    GrColor,
     37                    const SkMatrix& viewMatrix,
     38                    bool useAA,
     39                    const SkRRect& rrect,
     40                    const SkStrokeRec& stroke);
     41     bool drawDRRect(GrDrawTarget* target,
     42                     GrPipelineBuilder*,
     43                     GrColor,
     44                     const SkMatrix& viewMatrix,
     45                     bool useAA,
     46                     const SkRRect& outer,
     47                     const SkRRect& inner);
     48 
     49 private:
     50     bool drawEllipse(GrDrawTarget* target,
     51                      GrPipelineBuilder*,
     52                      GrColor,
     53                      const SkMatrix& viewMatrix,
     54                      bool useCoverageAA,
     55                      const SkRect& ellipse,
     56                      const SkStrokeRec& stroke);
     57     bool drawDIEllipse(GrDrawTarget* target,
     58                        GrPipelineBuilder*,
     59                        GrColor,
     60                        const SkMatrix& viewMatrix,
     61                        bool useCoverageAA,
     62                        const SkRect& ellipse,
     63                        const SkStrokeRec& stroke);
     64     void drawCircle(GrDrawTarget* target,
     65                     GrPipelineBuilder*,
     66                     GrColor,
     67                     const SkMatrix& viewMatrix,
     68                     bool useCoverageAA,
     69                     const SkRect& circle,
     70                     const SkStrokeRec& stroke);
     71 
     72     typedef SkRefCnt INHERITED;
     73 };
     74 
     75 #endif // GrOvalRenderer_DEFINED
     76