blob: 8c47e9a350f9fe1335751f0a645a13a3ba12c447 [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"
13#include "GrRefCnt.h"
commit-bot@chromium.org81312832013-03-22 18:34:09 +000014
15class GrContext;
16class GrDrawTarget;
17class GrPaint;
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +000018struct SkRect;
commit-bot@chromium.org81312832013-03-22 18:34:09 +000019class SkStrokeRec;
20
21/*
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000022 * This class wraps helper functions that draw ovals and roundrects (filled & stroked)
commit-bot@chromium.org81312832013-03-22 18:34:09 +000023 */
24class GrOvalRenderer : public GrRefCnt {
25public:
26 SK_DECLARE_INST_COUNT(GrOvalRenderer)
27
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000028 GrOvalRenderer() : fRRectIndexBuffer(NULL) {}
commit-bot@chromium.orgef284a82013-07-11 22:29:29 +000029 ~GrOvalRenderer() {
30 this->reset();
31 }
32
33 void reset();
commit-bot@chromium.org81312832013-03-22 18:34:09 +000034
commit-bot@chromium.org37d883d2013-05-02 13:11:22 +000035 bool drawOval(GrDrawTarget* target, const GrContext* context, bool useAA,
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +000036 const SkRect& oval, const SkStrokeRec& stroke);
commit-bot@chromium.org37d883d2013-05-02 13:11:22 +000037 bool drawSimpleRRect(GrDrawTarget* target, GrContext* context, bool useAA,
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000038 const SkRRect& rrect, const SkStrokeRec& stroke);
39
commit-bot@chromium.org81312832013-03-22 18:34:09 +000040private:
commit-bot@chromium.org37d883d2013-05-02 13:11:22 +000041 bool drawEllipse(GrDrawTarget* target, bool useAA,
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +000042 const SkRect& ellipse,
commit-bot@chromium.org81312832013-03-22 18:34:09 +000043 const SkStrokeRec& stroke);
commit-bot@chromium.org5242ed72013-09-05 19:26:51 +000044 bool drawDIEllipse(GrDrawTarget* target, bool useAA,
45 const SkRect& ellipse,
46 const SkStrokeRec& stroke);
commit-bot@chromium.org37d883d2013-05-02 13:11:22 +000047 void drawCircle(GrDrawTarget* target, bool useAA,
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +000048 const SkRect& circle,
commit-bot@chromium.org81312832013-03-22 18:34:09 +000049 const SkStrokeRec& stroke);
50
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000051 GrIndexBuffer* rRectIndexBuffer(GrGpu* gpu);
skia.committer@gmail.com2cf444f2013-04-26 07:00:58 +000052
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000053 GrIndexBuffer* fRRectIndexBuffer;
skia.committer@gmail.com2cf444f2013-04-26 07:00:58 +000054
commit-bot@chromium.org81312832013-03-22 18:34:09 +000055 typedef GrRefCnt INHERITED;
56};
57
58#endif // GrOvalRenderer_DEFINED