blob: 7eaec795e8a827da644aa4c6139ea0c3aa063e4d [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
bsalomonabd30f52015-08-13 13:34:48 -070025inline GrDrawBatch* CreateFillBW(GrColor color,
joshualitt9c80b5f2015-08-13 10:05:51 -070026 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
bsalomonabd30f52015-08-13 13:34:48 -070033inline GrDrawBatch* 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
bsalomonabd30f52015-08-13 13:34:48 -070040GrDrawBatch* CreateStrokeBW(GrColor color,
41 const SkMatrix& viewMatrix,
42 const SkRect& rect,
43 SkScalar strokeWidth,
44 bool snapToPixelCenters);
joshualittecd1a692015-08-10 10:08:26 -070045
bsalomonabd30f52015-08-13 13:34:48 -070046GrDrawBatch* CreateStrokeAA(GrColor,
47 const SkMatrix& viewMatrix,
48 const SkRect& rect,
49 const SkRect& devRect,
50 const SkStrokeRec& stroke);
joshualitt14205b12015-08-10 11:40:56 -070051
52// First rect is outer; second rect is inner
bsalomonabd30f52015-08-13 13:34:48 -070053GrDrawBatch* CreateFillNestedRectsAA(GrColor,
54 const SkMatrix& viewMatrix,
55 const SkRect rects[2]);
joshualitt14205b12015-08-10 11:40:56 -070056
joshualittecd1a692015-08-10 10:08:26 -070057};
58
59#endif