summaryrefslogtreecommitdiffstats
path: root/ui/gfx/rect_conversions.h
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-14 07:28:11 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-14 07:28:11 +0000
commit79fbdab0cd96515427b35140e4fdb342824d2d80 (patch)
tree4b7c4f7acd5dd50e893c105f539301f939d8b6ee /ui/gfx/rect_conversions.h
parentaa192047047c36d454eebd12ac44b9e23b56fecb (diff)
downloadchromium_src-79fbdab0cd96515427b35140e4fdb342824d2d80.zip
chromium_src-79fbdab0cd96515427b35140e4fdb342824d2d80.tar.gz
chromium_src-79fbdab0cd96515427b35140e4fdb342824d2d80.tar.bz2
ui: Remove implicit flooring in skia rect conversion methods.
The current SkRectToRect method implicitly floors all components of thre rect and this is bad. Replace this method with SkRectToRectF which keeps everything as floating point. We also add a conversion method from RectF to SkRect. Tests: ui_unittests:RectTest.SkiaRectConversions R=sky BUG=147395 Moved From: https://codereview.chromium.org/11275089/ Review URL: https://chromiumcodereview.appspot.com/11359172 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167620 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/rect_conversions.h')
-rw-r--r--ui/gfx/rect_conversions.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/ui/gfx/rect_conversions.h b/ui/gfx/rect_conversions.h
index c8170cc..7c971b3 100644
--- a/ui/gfx/rect_conversions.h
+++ b/ui/gfx/rect_conversions.h
@@ -16,6 +16,12 @@ UI_EXPORT Rect ToEnclosingRect(const RectF& rect);
// Returns the largest Rect that is enclosed by the given RectF.
UI_EXPORT Rect ToEnclosedRect(const RectF& rect);
+// Returns the Rect after snapping the corners of the RectF to an integer grid.
+// This should only be used when the RectF you provide is expected to be an
+// integer rect with floating point error. If it is an arbitrary RectF, then
+// you should use a different method.
+UI_EXPORT Rect ToNearestRect(const RectF& rect);
+
// Returns a Rect obtained by flooring the values of the given RectF.
// Please prefer the previous two functions in new code.
UI_EXPORT Rect ToFlooredRectDeprecated(const RectF& rect);