re-re-enable antialiased rects for gpu
git-svn-id: http://skia.googlecode.com/svn/trunk@1065 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
f1f4a67e0d
commit
7de5fc22e6
@ -750,6 +750,20 @@ static void strokeDevAARect(GrContext* ctx, const GrPaint& paint,
|
||||
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);
|
||||
@ -770,7 +784,6 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect,
|
||||
}
|
||||
|
||||
bool doAA = paint.isAntiAlias();
|
||||
doAA = false;
|
||||
|
||||
if (SkDraw::kHair_RectType == type && doAA) {
|
||||
strokeSize.set(SK_Scalar1, SK_Scalar1);
|
||||
@ -786,6 +799,7 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect,
|
||||
if (doAA) {
|
||||
SkRect devRect;
|
||||
matrix.mapRect(&devRect, rect);
|
||||
preConcatInverseToTextureMatrix(fContext, &grPaint);
|
||||
fillDevAARect(fContext, grPaint, Sk2Gr(devRect));
|
||||
} else {
|
||||
fContext->drawRect(grPaint, Sk2Gr(rect), -1);
|
||||
@ -795,6 +809,7 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect,
|
||||
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());
|
||||
|
Loading…
Reference in New Issue
Block a user