blob: 92f6ff0cdf209a8d72ec9cf7f9b443afe7ce4120 [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.org0a09d712014-04-09 21:26:11 +000036 bool drawRRect(GrDrawTarget* target, GrContext* context, bool useAA,
37 const SkRRect& rrect, const SkStrokeRec& stroke);
38 bool drawDRRect(GrDrawTarget* target, GrContext* context, bool useAA,
39 const SkRRect& outer, const SkRRect& inner);
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000040
commit-bot@chromium.org81312832013-03-22 18:34:09 +000041private:
commit-bot@chromium.orge0a868c2013-11-22 07:02:11 +000042 bool drawEllipse(GrDrawTarget* target, bool useCoverageAA,
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +000043 const SkRect& ellipse,
commit-bot@chromium.org81312832013-03-22 18:34:09 +000044 const SkStrokeRec& stroke);
commit-bot@chromium.orge0a868c2013-11-22 07:02:11 +000045 bool drawDIEllipse(GrDrawTarget* target, bool useCoverageAA,
commit-bot@chromium.org5242ed72013-09-05 19:26:51 +000046 const SkRect& ellipse,
47 const SkStrokeRec& stroke);
commit-bot@chromium.orge0a868c2013-11-22 07:02:11 +000048 void drawCircle(GrDrawTarget* target, bool useCoverageAA,
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +000049 const SkRect& circle,
commit-bot@chromium.org81312832013-03-22 18:34:09 +000050 const SkStrokeRec& stroke);
51
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000052 GrIndexBuffer* rRectIndexBuffer(GrGpu* gpu);
skia.committer@gmail.com2cf444f2013-04-26 07:00:58 +000053
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000054 GrIndexBuffer* fRRectIndexBuffer;
skia.committer@gmail.com2cf444f2013-04-26 07:00:58 +000055
commit-bot@chromium.orga4de8c22013-09-09 13:38:37 +000056 typedef SkRefCnt INHERITED;
commit-bot@chromium.org81312832013-03-22 18:34:09 +000057};
58
59#endif // GrOvalRenderer_DEFINED