| 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 "ui/views/controls/tree/tree_view_win.h" | 5 #include "ui/views/controls/tree/tree_view_win.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 ImageList_AddIcon(image_list, h_opened_icon); | 684 ImageList_AddIcon(image_list, h_opened_icon); |
| 685 DestroyIcon(h_closed_icon); | 685 DestroyIcon(h_closed_icon); |
| 686 DestroyIcon(h_opened_icon); | 686 DestroyIcon(h_opened_icon); |
| 687 for (size_t i = 0; i < model_images.size(); ++i) { | 687 for (size_t i = 0; i < model_images.size(); ++i) { |
| 688 HICON model_icon; | 688 HICON model_icon; |
| 689 | 689 |
| 690 // Need to resize the provided icons to be the same size as | 690 // Need to resize the provided icons to be the same size as |
| 691 // IDR_FOLDER_CLOSED if they aren't already. | 691 // IDR_FOLDER_CLOSED if they aren't already. |
| 692 if (model_images[i].width() != width || | 692 if (model_images[i].width() != width || |
| 693 model_images[i].height() != height) { | 693 model_images[i].height() != height) { |
| 694 gfx::Canvas canvas(gfx::Size(width, height), false); | 694 gfx::Canvas canvas(gfx::Size(width, height), ui::SCALE_FACTOR_100P, |
| 695 false); |
| 695 | 696 |
| 696 // Draw our icons into this canvas. | 697 // Draw our icons into this canvas. |
| 697 int height_offset = (height - model_images[i].height()) / 2; | 698 int height_offset = (height - model_images[i].height()) / 2; |
| 698 int width_offset = (width - model_images[i].width()) / 2; | 699 int width_offset = (width - model_images[i].width()) / 2; |
| 699 canvas.DrawImageInt(model_images[i], width_offset, height_offset); | 700 canvas.DrawImageInt(model_images[i], width_offset, height_offset); |
| 700 model_icon = IconUtil::CreateHICONFromSkBitmap(canvas.ExtractBitmap()); | 701 model_icon = IconUtil::CreateHICONFromSkBitmap( |
| 702 canvas.ExtractImageRep().sk_bitmap()); |
| 701 } else { | 703 } else { |
| 702 model_icon = IconUtil::CreateHICONFromSkBitmap(model_images[i]); | 704 model_icon = IconUtil::CreateHICONFromSkBitmap(model_images[i]); |
| 703 } | 705 } |
| 704 ImageList_AddIcon(image_list, model_icon); | 706 ImageList_AddIcon(image_list, model_icon); |
| 705 DestroyIcon(model_icon); | 707 DestroyIcon(model_icon); |
| 706 } | 708 } |
| 707 } | 709 } |
| 708 return image_list; | 710 return image_list; |
| 709 } | 711 } |
| 710 | 712 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 } | 795 } |
| 794 // Fall through and let the default handler process as well. | 796 // Fall through and let the default handler process as well. |
| 795 break; | 797 break; |
| 796 } | 798 } |
| 797 WNDPROC handler = tree->original_handler_; | 799 WNDPROC handler = tree->original_handler_; |
| 798 DCHECK(handler); | 800 DCHECK(handler); |
| 799 return CallWindowProc(handler, window, message, w_param, l_param); | 801 return CallWindowProc(handler, window, message, w_param, l_param); |
| 800 } | 802 } |
| 801 | 803 |
| 802 } // namespace views | 804 } // namespace views |
| OLD | NEW |