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

Unified Diff: src/effects/SkRectShaderImageFilter.cpp

Issue 26799004: SkRectShaderImageFilter: add a workaround for the zero-sized rects currently passed by Blink. Add … (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Revert the new API; keep just the workaround Created 7 years, 2 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/effects/SkRectShaderImageFilter.cpp
diff --git a/src/effects/SkRectShaderImageFilter.cpp b/src/effects/SkRectShaderImageFilter.cpp
index b1faebc813646c0a67eb4dca01f940d58445264b..37d6af28adccb2201fb719aa56d5a4f7c47f4fd3 100644
--- a/src/effects/SkRectShaderImageFilter.cpp
+++ b/src/effects/SkRectShaderImageFilter.cpp
@@ -16,9 +16,17 @@ SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const SkRe
SkASSERT(s);
#ifdef SK_CROP_RECT_IS_INT
SkIRect cropRect;
- rect.roundOut(&cropRect);
+ if (rect.width() == 0 || rect.height() == 0) {
+ cropRect = SkIRect::MakeLargest();
+ } else {
+ rect.roundOut(&cropRect);
+ }
#else
- CropRect cropRect(rect);
+ uint32_t flags = CropRect::kHasAll_CropEdge;
+ if (rect.width() == 0 || rect.height() == 0) {
+ flags = 0x0;
+ }
+ CropRect cropRect(rect, flags);
#endif
return SkNEW_ARGS(SkRectShaderImageFilter, (s, &cropRect));
}
« 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