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

Side by Side Diff: ui/gfx/rect.h

Issue 10704198: Scale to DIPs in ppb_graphics2d_impl for proper invalidation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make generic ScaleBounds method, handle scroll properly Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/gfx/rect.cc » ('j') | webkit/plugins/ppapi/ppb_graphics_2d_impl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Defines a simple integer rectangle class. The containment semantics 5 // Defines a simple integer rectangle class. The containment semantics
6 // are array-like; that is, the coordinate (x, y) is considered to be 6 // are array-like; that is, the coordinate (x, y) is considered to be
7 // contained by the rectangle, but the coordinate (x + width, y) is not. 7 // contained by the rectangle, but the coordinate (x + width, y) is not.
8 // The class will happily let you create malformed rectangles (that is, 8 // The class will happily let you create malformed rectangles (that is,
9 // rectangles with negative width and/or height), but there will be assertions 9 // rectangles with negative width and/or height), but there will be assertions
10 // in the operations (such as Contains()) to complain in this case. 10 // in the operations (such as Contains()) to complain in this case.
(...skipping 27 matching lines...) Expand all
38 #elif defined(OS_MACOSX) 38 #elif defined(OS_MACOSX)
39 explicit Rect(const CGRect& r); 39 explicit Rect(const CGRect& r);
40 #elif defined(TOOLKIT_GTK) 40 #elif defined(TOOLKIT_GTK)
41 explicit Rect(const GdkRectangle& r); 41 explicit Rect(const GdkRectangle& r);
42 #endif 42 #endif
43 explicit Rect(const gfx::Size& size); 43 explicit Rect(const gfx::Size& size);
44 Rect(const gfx::Point& origin, const gfx::Size& size); 44 Rect(const gfx::Point& origin, const gfx::Size& size);
45 45
46 ~Rect(); 46 ~Rect();
47 47
48 // Apply scale to a rectangle, taking care in to round coordinates outward so
49 // a rectangle scaled down then scaled back up by the inverse scale would
50 // fully contain the original.
51 void ScaleBounds(float scale);
sky 2012/07/17 22:12:12 rect_base already has Scale(float). Is there a rea
Josh Horwich 2012/07/17 22:53:36 Yes, that method scales the origin and size indepe
52
48 #if defined(OS_WIN) 53 #if defined(OS_WIN)
49 Rect& operator=(const RECT& r); 54 Rect& operator=(const RECT& r);
50 #elif defined(OS_MACOSX) 55 #elif defined(OS_MACOSX)
51 Rect& operator=(const CGRect& r); 56 Rect& operator=(const CGRect& r);
52 #elif defined(TOOLKIT_GTK) 57 #elif defined(TOOLKIT_GTK)
53 Rect& operator=(const GdkRectangle& r); 58 Rect& operator=(const GdkRectangle& r);
54 #endif 59 #endif
55 60
56 #if defined(OS_WIN) 61 #if defined(OS_WIN)
57 // Construct an equivalent Win32 RECT object. 62 // Construct an equivalent Win32 RECT object.
58 RECT ToRECT() const; 63 RECT ToRECT() const;
59 #elif defined(TOOLKIT_GTK) 64 #elif defined(TOOLKIT_GTK)
60 GdkRectangle ToGdkRectangle() const; 65 GdkRectangle ToGdkRectangle() const;
61 #elif defined(OS_MACOSX) 66 #elif defined(OS_MACOSX)
62 // Construct an equivalent CoreGraphics object. 67 // Construct an equivalent CoreGraphics object.
63 CGRect ToCGRect() const; 68 CGRect ToCGRect() const;
64 #endif 69 #endif
65 70
66 std::string ToString() const; 71 std::string ToString() const;
67 }; 72 };
68 73
69 #if !defined(COMPILER_MSVC) 74 #if !defined(COMPILER_MSVC)
70 extern template class RectBase<Rect, Point, Size, Insets, int>; 75 extern template class RectBase<Rect, Point, Size, Insets, int>;
71 #endif 76 #endif
72 77
73 } // namespace gfx 78 } // namespace gfx
74 79
75 #endif // UI_GFX_RECT_H_ 80 #endif // UI_GFX_RECT_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/rect.cc » ('j') | webkit/plugins/ppapi/ppb_graphics_2d_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698