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

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: cleanup Created 8 years, 4 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
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 // Make sure that the image contains ImageSkiaReps for supported
109 // scale factors.
110 image_.EnsureRepsForSupportedScaleFactors();
111 // All images are generated. We no longer need source.
112 image_.DeleteSource();
117 } 113 }
118 114
119 void Cancel() { 115 void Cancel() {
120 cancel_flag_.Set(); 116 cancel_flag_.Set();
121 } 117 }
122 118
123 const gfx::ImageSkia& image() const { 119 const gfx::ImageSkia& image() const {
124 return image_; 120 return image_;
125 } 121 }
126 122
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 apps_grid_view_->SetSelectedItem(this); 304 apps_grid_view_->SetSelectedItem(this);
309 title_->SetEnabledColor(kTitleHoverColor); 305 title_->SetEnabledColor(kTitleHoverColor);
310 } else { 306 } else {
311 apps_grid_view_->ClearSelectedItem(this); 307 apps_grid_view_->ClearSelectedItem(this);
312 model_->SetHighlighted(false); 308 model_->SetHighlighted(false);
313 title_->SetEnabledColor(kTitleColor); 309 title_->SetEnabledColor(kTitleColor);
314 } 310 }
315 } 311 }
316 312
317 } // namespace app_list 313 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698