blob: 68e6070b45ecdf3d3f3325b7a7ead0df06831365 [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
8
9#ifndef GrOvalRenderer_DEFINED
10#define GrOvalRenderer_DEFINED
11
12#include "GrContext.h"
13#include "GrPaint.h"
14#include "GrRefCnt.h"
15#include "GrRect.h"
16
17class GrContext;
18class GrDrawTarget;
19class GrPaint;
20class SkStrokeRec;
21
22/*
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000023 * This class wraps helper functions that draw ovals and roundrects (filled & stroked)
commit-bot@chromium.org81312832013-03-22 18:34:09 +000024 */
25class GrOvalRenderer : public GrRefCnt {
26public:
27 SK_DECLARE_INST_COUNT(GrOvalRenderer)
28
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000029 GrOvalRenderer() : fRRectIndexBuffer(NULL) {}
commit-bot@chromium.org81312832013-03-22 18:34:09 +000030 ~GrOvalRenderer() {}
31
skia.committer@gmail.com7e328512013-03-23 07:01:28 +000032 bool drawOval(GrDrawTarget* target, const GrContext* context, const GrPaint& paint,
commit-bot@chromium.org81312832013-03-22 18:34:09 +000033 const GrRect& oval, const SkStrokeRec& stroke);
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000034 bool drawSimpleRRect(GrDrawTarget* target, GrContext* context, const GrPaint& paint,
35 const SkRRect& rrect, const SkStrokeRec& stroke);
36
commit-bot@chromium.org81312832013-03-22 18:34:09 +000037private:
jvanverth@google.comc4f2eca2013-04-16 12:30:35 +000038 bool drawEllipse(GrDrawTarget* target, const GrPaint& paint,
commit-bot@chromium.org81312832013-03-22 18:34:09 +000039 const GrRect& ellipse,
40 const SkStrokeRec& stroke);
41 void drawCircle(GrDrawTarget* target, const GrPaint& paint,
42 const GrRect& circle,
43 const SkStrokeRec& stroke);
44
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000045 GrIndexBuffer* rRectIndexBuffer(GrGpu* gpu);
46
47 GrIndexBuffer* fRRectIndexBuffer;
48
commit-bot@chromium.org81312832013-03-22 18:34:09 +000049 typedef GrRefCnt INHERITED;
50};
51
52#endif // GrOvalRenderer_DEFINED