| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/gtk/rounded_window.h" | 5 #include "chrome/browser/ui/gtk/rounded_window.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 #include <math.h> | 8 #include <math.h> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 gdk_gc_set_clip_rectangle(gc, &event->area); | 225 gdk_gc_set_clip_rectangle(gc, &event->area); |
| 226 gdk_gc_set_rgb_fg_color(gc, &data->border_color); | 226 gdk_gc_set_rgb_fg_color(gc, &data->border_color); |
| 227 | 227 |
| 228 // Stroke the frame border. | 228 // Stroke the frame border. |
| 229 std::vector<GdkPoint> points = MakeFramePolygonPoints( | 229 std::vector<GdkPoint> points = MakeFramePolygonPoints( |
| 230 data, FRAME_STROKE); | 230 data, FRAME_STROKE); |
| 231 if (data->drawn_borders == BORDER_ALL) { | 231 if (data->drawn_borders == BORDER_ALL) { |
| 232 // If we want to have borders everywhere, we need to draw a polygon instead | 232 // If we want to have borders everywhere, we need to draw a polygon instead |
| 233 // of a set of lines. | 233 // of a set of lines. |
| 234 gdk_draw_polygon(drawable, gc, FALSE, &points[0], points.size()); | 234 gdk_draw_polygon(drawable, gc, FALSE, &points[0], points.size()); |
| 235 } else if (points.size() > 0) { | 235 } else if (!points.empty()) { |
| 236 gdk_draw_lines(drawable, gc, &points[0], points.size()); | 236 gdk_draw_lines(drawable, gc, &points[0], points.size()); |
| 237 } | 237 } |
| 238 | 238 |
| 239 g_object_unref(gc); | 239 g_object_unref(gc); |
| 240 return FALSE; // Propagate so our children paint, etc. | 240 return FALSE; // Propagate so our children paint, etc. |
| 241 } | 241 } |
| 242 | 242 |
| 243 // On theme changes, window shapes are reset, but we detect whether we need to | 243 // On theme changes, window shapes are reset, but we detect whether we need to |
| 244 // reshape a window by whether its allocation has changed so force it to reset | 244 // reshape a window by whether its allocation has changed so force it to reset |
| 245 // the window shape on next expose. | 245 // the window shape on next expose. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 | 312 |
| 313 void SetRoundedWindowBorderColor(GtkWidget* widget, GdkColor color) { | 313 void SetRoundedWindowBorderColor(GtkWidget* widget, GdkColor color) { |
| 314 DCHECK(widget); | 314 DCHECK(widget); |
| 315 RoundedWindowData* data = static_cast<RoundedWindowData*>( | 315 RoundedWindowData* data = static_cast<RoundedWindowData*>( |
| 316 g_object_get_data(G_OBJECT(widget), kRoundedData)); | 316 g_object_get_data(G_OBJECT(widget), kRoundedData)); |
| 317 DCHECK(data); | 317 DCHECK(data); |
| 318 data->border_color = color; | 318 data->border_color = color; |
| 319 } | 319 } |
| 320 | 320 |
| 321 } // namespace gtk_util | 321 } // namespace gtk_util |
| OLD | NEW |