blob: b58abb7989f4acdd05b27b6b99f6cac75ba5eb1e [file] [log] [blame]
commit-bot@chromium.org81312832013-03-22 18:34:09 +00001/*
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
commit-bot@chromium.org81312832013-03-22 18:34:09 +00008#ifndef GrOvalRenderer_DEFINED
9#define GrOvalRenderer_DEFINED
10
11#include "GrContext.h"
12#include "GrPaint.h"
commit-bot@chromium.org81312832013-03-22 18:34:09 +000013
14class GrContext;
15class GrDrawTarget;
16class GrPaint;
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +000017struct SkRect;
commit-bot@chromium.org81312832013-03-22 18:34:09 +000018class SkStrokeRec;
19
20/*
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000021 * This class wraps helper functions that draw ovals and roundrects (filled & stroked)
commit-bot@chromium.org81312832013-03-22 18:34:09 +000022 */
commit-bot@chromium.orga4de8c22013-09-09 13:38:37 +000023class GrOvalRenderer : public SkRefCnt {
commit-bot@chromium.org81312832013-03-22 18:34:09 +000024public:
25 SK_DECLARE_INST_COUNT(GrOvalRenderer)
26
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000027 GrOvalRenderer() : fRRectIndexBuffer(NULL) {}
commit-bot@chromium.orgef284a82013-07-11 22:29:29 +000028 ~GrOvalRenderer() {
29 this->reset();
30 }
31
32 void reset();
commit-bot@chromium.org81312832013-03-22 18:34:09 +000033
commit-bot@chromium.org37d883d2013-05-02 13:11:22 +000034 bool drawOval(GrDrawTarget* target, const GrContext* context, bool useAA,
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +000035 const SkRect& oval, const SkStrokeRec& stroke);
commit-bot@chromium.org37d883d2013-05-02 13:11:22 +000036 bool drawSimpleRRect(GrDrawTarget* target, GrContext* context, bool useAA,
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000037 const SkRRect& rrect, const SkStrokeRec& stroke);
38
commit-bot@chromium.org81312832013-03-22 18:34:09 +000039private:
commit-bot@chromium.org37d883d2013-05-02 13:11:22 +000040 bool drawEllipse(GrDrawTarget* target, bool useAA,
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +000041 const SkRect& ellipse,
commit-bot@chromium.org81312832013-03-22 18:34:09 +000042 const SkStrokeRec& stroke);
commit-bot@chromium.org5242ed72013-09-05 19:26:51 +000043 bool drawDIEllipse(GrDrawTarget* target, bool useAA,
44 const SkRect& ellipse,
45 const SkStrokeRec& stroke);
commit-bot@chromium.org37d883d2013-05-02 13:11:22 +000046 void drawCircle(GrDrawTarget* target, bool useAA,
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +000047 const SkRect& circle,
commit-bot@chromium.org81312832013-03-22 18:34:09 +000048 const SkStrokeRec& stroke);
49
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000050 GrIndexBuffer* rRectIndexBuffer(GrGpu* gpu);
skia.committer@gmail.com2cf444f2013-04-26 07:00:58 +000051
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000052 GrIndexBuffer* fRRectIndexBuffer;
skia.committer@gmail.com2cf444f2013-04-26 07:00:58 +000053
commit-bot@chromium.orga4de8c22013-09-09 13:38:37 +000054 typedef SkRefCnt INHERITED;
commit-bot@chromium.org81312832013-03-22 18:34:09 +000055};
56
57#endif // GrOvalRenderer_DEFINED