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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 1351533004: share code between SkGr and Cacherator (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: captured strict check in a helper function Created 5 years, 3 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 | « src/core/SkImageCacherator.cpp ('k') | src/gpu/SkGr.cpp » ('j') | 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 bba352569abe80026824e8c0d4435ba2b0c16e1b..d897f3ce88ff4686c97c65b4f4edbca175c3825e 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1042,6 +1042,13 @@ static void draw_aa_bitmap(GrDrawContext* drawContext, GrContext* context,
drawContext->drawBatch(renderTarget, clip, grPaint, batch);
}
+static bool can_ignore_strict_subset_constraint(const SkBitmap& bitmap, const SkRect& subset) {
+ GrTexture* tex = bitmap.getTexture();
+ int width = tex ? tex->width() : bitmap.width();
+ int height = tex ? tex->height() : bitmap.height();
+ return subset.contains(SkRect::MakeIWH(width, height));
+}
+
void SkGpuDevice::drawBitmapCommon(const SkDraw& draw,
const SkBitmap& bitmap,
const SkRect* srcRectPtr,
@@ -1065,11 +1072,8 @@ void SkGpuDevice::drawBitmapCommon(const SkDraw& draw,
srcRect = *srcRectPtr;
dstSize = *dstSizePtr;
}
- GrTexture* tex = bitmap.getTexture();
- int width = tex ? tex->width() : bitmap.width();
- int height = tex ? tex->height() : bitmap.height();
- if (srcRect.fLeft <= 0 && srcRect.fTop <= 0 &&
- srcRect.fRight >= width && srcRect.fBottom >= height) {
+
+ if (can_ignore_strict_subset_constraint(bitmap, srcRect)) {
constraint = SkCanvas::kFast_SrcRectConstraint;
}
« no previous file with comments | « src/core/SkImageCacherator.cpp ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698