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

Unified Diff: ui/gfx/rect.cc

Issue 7464027: Wayland support for views. views_desktop on Wayland. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merged native_menu_wayland and native_menu_x and styling fixes Created 9 years, 4 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
Index: ui/gfx/rect.cc
diff --git a/ui/gfx/rect.cc b/ui/gfx/rect.cc
index 5413711b4091a8a00c2ed64ff00367acd028f904..96a8b0dc2ed54a28a9758486224a3bbff06deaf4 100644
--- a/ui/gfx/rect.cc
+++ b/ui/gfx/rect.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,9 +8,12 @@
#include <windows.h>
#elif defined(OS_MACOSX)
#include <CoreGraphics/CGGeometry.h>
-#elif defined(OS_POSIX)
+#elif defined(USE_X11)
#include <gdk/gdk.h>
#endif
+#if defined(USE_WAYLAND)
+#include <cairo.h>
+#endif
#include <ostream>
@@ -77,7 +80,7 @@ Rect& Rect::operator=(const CGRect& r) {
set_height(r.size.height);
return *this;
}
-#elif defined(OS_POSIX)
+#elif defined(USE_X11)
Rect::Rect(const GdkRectangle& r)
: origin_(r.x, r.y) {
set_width(r.width);
@@ -91,6 +94,21 @@ Rect& Rect::operator=(const GdkRectangle& r) {
return *this;
}
#endif
+#if defined(USE_WAYLAND)
+Rect::Rect(const cairo_rectangle_int_t& r)
+ : origin_(r.x, r.y) {
+ set_width(r.width);
+ set_height(r.height);
+}
+
+Rect& Rect::operator=(const cairo_rectangle_int_t& r) {
+ origin_.SetPoint(r.x, r.y);
+ set_width(r.width);
+ set_height(r.height);
+ return *this;
+}
+#endif
+
void Rect::SetRect(int x, int y, int width, int height) {
origin_.SetPoint(x, y);
@@ -141,12 +159,18 @@ RECT Rect::ToRECT() const {
CGRect Rect::ToCGRect() const {
return CGRectMake(x(), y(), width(), height());
}
-#elif defined(OS_POSIX)
+#elif defined(USE_X11)
GdkRectangle Rect::ToGdkRectangle() const {
GdkRectangle r = {x(), y(), width(), height()};
return r;
}
#endif
+#if defined(USE_WAYLAND)
+cairo_rectangle_int_t Rect::ToCairoRectangle() const {
+ cairo_rectangle_int_t r = {x(), y(), width(), height()};
+ return r;
+}
+#endif
bool Rect::Contains(int point_x, int point_y) const {
return (point_x >= x()) && (point_x < right()) &&

Powered by Google App Engine
This is Rietveld 408576698