OLD | NEW |
(Empty) | |
| 1 /* |
| 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 #include "GrRectBatchFactory.h" |
| 9 |
| 10 #include "GrRectBatch.h" |
| 11 |
| 12 namespace GrRectBatchFactory { |
| 13 |
| 14 GrBatch* Create(GrColor color, |
| 15 const SkMatrix& viewMatrix, |
| 16 const SkRect& rect, |
| 17 const SkRect* localRect, |
| 18 const SkMatrix* localMatrix) { |
| 19 GrRectBatch::Geometry geometry; |
| 20 geometry.fColor = color; |
| 21 geometry.fViewMatrix = viewMatrix; |
| 22 geometry.fRect = rect; |
| 23 |
| 24 if (localRect) { |
| 25 geometry.fHasLocalRect = true; |
| 26 geometry.fLocalRect = *localRect; |
| 27 } else { |
| 28 geometry.fHasLocalRect = false; |
| 29 } |
| 30 |
| 31 if (localMatrix) { |
| 32 geometry.fHasLocalMatrix = true; |
| 33 geometry.fLocalMatrix = *localMatrix; |
| 34 } else { |
| 35 geometry.fHasLocalMatrix = false; |
| 36 } |
| 37 |
| 38 return GrRectBatch::Create(geometry); |
| 39 } |
| 40 |
| 41 }; |
OLD | NEW |