Index: src/gpu/batches/GrRectBatchFactory.cpp |
diff --git a/src/gpu/batches/GrRectBatchFactory.cpp b/src/gpu/batches/GrRectBatchFactory.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b41561209e1c19239d4f35a37aa7df34dc6bba82 |
--- /dev/null |
+++ b/src/gpu/batches/GrRectBatchFactory.cpp |
@@ -0,0 +1,41 @@ |
+/* |
+ * Copyright 2015 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#include "GrRectBatchFactory.h" |
+ |
+#include "GrRectBatch.h" |
+ |
+namespace GrRectBatchFactory { |
+ |
+GrBatch* Create(GrColor color, |
+ const SkMatrix& viewMatrix, |
+ const SkRect& rect, |
+ const SkRect* localRect, |
+ const SkMatrix* localMatrix) { |
+ GrRectBatch::Geometry geometry; |
+ geometry.fColor = color; |
+ geometry.fViewMatrix = viewMatrix; |
+ geometry.fRect = rect; |
+ |
+ if (localRect) { |
+ geometry.fHasLocalRect = true; |
+ geometry.fLocalRect = *localRect; |
+ } else { |
+ geometry.fHasLocalRect = false; |
+ } |
+ |
+ if (localMatrix) { |
+ geometry.fHasLocalMatrix = true; |
+ geometry.fLocalMatrix = *localMatrix; |
+ } else { |
+ geometry.fHasLocalMatrix = false; |
+ } |
+ |
+ return GrRectBatch::Create(geometry); |
+} |
+ |
+}; |