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 #include "GrRefCnt.h"
     14 
     15 class GrContext;
     16 class GrDrawTarget;
     17 class GrPaint;
     18 struct SkRect;
     19 class SkStrokeRec;
     20 
     21 /*
     22  * This class wraps helper functions that draw ovals and roundrects (filled & stroked)
     23  */
     24 class GrOvalRenderer : public GrRefCnt {
     25 public:
     26     SK_DECLARE_INST_COUNT(GrOvalRenderer)
     27 
     28     GrOvalRenderer() : fRRectIndexBuffer(NULL) {}
     29     ~GrOvalRenderer() {
     30         this->reset();
     31     }
     32 
     33     void reset();
     34 
     35     bool drawOval(GrDrawTarget* target, const GrContext* context, bool useAA,
     36                   const SkRect& oval, const SkStrokeRec& stroke);
     37     bool drawSimpleRRect(GrDrawTarget* target, GrContext* context, bool useAA,
     38                          const SkRRect& rrect, const SkStrokeRec& stroke);
     39 
     40 private:
     41     bool drawEllipse(GrDrawTarget* target, bool useAA,
     42                      const SkRect& ellipse,
     43                      const SkStrokeRec& stroke);
     44     void drawCircle(GrDrawTarget* target, bool useAA,
     45                     const SkRect& circle,
     46                     const SkStrokeRec& stroke);
     47 
     48     GrIndexBuffer* rRectIndexBuffer(GrGpu* gpu);
     49 
     50     GrIndexBuffer* fRRectIndexBuffer;
     51 
     52     typedef GrRefCnt INHERITED;
     53 };
     54 
     55 #endif // GrOvalRenderer_DEFINED
     56