blob: 08d3d3d9357ff773dd2092f104be39f4f61aa186 [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.org37d883d2013-05-02 13:11:22 +000044 void drawCircle(GrDrawTarget* target, bool useAA,
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +000045 const SkRect& circle,
commit-bot@chromium.org81312832013-03-22 18:34:09 +000046 const SkStrokeRec& stroke);
47
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000048 GrIndexBuffer* rRectIndexBuffer(GrGpu* gpu);
skia.committer@gmail.com2cf444f2013-04-26 07:00:58 +000049
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000050 GrIndexBuffer* fRRectIndexBuffer;
skia.committer@gmail.com2cf444f2013-04-26 07:00:58 +000051
commit-bot@chromium.org81312832013-03-22 18:34:09 +000052 typedef GrRefCnt INHERITED;
53};
54
55#endif // GrOvalRenderer_DEFINED