#include "SkMatrix.h"
#include "SkRect.h"
#include "SkRefCnt.h"
+#include "SkStrokeRec.h"
class GrGpu;
class GrDrawTarget;
public:
SK_DECLARE_INST_COUNT(GrAARectRenderer)
- GrAARectRenderer()
- : fAAFillRectIndexBuffer(NULL)
- , fAAStrokeRectIndexBuffer(NULL) {
+ GrAARectRenderer(GrGpu* gpu)
+ : fGpu(gpu)
+ , fAAFillRectIndexBuffer(NULL)
+ , fAAMiterStrokeRectIndexBuffer(NULL)
+ , fAABevelStrokeRectIndexBuffer(NULL) {
}
void reset();
}
// TODO: potentialy fuse the fill & stroke methods and differentiate
- // between them by passing in strokeWidth (<0 means fill).
+ // between them by passing in stroke (==NULL means fill).
- void fillAARect(GrGpu* gpu,
- GrDrawTarget* target,
+ void fillAARect(GrDrawTarget* target,
const SkRect& rect,
const SkMatrix& combinedMatrix,
- const SkRect& devRect,
- bool useVertexCoverage) {
+ const SkRect& devRect) {
#ifdef SHADER_AA_FILL_RECT
if (combinedMatrix.rectStaysRect()) {
this->shaderFillAlignedAARect(gpu, target,
rect, combinedMatrix);
}
#else
- this->geometryFillAARect(gpu, target,
- rect, combinedMatrix,
- devRect, useVertexCoverage);
+ this->geometryFillAARect(target, rect, combinedMatrix, devRect);
#endif
}
- void strokeAARect(GrGpu* gpu,
- GrDrawTarget* target,
+ void strokeAARect(GrDrawTarget* target,
const SkRect& rect,
const SkMatrix& combinedMatrix,
const SkRect& devRect,
- SkScalar width,
- bool useVertexCoverage);
+ const SkStrokeRec& stroke);
// First rect is outer; second rect is inner
- void fillAANestedRects(GrGpu* gpu,
- GrDrawTarget* target,
+ void fillAANestedRects(GrDrawTarget* target,
const SkRect rects[2],
- const SkMatrix& combinedMatrix,
- bool useVertexCoverage);
+ const SkMatrix& combinedMatrix);
private:
- GrIndexBuffer* fAAFillRectIndexBuffer;
- GrIndexBuffer* fAAStrokeRectIndexBuffer;
-
- GrIndexBuffer* aaFillRectIndexBuffer(GrGpu* gpu);
-
- static int aaStrokeRectIndexCount();
- GrIndexBuffer* aaStrokeRectIndexBuffer(GrGpu* gpu);
+ GrIndexBuffer* aaStrokeRectIndexBuffer(bool miterStroke);
- // TODO: Remove the useVertexCoverage boolean. Just use it all the time
- // since we now have a coverage vertex attribute
- void geometryFillAARect(GrGpu* gpu,
- GrDrawTarget* target,
+ void geometryFillAARect(GrDrawTarget* target,
const SkRect& rect,
const SkMatrix& combinedMatrix,
- const SkRect& devRect,
- bool useVertexCoverage);
+ const SkRect& devRect);
- void shaderFillAARect(GrGpu* gpu,
- GrDrawTarget* target,
+ void shaderFillAARect(GrDrawTarget* target,
const SkRect& rect,
const SkMatrix& combinedMatrix);
- void shaderFillAlignedAARect(GrGpu* gpu,
- GrDrawTarget* target,
+ void shaderFillAlignedAARect(GrDrawTarget* target,
const SkRect& rect,
const SkMatrix& combinedMatrix);
- void geometryStrokeAARect(GrGpu* gpu,
- GrDrawTarget* target,
+ void geometryStrokeAARect(GrDrawTarget* target,
const SkRect& devOutside,
+ const SkRect& devOutsideAssist,
const SkRect& devInside,
- bool useVertexCoverage);
+ bool miterStroke);
+
+ GrGpu* fGpu;
+ GrIndexBuffer* fAAFillRectIndexBuffer;
+ GrIndexBuffer* fAAMiterStrokeRectIndexBuffer;
+ GrIndexBuffer* fAABevelStrokeRectIndexBuffer;
typedef SkRefCnt INHERITED;
};