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); |
| 16 const GdkColor kGdkBlack = GDK_COLOR_RGB(0x00, 0x00, 0x00); |
| 17 |
15 void SubtractRectanglesFromRegion(GdkRegion* region, | 18 void SubtractRectanglesFromRegion(GdkRegion* region, |
16 const std::vector<gfx::Rect>& cutouts) { | 19 const std::vector<Rect>& cutouts) { |
17 for (size_t i = 0; i < cutouts.size(); ++i) { | 20 for (size_t i = 0; i < cutouts.size(); ++i) { |
18 GdkRectangle rect = cutouts[i].ToGdkRectangle(); | 21 GdkRectangle rect = cutouts[i].ToGdkRectangle(); |
19 GdkRegion* rect_region = gdk_region_rectangle(&rect); | 22 GdkRegion* rect_region = gdk_region_rectangle(&rect); |
20 gdk_region_subtract(region, rect_region); | 23 gdk_region_subtract(region, rect_region); |
21 // TODO(deanm): It would be nice to be able to reuse the GdkRegion here. | 24 // TODO(deanm): It would be nice to be able to reuse the GdkRegion here. |
22 gdk_region_destroy(rect_region); | 25 gdk_region_destroy(rect_region); |
23 } | 26 } |
24 } | 27 } |
25 | 28 |
26 static void FreePixels(guchar* pixels, gpointer data) { | 29 static void FreePixels(guchar* pixels, gpointer data) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 GtkWidget* ebox = gtk_event_box_new(); | 72 GtkWidget* ebox = gtk_event_box_new(); |
70 gtk_widget_modify_bg(ebox, GTK_STATE_NORMAL, color); | 73 gtk_widget_modify_bg(ebox, GTK_STATE_NORMAL, color); |
71 GtkWidget* alignment = gtk_alignment_new(0, 0, 1, 1); | 74 GtkWidget* alignment = gtk_alignment_new(0, 0, 1, 1); |
72 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), top, bottom, left, right); | 75 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), top, bottom, left, right); |
73 gtk_container_add(GTK_CONTAINER(alignment), child); | 76 gtk_container_add(GTK_CONTAINER(alignment), child); |
74 gtk_container_add(GTK_CONTAINER(ebox), alignment); | 77 gtk_container_add(GTK_CONTAINER(ebox), alignment); |
75 return ebox; | 78 return ebox; |
76 } | 79 } |
77 | 80 |
78 } // namespace gfx | 81 } // namespace gfx |
OLD | NEW |