blob: a9d41b40e04f407ac5ea93b96e89b1cacd30dc6f [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.orgef284a82013-07-11 22:29:29 +000030 ~GrOvalRenderer() {
31 this->reset();
32 }
33
34 void reset();
commit-bot@chromium.org81312832013-03-22 18:34:09 +000035
commit-bot@chromium.org37d883d2013-05-02 13:11:22 +000036 bool drawOval(GrDrawTarget* target, const GrContext* context, bool useAA,
commit-bot@chromium.org81312832013-03-22 18:34:09 +000037 const GrRect& oval, const SkStrokeRec& stroke);
commit-bot@chromium.org37d883d2013-05-02 13:11:22 +000038 bool drawSimpleRRect(GrDrawTarget* target, GrContext* context, bool useAA,
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000039 const SkRRect& rrect, const SkStrokeRec& stroke);
40
commit-bot@chromium.org81312832013-03-22 18:34:09 +000041private:
commit-bot@chromium.org37d883d2013-05-02 13:11:22 +000042 bool drawEllipse(GrDrawTarget* target, bool useAA,
commit-bot@chromium.org81312832013-03-22 18:34:09 +000043 const GrRect& ellipse,
44 const SkStrokeRec& stroke);
commit-bot@chromium.org37d883d2013-05-02 13:11:22 +000045 void drawCircle(GrDrawTarget* target, bool useAA,
commit-bot@chromium.org81312832013-03-22 18:34:09 +000046 const GrRect& circle,
47 const SkStrokeRec& stroke);
48
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000049 GrIndexBuffer* rRectIndexBuffer(GrGpu* gpu);
skia.committer@gmail.com2cf444f2013-04-26 07:00:58 +000050
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000051 GrIndexBuffer* fRRectIndexBuffer;
skia.committer@gmail.com2cf444f2013-04-26 07:00:58 +000052
commit-bot@chromium.org81312832013-03-22 18:34:09 +000053 typedef GrRefCnt INHERITED;
54};
55
56#endif // GrOvalRenderer_DEFINED