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/nine_box.h" | 5 #include "chrome/browser/ui/gtk/nine_box.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 cairo_destroy(cr); | 168 cairo_destroy(cr); |
169 } | 169 } |
170 | 170 |
171 void NineBox::RenderTopCenterStrip(cairo_t* cr, int x, int y, | 171 void NineBox::RenderTopCenterStrip(cairo_t* cr, int x, int y, |
172 int width) const { | 172 int width) const { |
173 const int height = gdk_pixbuf_get_height(images_[1]); | 173 const int height = gdk_pixbuf_get_height(images_[1]); |
174 TileImage(cr, images_[1], x, y, width, height, 1.0); | 174 TileImage(cr, images_[1], x, y, width, height, 1.0); |
175 } | 175 } |
176 | 176 |
177 void NineBox::ContourWidget(GtkWidget* widget) const { | 177 void NineBox::ContourWidget(GtkWidget* widget) const { |
178 int width = widget->allocation.width; | 178 GtkAllocation allocation; |
179 int height = widget->allocation.height; | 179 gtk_widget_get_allocation(widget, &allocation); |
| 180 int width = allocation.width; |
| 181 int height = allocation.height; |
180 int x1 = gdk_pixbuf_get_width(images_[0]); | 182 int x1 = gdk_pixbuf_get_width(images_[0]); |
181 int x2 = width - gdk_pixbuf_get_width(images_[2]); | 183 int x2 = width - gdk_pixbuf_get_width(images_[2]); |
182 | 184 |
183 // Paint the left and right sides. | 185 // Paint the left and right sides. |
184 GdkBitmap* mask = gdk_pixmap_new(NULL, width, height, 1); | 186 GdkBitmap* mask = gdk_pixmap_new(NULL, width, height, 1); |
185 gdk_pixbuf_render_threshold_alpha(images_[0], mask, | 187 gdk_pixbuf_render_threshold_alpha(images_[0], mask, |
186 0, 0, | 188 0, 0, |
187 0, 0, -1, -1, | 189 0, 0, -1, -1, |
188 1); | 190 1); |
189 gdk_pixbuf_render_threshold_alpha(images_[2], mask, | 191 gdk_pixbuf_render_threshold_alpha(images_[2], mask, |
(...skipping 28 matching lines...) Expand all Loading... |
218 cairo_paint(flipped_cr); | 220 cairo_paint(flipped_cr); |
219 cairo_destroy(flipped_cr); | 221 cairo_destroy(flipped_cr); |
220 | 222 |
221 // Mask the widget. | 223 // Mask the widget. |
222 gtk_widget_shape_combine_mask(widget, flipped_mask, 0, 0); | 224 gtk_widget_shape_combine_mask(widget, flipped_mask, 0, 0); |
223 g_object_unref(flipped_mask); | 225 g_object_unref(flipped_mask); |
224 } | 226 } |
225 | 227 |
226 g_object_unref(mask); | 228 g_object_unref(mask); |
227 } | 229 } |
OLD | NEW |