diff options
Diffstat (limited to 'src/gpu/SkGpuDevice.cpp')
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 25ad78176a..1dec0f6371 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -1048,8 +1048,13 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap, sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(bitmap.colorSpace(), fRenderTargetContext->getColorSpace()); + SkScalar iw = 1.f / texture->width(); + SkScalar ih = 1.f / texture->height(); + + SkMatrix texMatrix; // Compute a matrix that maps the rect we will draw to the src rect. - SkMatrix texMatrix = SkMatrix::MakeRectToRect(dstRect, srcRect, SkMatrix::kFill_ScaleToFit); + texMatrix.setRectToRect(dstRect, srcRect, SkMatrix::kFill_ScaleToFit); + texMatrix.postScale(iw, ih); // Construct a GrPaint by setting the bitmap texture as the first effect and then configuring // the rest from the SkPaint. @@ -1195,7 +1200,10 @@ void SkGpuDevice::drawSpecial(const SkDraw& draw, SkMatrix::I(), SkRect::Make(SkIRect::MakeXYWH( left + offset.fX, top + offset.fY, subset.width(), subset.height())), - SkRect::Make(subset)); + SkRect::MakeXYWH(SkIntToScalar(subset.fLeft) / texture->width(), + SkIntToScalar(subset.fTop) / texture->height(), + SkIntToScalar(subset.width()) / texture->width(), + SkIntToScalar(subset.height()) / texture->height())); } void SkGpuDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, |