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

Side by Side Diff: ui/gfx/win/rect_util.h

Issue 1426933002: Refactor Windows DPI Point, Rect, and Size for Multiple Monitor DPI Awareness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make DisplayWin Standalone Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « ui/gfx/win/dpi.cc ('k') | ui/gfx/win/rect_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_GFX_WIN_RECT_UTIL_H_
6 #define UI_GFX_WIN_RECT_UTIL_H_
7
8 #include <stdint.h>
9
10 #include "ui/gfx/gfx_export.h"
11
12 namespace gfx {
13
14 class Point;
15 class Rect;
16
17 namespace win {
18
19 enum class RectEdge {
20 BOTTOM = 0,
21 LEFT = 1,
22 TOP = 2,
23 RIGHT = 3,
24 NONE = 4,
25 };
26
27 // Returns |ref|'s RectEdge touching |test|.
28 RectEdge GFX_EXPORT RectTouch(gfx::Rect ref, gfx::Rect test);
29
30 // Returns a scaled and positioned rect based off of target_rect and context.
31 // The reference rectangle and target rectangle may scale at different rates.
32 // This function attempts to preserve the relative positioning of the target
33 // rectangle with respect to the scaled rectangle in the face of differing
34 // scale factors.
35 //
36 // Examples:
37 // +--------------+ Since both rectangles are of the same
38 // | | scale factor, positions and sizes
39 // | | remain the same.
40 // | REF 1x +----------+
41 // | | |
42 // +--------------+ 1x |
43 // | |
44 // +----------+
45 //
46 // Original
47 // +--------------+ The 2x rectangle is scaled down while
48 // | | maintaining a similar neighboring relationship
49 // | | with the 1x rectangle.
50 // | REF 1x +----------+
51 // | | |
52 // +--------------+ 2x |
53 // | |
54 // +----------+
55 // Scaled
56 // +--------------+
57 // | |
58 // | |
59 // | REF 1x |
60 // | +-----+
61 // +--------------+ 2x |
62 // +-----+
63 gfx::Rect GFX_EXPORT ScaleAndPositionRect(gfx::Rect ref_scaled_rect,
64 gfx::Rect ref_original_rect,
65 gfx::Rect target_rect,
66 float target_scale_factor);
67
68 // Returns the squared distance between two rects.
69 int64_t GFX_EXPORT SquaredDistanceBetweenRects(gfx::Rect ref, gfx::Rect rect);
70
71 } // namespace win
72 } // namespace gfx
73
74 #endif // UI_GFX_WIN_RECT_UTIL_H_
OLDNEW
« no previous file with comments | « ui/gfx/win/dpi.cc ('k') | ui/gfx/win/rect_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698