fillDevAARect(ctx, paint, r);
return;
}
-
+
GrAutoMatrix avm(ctx, GrMatrix::I());
GrPoint verts[16];
gStrokeAARectIdx, SK_ARRAY_COUNT(gStrokeAARectIdx));
}
+/*
+ * If the paint has a texture, preconcat the ctx's inverse, since when we
+ * draw verts which are already in device coordinates, we need to "undo" that
+ * before we run our vertex shaders, which expect the coordinates to be local.
+ */
+static void preConcatInverseToTextureMatrix(GrContext* ctx, GrPaint* paint) {
+ if (paint->getTexture()) {
+ GrMatrix inverse;
+ if (ctx->getMatrix().invert(&inverse)) {
+ paint->fSampler.preConcatMatrix(inverse);
+ }
+ }
+}
+
void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect,
const SkPaint& paint) {
CHECK_SHOULD_DRAW(draw);
}
bool doAA = paint.isAntiAlias();
- doAA = false;
if (SkDraw::kHair_RectType == type && doAA) {
strokeSize.set(SK_Scalar1, SK_Scalar1);
if (doAA) {
SkRect devRect;
matrix.mapRect(&devRect, rect);
+ preConcatInverseToTextureMatrix(fContext, &grPaint);
fillDevAARect(fContext, grPaint, Sk2Gr(devRect));
} else {
fContext->drawRect(grPaint, Sk2Gr(rect), -1);
if (doAA) {
SkRect devRect;
matrix.mapRect(&devRect, rect);
+ preConcatInverseToTextureMatrix(fContext, &grPaint);
strokeDevAARect(fContext, grPaint, Sk2Gr(devRect), strokeSize);
} else {
fContext->drawRect(grPaint, Sk2Gr(rect), paint.getStrokeWidth());