blob: 6ded22db7b2ecbc1008a652b5b95e2254d9151ea [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"
joshualitt9c80b5f2015-08-13 10:05:51 -070012#include "GrBWFillRectBatch.h"
joshualittecd1a692015-08-10 10:08:26 -070013#include "GrColor.h"
14
15class GrBatch;
16class SkMatrix;
17struct SkRect;
joshualitt14205b12015-08-10 11:40:56 -070018class SkStrokeRec;
joshualittecd1a692015-08-10 10:08:26 -070019
20/*
joshualitt14205b12015-08-10 11:40:56 -070021 * A factory for returning batches which can draw rectangles.
joshualittecd1a692015-08-10 10:08:26 -070022 */
23namespace GrRectBatchFactory {
24
joshualitt9c80b5f2015-08-13 10:05:51 -070025inline GrBatch* CreateFillBW(GrColor color,
26 const SkMatrix& viewMatrix,
27 const SkRect& rect,
28 const SkRect* localRect,
29 const SkMatrix* localMatrix) {
30 return GrBWFillRectBatch::Create(color, viewMatrix, rect, localRect, localMatrix);
31}
joshualitt7fc2a262015-08-10 10:30:14 -070032
joshualitt9c80b5f2015-08-13 10:05:51 -070033inline GrBatch* CreateFillAA(GrColor color,
34 const SkMatrix& viewMatrix,
35 const SkRect& rect,
36 const SkRect& devRect) {
joshualitt37eb1842015-08-12 06:36:57 -070037 return GrAAFillRectBatch::Create(color, viewMatrix, rect, devRect);
38}
joshualitt14205b12015-08-10 11:40:56 -070039
joshualitt7fc2a262015-08-10 10:30:14 -070040GrBatch* CreateStrokeBW(GrColor color,
41 const SkMatrix& viewMatrix,
42 const SkRect& rect,
43 SkScalar strokeWidth,
44 bool snapToPixelCenters);
joshualittecd1a692015-08-10 10:08:26 -070045
joshualitt14205b12015-08-10 11:40:56 -070046GrBatch* CreateStrokeAA(GrColor,
47 const SkMatrix& viewMatrix,
48 const SkRect& rect,
49 const SkRect& devRect,
50 const SkStrokeRec& stroke);
51
52// First rect is outer; second rect is inner
53GrBatch* CreateFillNestedRectsAA(GrColor,
54 const SkMatrix& viewMatrix,
55 const SkRect rects[2]);
56
joshualittecd1a692015-08-10 10:08:26 -070057};
58
59#endif