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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 int y2 = images_[6] ? dst_height - gdk_pixbuf_get_height( | 135 int y2 = images_[6] ? dst_height - gdk_pixbuf_get_height( |
136 images_[6]->ToGdkPixbuf()) : y1; | 136 images_[6]->ToGdkPixbuf()) : y1; |
137 // Paint nothing if there's not enough room. | 137 // Paint nothing if there's not enough room. |
138 if (x2 < x1 || y2 < y1) | 138 if (x2 < x1 || y2 < y1) |
139 return; | 139 return; |
140 | 140 |
141 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(dst->window)); | 141 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(dst->window)); |
142 // For widgets that have their own window, the allocation (x,y) coordinates | 142 // For widgets that have their own window, the allocation (x,y) coordinates |
143 // are GdkWindow relative. For other widgets, the coordinates are relative | 143 // are GdkWindow relative. For other widgets, the coordinates are relative |
144 // to their container. | 144 // to their container. |
145 if (GTK_WIDGET_NO_WINDOW(dst)) { | 145 if (!gtk_widget_get_has_window(dst)) { |
146 // Transform our cairo from window to widget coordinates. | 146 // Transform our cairo from window to widget coordinates. |
147 cairo_translate(cr, allocation.x, allocation.y); | 147 cairo_translate(cr, allocation.x, allocation.y); |
148 } | 148 } |
149 | 149 |
150 if (base::i18n::IsRTL()) { | 150 if (base::i18n::IsRTL()) { |
151 cairo_translate(cr, dst_width, 0.0f); | 151 cairo_translate(cr, dst_width, 0.0f); |
152 cairo_scale(cr, -1.0f, 1.0f); | 152 cairo_scale(cr, -1.0f, 1.0f); |
153 } | 153 } |
154 | 154 |
155 // Top row, center image is horizontally tiled. | 155 // Top row, center image is horizontally tiled. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 cairo_paint(flipped_cr); | 219 cairo_paint(flipped_cr); |
220 cairo_destroy(flipped_cr); | 220 cairo_destroy(flipped_cr); |
221 | 221 |
222 // Mask the widget. | 222 // Mask the widget. |
223 gtk_widget_shape_combine_mask(widget, flipped_mask, 0, 0); | 223 gtk_widget_shape_combine_mask(widget, flipped_mask, 0, 0); |
224 g_object_unref(flipped_mask); | 224 g_object_unref(flipped_mask); |
225 } | 225 } |
226 | 226 |
227 g_object_unref(mask); | 227 g_object_unref(mask); |
228 } | 228 } |
OLD | NEW |