diff options
Diffstat (limited to 'src/gpu/batches/GrRectBatchFactory.cpp')
-rw-r--r-- | src/gpu/batches/GrRectBatchFactory.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/gpu/batches/GrRectBatchFactory.cpp b/src/gpu/batches/GrRectBatchFactory.cpp new file mode 100644 index 0000000000..b41561209e --- /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); +} + +}; |