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

Unified Diff: ui/display/win/scaling_util.h

Issue 2012083002: Multiple DPI Tracking for ScreenWin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR Feedback Created 4 years, 7 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 | ui/display/win/scaling_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/display/win/scaling_util.h
diff --git a/ui/display/win/scaling_util.h b/ui/display/win/scaling_util.h
index be68b9d94978395defb2af159c68a3ab453c83ff..615396a2fc705c2e32196e3c5d85109bf856762b 100644
--- a/ui/display/win/scaling_util.h
+++ b/ui/display/win/scaling_util.h
@@ -107,6 +107,40 @@ DISPLAY_EXPORT DisplayPlacement CalculateDisplayPlacement(
const DisplayInfo& parent,
const DisplayInfo& current);
+// Returns the squared distance between two rects.
+// The distance between two rects is the length of the shortest segment that can
+// be drawn between two rectangles. This segment generally connects two opposing
+// corners between rectangles like this...
+//
+// +----------+
+// | |
+// +----------+
+// \ <--- Shortest Segment
+// \
+// +---+
+// | |
+// | |
+// +---+
+//
+// For rectangles that share coordinates within the same axis, that generally
+// means the segment is parallel to the axis and perpendicular to the edges.
+//
+// One of many shortest segments
+// +----------+ / \ +--------+
+// | | | \ | |
+// | | V +---+ \ +--------+
+// | |-----| | \-->|
+// +----------+ | | +----+
+// | | | |
+// +---+ +----+
+//
+// For rectangles that intersect each other, the distance is 0.
+//
+// The squared distance is used to avoid taking the square root as the common
+// usage is to compare distances greater than 1 unit.
+DISPLAY_EXPORT int64_t SquaredDistanceBetweenRects(const gfx::Rect& ref,
+ const gfx::Rect& rect);
+
} // namespace win
} // namespace display
« no previous file with comments | « no previous file | ui/display/win/scaling_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698