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/avatar_menu_item_gtk.h" | 5 #include "chrome/browser/ui/gtk/avatar_menu_item_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 g_signal_connect_after(widget_.get(), "expose-event", | 195 g_signal_connect_after(widget_.get(), "expose-event", |
196 G_CALLBACK(OnEventBoxExposeThunk), this); | 196 G_CALLBACK(OnEventBoxExposeThunk), this); |
197 | 197 |
198 GtkWidget* item_hbox = gtk_hbox_new(FALSE, ui::kControlSpacing); | 198 GtkWidget* item_hbox = gtk_hbox_new(FALSE, ui::kControlSpacing); |
199 GdkPixbuf* avatar_pixbuf = NULL; | 199 GdkPixbuf* avatar_pixbuf = NULL; |
200 | 200 |
201 // If this profile is active then draw a check mark on the bottom right | 201 // If this profile is active then draw a check mark on the bottom right |
202 // of the profile icon. | 202 // of the profile icon. |
203 if (item_.active) { | 203 if (item_.active) { |
204 const SkBitmap* avatar_image = item_.icon.ToSkBitmap(); | 204 const SkBitmap* avatar_image = item_.icon.ToSkBitmap(); |
205 gfx::Canvas canvas(*avatar_image, /* is_opaque */ true); | 205 gfx::ImageSkiaRep avatar_image_rep = |
| 206 gfx::ImageSkiaRep(*avatar_image, ui::SCALE_FACTOR_100P); |
| 207 gfx::Canvas canvas(avatar_image_rep, /* is_opaque */ true); |
206 | 208 |
207 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 209 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
208 const SkBitmap* check_image = rb.GetImageNamed( | 210 const SkBitmap* check_image = rb.GetImageNamed( |
209 IDR_PROFILE_SELECTED).ToSkBitmap(); | 211 IDR_PROFILE_SELECTED).ToSkBitmap(); |
210 gfx::Rect check_rect(0, 0, check_image->width(), check_image->height()); | 212 gfx::Rect check_rect(0, 0, check_image->width(), check_image->height()); |
211 int y = avatar_image->height() - check_image->height(); | 213 int y = avatar_image->height() - check_image->height(); |
212 int x = avatar_image->width() - check_image->width() + kCheckMarkXOffset; | 214 int x = avatar_image->width() - check_image->width() + kCheckMarkXOffset; |
213 canvas.DrawImageInt(*check_image, x, y); | 215 canvas.DrawImageInt(*check_image, x, y); |
214 | 216 |
215 SkBitmap final_image = canvas.ExtractBitmap(); | 217 SkBitmap final_image = canvas.ExtractBitmap(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 280 |
279 GtkSizeGroup* size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | 281 GtkSizeGroup* size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); |
280 gtk_size_group_add_widget(size_group, status_label_); | 282 gtk_size_group_add_widget(size_group, status_label_); |
281 gtk_size_group_add_widget(size_group, link_alignment_); | 283 gtk_size_group_add_widget(size_group, link_alignment_); |
282 g_object_unref(size_group); | 284 g_object_unref(size_group); |
283 } | 285 } |
284 | 286 |
285 gtk_box_pack_start(GTK_BOX(item_hbox), item_vbox, TRUE, TRUE, 0); | 287 gtk_box_pack_start(GTK_BOX(item_hbox), item_vbox, TRUE, TRUE, 0); |
286 gtk_container_add(GTK_CONTAINER(widget_.get()), item_hbox); | 288 gtk_container_add(GTK_CONTAINER(widget_.get()), item_hbox); |
287 } | 289 } |
OLD | NEW |