| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/gfx/gtk_util.h" | 5 #include "base/gfx/gtk_util.h" |
| 6 | 6 |
| 7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "base/gfx/rect.h" | 10 #include "base/gfx/rect.h" |
| 11 #include "skia/include/SkBitmap.h" | 11 #include "skia/include/SkBitmap.h" |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 | 14 |
| 15 const GdkColor kGdkWhite = GDK_COLOR_RGB(0xff, 0xff, 0xff); | 15 const GdkColor kGdkWhite = GDK_COLOR_RGB(0xff, 0xff, 0xff); |
| 16 const GdkColor kGdkBlack = GDK_COLOR_RGB(0x00, 0x00, 0x00); | 16 const GdkColor kGdkBlack = GDK_COLOR_RGB(0x00, 0x00, 0x00); |
| 17 GdkColor kGdkSeafoamGreen = GDK_COLOR_RGB(0x0, 0xff, 0x80); |
| 17 | 18 |
| 18 void SubtractRectanglesFromRegion(GdkRegion* region, | 19 void SubtractRectanglesFromRegion(GdkRegion* region, |
| 19 const std::vector<Rect>& cutouts) { | 20 const std::vector<Rect>& cutouts) { |
| 20 for (size_t i = 0; i < cutouts.size(); ++i) { | 21 for (size_t i = 0; i < cutouts.size(); ++i) { |
| 21 GdkRectangle rect = cutouts[i].ToGdkRectangle(); | 22 GdkRectangle rect = cutouts[i].ToGdkRectangle(); |
| 22 GdkRegion* rect_region = gdk_region_rectangle(&rect); | 23 GdkRegion* rect_region = gdk_region_rectangle(&rect); |
| 23 gdk_region_subtract(region, rect_region); | 24 gdk_region_subtract(region, rect_region); |
| 24 // TODO(deanm): It would be nice to be able to reuse the GdkRegion here. | 25 // TODO(deanm): It would be nice to be able to reuse the GdkRegion here. |
| 25 gdk_region_destroy(rect_region); | 26 gdk_region_destroy(rect_region); |
| 26 } | 27 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 GtkWidget* ebox = gtk_event_box_new(); | 73 GtkWidget* ebox = gtk_event_box_new(); |
| 73 gtk_widget_modify_bg(ebox, GTK_STATE_NORMAL, color); | 74 gtk_widget_modify_bg(ebox, GTK_STATE_NORMAL, color); |
| 74 GtkWidget* alignment = gtk_alignment_new(0, 0, 1, 1); | 75 GtkWidget* alignment = gtk_alignment_new(0, 0, 1, 1); |
| 75 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), top, bottom, left, right); | 76 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), top, bottom, left, right); |
| 76 gtk_container_add(GTK_CONTAINER(alignment), child); | 77 gtk_container_add(GTK_CONTAINER(alignment), child); |
| 77 gtk_container_add(GTK_CONTAINER(ebox), alignment); | 78 gtk_container_add(GTK_CONTAINER(ebox), alignment); |
| 78 return ebox; | 79 return ebox; |
| 79 } | 80 } |
| 80 | 81 |
| 81 } // namespace gfx | 82 } // namespace gfx |
| OLD | NEW |