| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 images_[5] = right ? &rb.GetNativeImageNamed(right) : NULL; | 71 images_[5] = right ? &rb.GetNativeImageNamed(right) : NULL; |
| 72 images_[6] = bottom_left ? &rb.GetNativeImageNamed(bottom_left) : NULL; | 72 images_[6] = bottom_left ? &rb.GetNativeImageNamed(bottom_left) : NULL; |
| 73 images_[7] = bottom ? &rb.GetNativeImageNamed(bottom) : NULL; | 73 images_[7] = bottom ? &rb.GetNativeImageNamed(bottom) : NULL; |
| 74 images_[8] = bottom_right ? &rb.GetNativeImageNamed(bottom_right) : NULL; | 74 images_[8] = bottom_right ? &rb.GetNativeImageNamed(bottom_right) : NULL; |
| 75 } | 75 } |
| 76 | 76 |
| 77 NineBox::NineBox(int image, int top_margin, int bottom_margin, int left_margin, | 77 NineBox::NineBox(int image, int top_margin, int bottom_margin, int left_margin, |
| 78 int right_margin) | 78 int right_margin) |
| 79 : unref_images_on_destroy_(true) { | 79 : unref_images_on_destroy_(true) { |
| 80 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 80 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 81 GdkPixbuf* pixbuf = rb.GetNativeImageNamed(image); | 81 GdkPixbuf* pixbuf = rb.GetNativeImageNamed(image).ToGdkPixbuf(); |
| 82 int width = gdk_pixbuf_get_width(pixbuf); | 82 int width = gdk_pixbuf_get_width(pixbuf); |
| 83 int height = gdk_pixbuf_get_height(pixbuf); | 83 int height = gdk_pixbuf_get_height(pixbuf); |
| 84 int inset_width = left_margin + right_margin; | 84 int inset_width = left_margin + right_margin; |
| 85 int inset_height = top_margin + bottom_margin; | 85 int inset_height = top_margin + bottom_margin; |
| 86 | 86 |
| 87 images_[0] = new gfx::Image(gdk_pixbuf_new_subpixbuf( | 87 images_[0] = new gfx::Image(gdk_pixbuf_new_subpixbuf( |
| 88 pixbuf, 0, 0, left_margin, top_margin)); | 88 pixbuf, 0, 0, left_margin, top_margin)); |
| 89 images_[1] = new gfx::Image(gdk_pixbuf_new_subpixbuf( | 89 images_[1] = new gfx::Image(gdk_pixbuf_new_subpixbuf( |
| 90 pixbuf, left_margin, 0, width - inset_width, top_margin)); | 90 pixbuf, left_margin, 0, width - inset_width, top_margin)); |
| 91 images_[2] = new gfx::Image(gdk_pixbuf_new_subpixbuf( | 91 images_[2] = new gfx::Image(gdk_pixbuf_new_subpixbuf( |
| (...skipping 127 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 |