blob: 8a088834387d9c70dc2c8fd428e5453d5292e504 [file] [log] [blame]
joshualittecd1a692015-08-10 10:08:26 -07001/*
2 * Copyright 2015 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#ifndef GrRectBatchFactory_DEFINED
9#define GrRectBatchFactory_DEFINED
10
joshualitt37eb1842015-08-12 06:36:57 -070011#include "GrAAFillRectBatch.h"
joshualittecd1a692015-08-10 10:08:26 -070012#include "GrColor.h"
13
14class GrBatch;
15class SkMatrix;
16struct SkRect;
joshualitt14205b12015-08-10 11:40:56 -070017class SkStrokeRec;
joshualittecd1a692015-08-10 10:08:26 -070018
19/*
joshualitt14205b12015-08-10 11:40:56 -070020 * A factory for returning batches which can draw rectangles.
joshualittecd1a692015-08-10 10:08:26 -070021 */
22namespace GrRectBatchFactory {
23
joshualitt7fc2a262015-08-10 10:30:14 -070024GrBatch* CreateFillBW(GrColor color,
25 const SkMatrix& viewMatrix,
26 const SkRect& rect,
27 const SkRect* localRect,
28 const SkMatrix* localMatrix);
29
joshualitt37eb1842015-08-12 06:36:57 -070030static GrBatch* CreateFillAA(GrColor color,
joshualitt14205b12015-08-10 11:40:56 -070031 const SkMatrix& viewMatrix,
32 const SkRect& rect,
joshualitt37eb1842015-08-12 06:36:57 -070033 const SkRect& devRect) {
34 return GrAAFillRectBatch::Create(color, viewMatrix, rect, devRect);
35}
joshualitt14205b12015-08-10 11:40:56 -070036
joshualitt7fc2a262015-08-10 10:30:14 -070037GrBatch* CreateStrokeBW(GrColor color,
38 const SkMatrix& viewMatrix,
39 const SkRect& rect,
40 SkScalar strokeWidth,
41 bool snapToPixelCenters);
joshualittecd1a692015-08-10 10:08:26 -070042
joshualitt14205b12015-08-10 11:40:56 -070043GrBatch* CreateStrokeAA(GrColor,
44 const SkMatrix& viewMatrix,
45 const SkRect& rect,
46 const SkRect& devRect,
47 const SkStrokeRec& stroke);
48
49// First rect is outer; second rect is inner
50GrBatch* CreateFillNestedRectsAA(GrColor,
51 const SkMatrix& viewMatrix,
52 const SkRect rects[2]);
53
joshualittecd1a692015-08-10 10:08:26 -070054};
55
56#endif