Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 | 128 |
| 129 // The upper-left and lower-right corners of the center square in the | 129 // The upper-left and lower-right corners of the center square in the |
| 130 // rendering of the ninebox. | 130 // rendering of the ninebox. |
| 131 int x1 = gdk_pixbuf_get_width(images_[0]->ToGdkPixbuf()); | 131 int x1 = gdk_pixbuf_get_width(images_[0]->ToGdkPixbuf()); |
| 132 int y1 = gdk_pixbuf_get_height(images_[0]->ToGdkPixbuf()); | 132 int y1 = gdk_pixbuf_get_height(images_[0]->ToGdkPixbuf()); |
| 133 int x2 = images_[2] ? dst_width - gdk_pixbuf_get_width( | 133 int x2 = images_[2] ? dst_width - gdk_pixbuf_get_width( |
| 134 images_[2]->ToGdkPixbuf()) : x1; | 134 images_[2]->ToGdkPixbuf()) : x1; |
| 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 // Note that we still want to do the painting if there's room in only one |
|
jennb
2012/06/04 22:17:52
Are you sure this won't mess up non-panel uses of
jianli
2012/06/05 18:48:30
This change is not needed any more since we switch
| |
| 139 // dimension, like minimized panel consisting of 4-pixel lines. | |
| 140 if (x2 < x1 && y2 < y1) | |
| 139 return; | 141 return; |
| 140 | 142 |
| 141 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(dst))); | 143 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(dst))); |
| 142 // For widgets that have their own window, the allocation (x,y) coordinates | 144 // For widgets that have their own window, the allocation (x,y) coordinates |
| 143 // are GdkWindow relative. For other widgets, the coordinates are relative | 145 // are GdkWindow relative. For other widgets, the coordinates are relative |
| 144 // to their container. | 146 // to their container. |
| 145 if (!gtk_widget_get_has_window(dst)) { | 147 if (!gtk_widget_get_has_window(dst)) { |
| 146 // Transform our cairo from window to widget coordinates. | 148 // Transform our cairo from window to widget coordinates. |
| 147 cairo_translate(cr, allocation.x, allocation.y); | 149 cairo_translate(cr, allocation.x, allocation.y); |
| 148 } | 150 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 cairo_paint(flipped_cr); | 221 cairo_paint(flipped_cr); |
| 220 cairo_destroy(flipped_cr); | 222 cairo_destroy(flipped_cr); |
| 221 | 223 |
| 222 // Mask the widget. | 224 // Mask the widget. |
| 223 gtk_widget_shape_combine_mask(widget, flipped_mask, 0, 0); | 225 gtk_widget_shape_combine_mask(widget, flipped_mask, 0, 0); |
| 224 g_object_unref(flipped_mask); | 226 g_object_unref(flipped_mask); |
| 225 } | 227 } |
| 226 | 228 |
| 227 g_object_unref(mask); | 229 g_object_unref(mask); |
| 228 } | 230 } |
| OLD | NEW |