blob: d591ffeed38d80db1217f1d4603371f2e84c5cb2 [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
commit-bot@chromium.org81312832013-03-22 18:34:09 +000011#include "GrPaint.h"
commit-bot@chromium.org81312832013-03-22 18:34:09 +000012
commit-bot@chromium.org81312832013-03-22 18:34:09 +000013class GrDrawTarget;
robertphillipsea461502015-05-26 11:38:03 -070014class GrPipelineBuilder;
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +000015struct SkRect;
commit-bot@chromium.org81312832013-03-22 18:34:09 +000016class SkStrokeRec;
17
18/*
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000019 * This class wraps helper functions that draw ovals and roundrects (filled & stroked)
commit-bot@chromium.org81312832013-03-22 18:34:09 +000020 */
robertphillipsea461502015-05-26 11:38:03 -070021class GrOvalRenderer {
commit-bot@chromium.org81312832013-03-22 18:34:09 +000022public:
robertphillipsea461502015-05-26 11:38:03 -070023 static bool DrawOval(GrDrawTarget*,
joshualittae3d63a2015-07-13 08:44:06 -070024 const GrPipelineBuilder&,
robertphillipsea461502015-05-26 11:38:03 -070025 GrColor,
26 const SkMatrix& viewMatrix,
27 bool useAA,
28 const SkRect& oval,
29 const SkStrokeRec& stroke);
30 static bool DrawRRect(GrDrawTarget*,
joshualittae3d63a2015-07-13 08:44:06 -070031 const GrPipelineBuilder&,
robertphillipsea461502015-05-26 11:38:03 -070032 GrColor,
33 const SkMatrix& viewMatrix,
34 bool useAA,
35 const SkRRect& rrect,
36 const SkStrokeRec& stroke);
37 static bool DrawDRRect(GrDrawTarget* target,
joshualittae3d63a2015-07-13 08:44:06 -070038 const GrPipelineBuilder&,
robertphillipsea461502015-05-26 11:38:03 -070039 GrColor,
40 const SkMatrix& viewMatrix,
41 bool useAA,
42 const SkRRect& outer,
43 const SkRRect& inner);
commit-bot@chromium.orgf2bfd542013-04-25 15:27:00 +000044
commit-bot@chromium.org81312832013-03-22 18:34:09 +000045private:
robertphillipsea461502015-05-26 11:38:03 -070046 GrOvalRenderer();
commit-bot@chromium.org81312832013-03-22 18:34:09 +000047
robertphillipsea461502015-05-26 11:38:03 -070048 static bool DrawEllipse(GrDrawTarget* target,
joshualittae3d63a2015-07-13 08:44:06 -070049 const GrPipelineBuilder&,
robertphillipsea461502015-05-26 11:38:03 -070050 GrColor,
51 const SkMatrix& viewMatrix,
52 bool useCoverageAA,
53 const SkRect& ellipse,
54 const SkStrokeRec& stroke);
55 static bool DrawDIEllipse(GrDrawTarget* target,
joshualittae3d63a2015-07-13 08:44:06 -070056 const GrPipelineBuilder&,
robertphillipsea461502015-05-26 11:38:03 -070057 GrColor,
58 const SkMatrix& viewMatrix,
59 bool useCoverageAA,
60 const SkRect& ellipse,
61 const SkStrokeRec& stroke);
62 static void DrawCircle(GrDrawTarget* target,
joshualittae3d63a2015-07-13 08:44:06 -070063 const GrPipelineBuilder&,
robertphillipsea461502015-05-26 11:38:03 -070064 GrColor,
65 const SkMatrix& viewMatrix,
66 bool useCoverageAA,
67 const SkRect& circle,
68 const SkStrokeRec& stroke);
commit-bot@chromium.org81312832013-03-22 18:34:09 +000069};
70
71#endif // GrOvalRenderer_DEFINED