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

Side by Side Diff: ui/app_list/app_list_item_view.cc

Issue 10820049: Load 2x resources on demand (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated comment Created 8 years, 3 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/app_list/app_list_item_model.cc ('k') | ui/base/resource/resource_bundle.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/app_list/app_list_item_view.h" 5 #include "ui/app_list/app_list_item_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 98
99 void ResizeAndGenerateShadow() { 99 void ResizeAndGenerateShadow() {
100 if (cancel_flag_.IsSet()) 100 if (cancel_flag_.IsSet())
101 return; 101 return;
102 102
103 gfx::ImageSkia resized(gfx::ImageSkiaOperations::CreateResizedImage(image_, 103 gfx::ImageSkia resized(gfx::ImageSkiaOperations::CreateResizedImage(image_,
104 skia::ImageOperations::RESIZE_BEST, size_)); 104 skia::ImageOperations::RESIZE_BEST, size_));
105 gfx::ImageSkia shadow( 105 gfx::ImageSkia shadow(
106 gfx::ImageSkiaOperations::CreateImageWithDropShadow(resized, shadows_)); 106 gfx::ImageSkiaOperations::CreateImageWithDropShadow(resized, shadows_));
107
108 // The following statement causes shadowed image being generated for all
109 // existing image reps in |image_|. This is needed so that expensive shadow
110 // generation does not run on UI thread.
111 gfx::ImageSkia::ImageSkiaReps image_reps = image_.image_reps();
112 for (gfx::ImageSkia::ImageSkiaReps::const_iterator it = image_reps.begin();
113 it != image_reps.end(); ++it) {
114 shadow.GetRepresentation(it->scale_factor());
115 }
116 image_ = shadow; 107 image_ = shadow;
108 image_.MakeThreadSafe();
117 } 109 }
118 110
119 void Cancel() { 111 void Cancel() {
120 cancel_flag_.Set(); 112 cancel_flag_.Set();
121 } 113 }
122 114
123 const gfx::ImageSkia& image() const { 115 const gfx::ImageSkia& image() const {
124 return image_; 116 return image_;
125 } 117 }
126 118
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 apps_grid_view_->SetSelectedItem(this); 300 apps_grid_view_->SetSelectedItem(this);
309 title_->SetEnabledColor(kTitleHoverColor); 301 title_->SetEnabledColor(kTitleHoverColor);
310 } else { 302 } else {
311 apps_grid_view_->ClearSelectedItem(this); 303 apps_grid_view_->ClearSelectedItem(this);
312 model_->SetHighlighted(false); 304 model_->SetHighlighted(false);
313 title_->SetEnabledColor(kTitleColor); 305 title_->SetEnabledColor(kTitleColor);
314 } 306 }
315 } 307 }
316 308
317 } // namespace app_list 309 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/app_list_item_model.cc ('k') | ui/base/resource/resource_bundle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698