#include "batches/GrBatch.h"
#include "batches/GrDrawAtlasBatch.h"
#include "batches/GrDrawVerticesBatch.h"
-#include "batches/GrStrokeRectBatch.h"
+#include "batches/GrRectBatchFactory.h"
#include "SkGr.h"
#include "SkRSXform.h"
}
if (width >= 0) {
- GrStrokeRectBatch::Geometry geometry;
- geometry.fViewMatrix = viewMatrix;
- geometry.fColor = color;
- geometry.fRect = rect;
- geometry.fStrokeWidth = width;
-
// Non-AA hairlines are snapped to pixel centers to make which pixels are hit deterministic
bool snapToPixelCenters = (0 == width && !rt->isUnifiedMultisampled());
- SkAutoTUnref<GrBatch> batch(GrStrokeRectBatch::Create(geometry, snapToPixelCenters));
+ SkAutoTUnref<GrBatch> batch(GrRectBatchFactory::CreateStrokeBW(color, viewMatrix, rect,
+ width, snapToPixelCenters));
// Depending on sub-pixel coordinates and the particular GPU, we may lose a corner of
// hairline rects. We jam all the vertices to pixel centers to avoid this, but not when MSAA
const SkRect& rect,
const SkRect* localRect,
const SkMatrix* localMatrix) {
- SkAutoTUnref<GrBatch> batch(GrRectBatchFactory::Create(color, viewMatrix, rect, localRect,
- localMatrix));
+ SkAutoTUnref<GrBatch> batch(GrRectBatchFactory::CreateFillBW(color, viewMatrix, rect, localRect,
+ localMatrix));
this->drawBatch(pipelineBuilder, batch);
}
#include "GrRectBatchFactory.h"
#include "GrRectBatch.h"
+#include "GrStrokeRectBatch.h"
namespace GrRectBatchFactory {
-GrBatch* Create(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect* localRect,
- const SkMatrix* localMatrix) {
+GrBatch* CreateFillBW(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect* localRect,
+ const SkMatrix* localMatrix) {
GrRectBatch::Geometry geometry;
geometry.fColor = color;
geometry.fViewMatrix = viewMatrix;
return GrRectBatch::Create(geometry);
}
+GrBatch* CreateStrokeBW(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ SkScalar strokeWidth,
+ bool snapToPixelCenters) {
+ GrStrokeRectBatch::Geometry geometry;
+ geometry.fColor = color;
+ geometry.fViewMatrix = viewMatrix;
+ geometry.fRect = rect;
+ geometry.fStrokeWidth = strokeWidth;
+ return GrStrokeRectBatch::Create(geometry, snapToPixelCenters);
+}
+
};
*/
namespace GrRectBatchFactory {
-GrBatch* Create(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect* localRect,
- const SkMatrix* localMatrix);
+GrBatch* CreateFillBW(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect* localRect,
+ const SkMatrix* localMatrix);
+
+GrBatch* CreateStrokeBW(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ SkScalar strokeWidth,
+ bool snapToPixelCenters);
};