michael@0: /* michael@0: * Copyright 2013 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef GrOvalRenderer_DEFINED michael@0: #define GrOvalRenderer_DEFINED michael@0: michael@0: #include "GrContext.h" michael@0: #include "GrPaint.h" michael@0: michael@0: class GrContext; michael@0: class GrDrawTarget; michael@0: class GrPaint; michael@0: struct SkRect; michael@0: class SkStrokeRec; michael@0: michael@0: /* michael@0: * This class wraps helper functions that draw ovals and roundrects (filled & stroked) michael@0: */ michael@0: class GrOvalRenderer : public SkRefCnt { michael@0: public: michael@0: SK_DECLARE_INST_COUNT(GrOvalRenderer) michael@0: michael@0: GrOvalRenderer() : fRRectIndexBuffer(NULL) {} michael@0: ~GrOvalRenderer() { michael@0: this->reset(); michael@0: } michael@0: michael@0: void reset(); michael@0: michael@0: bool drawOval(GrDrawTarget* target, const GrContext* context, bool useAA, michael@0: const SkRect& oval, const SkStrokeRec& stroke); michael@0: bool drawSimpleRRect(GrDrawTarget* target, GrContext* context, bool useAA, michael@0: const SkRRect& rrect, const SkStrokeRec& stroke); michael@0: michael@0: private: michael@0: bool drawEllipse(GrDrawTarget* target, bool useCoverageAA, michael@0: const SkRect& ellipse, michael@0: const SkStrokeRec& stroke); michael@0: bool drawDIEllipse(GrDrawTarget* target, bool useCoverageAA, michael@0: const SkRect& ellipse, michael@0: const SkStrokeRec& stroke); michael@0: void drawCircle(GrDrawTarget* target, bool useCoverageAA, michael@0: const SkRect& circle, michael@0: const SkStrokeRec& stroke); michael@0: michael@0: GrIndexBuffer* rRectIndexBuffer(GrGpu* gpu); michael@0: michael@0: GrIndexBuffer* fRRectIndexBuffer; michael@0: michael@0: typedef SkRefCnt INHERITED; michael@0: }; michael@0: michael@0: #endif // GrOvalRenderer_DEFINED