Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: views/controls/tree/tree_view.cc

Issue 365005: Converting the Cookies options page from a TableView to a TreeView... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/chrome.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/tree/tree_view.cc
===================================================================
--- views/controls/tree/tree_view.cc (revision 31154)
+++ views/controls/tree/tree_view.cc (working copy)
@@ -6,7 +6,9 @@
#include <vector>
+#include "app/gfx/canvas.h"
#include "app/gfx/canvas_paint.h"
+#include "app/gfx/favicon_size.h"
#include "app/gfx/icon_util.h"
#include "app/l10n_util.h"
#include "app/l10n_util_win.h"
@@ -653,7 +655,24 @@
DestroyIcon(h_closed_icon);
DestroyIcon(h_opened_icon);
for (size_t i = 0; i < model_images.size(); ++i) {
- HICON model_icon = IconUtil::CreateHICONFromSkBitmap(model_images[i]);
+ HICON model_icon;
+
+ // Need to resize the provided icons to be the same size as
+ // IDR_FOLDER_CLOSED if they aren't already.
+ if (model_images[i].width() != width ||
+ model_images[i].height() != height) {
+ gfx::Canvas canvas(width, height, false);
+ // Make the background completely transparent.
+ canvas.drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
+
+ // Draw our icons into this canvas.
+ int height_offset = (height - model_images[i].height()) / 2;
+ int width_offset = (width - model_images[i].width()) / 2;
+ canvas.DrawBitmapInt(model_images[i], width_offset, height_offset);
+ model_icon = IconUtil::CreateHICONFromSkBitmap(canvas.ExtractBitmap());
+ } else {
+ model_icon = IconUtil::CreateHICONFromSkBitmap(model_images[i]);
+ }
ImageList_AddIcon(image_list, model_icon);
DestroyIcon(model_icon);
}
« no previous file with comments | « chrome/chrome.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698