Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 1808743003: Allow SkGpuDevice::drawSprite to handle subset SkBitmaps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: allos SkGpuDevice::drawSprite to handle subset SkBitmaps Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 7a6d9675382cea1f6d11d7fe9c0c88bca038f312..4234ecf2b1d7cf155a156794e43e7454a75c9ce0 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1142,6 +1142,8 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
return;
}
+ int offX = bitmap.pixelRefOrigin().fX;
+ int offY = bitmap.pixelRefOrigin().fY;
int w = bitmap.width();
int h = bitmap.height();
@@ -1170,6 +1172,8 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
if (this->filterTexture(fContext, texture, w, h, filter, ctx, &filteredBitmap,
&offset)) {
texture = (GrTexture*) filteredBitmap.getTexture();
+ offX = filteredBitmap.pixelRefOrigin().fX;
+ offY = filteredBitmap.pixelRefOrigin().fY;
w = filteredBitmap.width();
h = filteredBitmap.height();
left += offset.x();
@@ -1200,10 +1204,10 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
SkIntToScalar(top),
SkIntToScalar(w),
SkIntToScalar(h)),
- SkRect::MakeXYWH(0,
- 0,
- SK_Scalar1 * w / texture->width(),
- SK_Scalar1 * h / texture->height()));
+ SkRect::MakeXYWH(SkIntToScalar(offX) / texture->width(),
+ SkIntToScalar(offY) / texture->height(),
+ SkIntToScalar(w) / texture->width(),
+ SkIntToScalar(h) / texture->height()));
}
void SkGpuDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698