| Index: src/gpu/SkGpuDevice.cpp
|
| diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
|
| index 9a78048aa7f139195a01c0bc0d97756319353da4..3f08aa4def073d422e2afc1ab1e9e5c3a8a02857 100644
|
| --- a/src/gpu/SkGpuDevice.cpp
|
| +++ b/src/gpu/SkGpuDevice.cpp
|
| @@ -1062,7 +1062,40 @@ void SkGpuDevice::drawBitmapCommon(const SkDraw& draw,
|
| }
|
| }
|
|
|
| - if (paint.getMaskFilter()){
|
| + // If the render target is not msaa and draw is antialiased, we call
|
| + // drawRect instead of drawing on the render target directly.
|
| + // FIXME: the tiled bitmap code path doesn't currently support
|
| + // anti-aliased edges, we work around that for now by drawing directly
|
| + // if the image size exceeds maximum texture size.
|
| + int maxTextureSize = fContext->getMaxTextureSize();
|
| + bool directDraw = fRenderTarget->isMultisampled() ||
|
| + !paint.isAntiAlias() ||
|
| + bitmap.width() > maxTextureSize ||
|
| + bitmap.height() > maxTextureSize;
|
| +
|
| + // we check whether dst rect are pixel aligned
|
| + if (!directDraw) {
|
| + bool staysRect = fContext->getMatrix().rectStaysRect();
|
| +
|
| + if (staysRect) {
|
| + SkRect rect;
|
| + SkRect dstRect = SkRect::MakeXYWH(0, 0, dstSize.fWidth, dstSize.fHeight);
|
| + fContext->getMatrix().mapRect(&rect, dstRect);
|
| + const SkScalar *scalars = rect.asScalars();
|
| + bool isDstPixelAligned = true;
|
| + for (int i = 0; i < 4; i++) {
|
| + if (!SkScalarIsInt(scalars[i])) {
|
| + isDstPixelAligned = false;
|
| + break;
|
| + }
|
| + }
|
| +
|
| + if (isDstPixelAligned)
|
| + directDraw = true;
|
| + }
|
| + }
|
| +
|
| + if (paint.getMaskFilter() || !directDraw) {
|
| // Convert the bitmap to a shader so that the rect can be drawn
|
| // through drawRect, which supports mask filters.
|
| SkBitmap tmp; // subset of bitmap, if necessary
|
|
|