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/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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 | 94 |
95 static void Run(scoped_refptr<IconOperation> op) { | 95 static void Run(scoped_refptr<IconOperation> op) { |
96 op->ResizeAndGenerateShadow(); | 96 op->ResizeAndGenerateShadow(); |
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( | 103 gfx::ImageSkia resized(gfx::ImageSkiaOperations::CreateResizedImage(image_, |
104 gfx::ImageSkiaOperations::CreateResizedImage(image_, 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 | 107 |
108 // The following statement causes shadowed image being generated for all | 108 // The following statement causes shadowed image being generated for all |
109 // existing image reps in |image_|. This is needed so that expensive shadow | 109 // existing image reps in |image_|. This is needed so that expensive shadow |
110 // generation does not run on UI thread. | 110 // generation does not run on UI thread. |
111 gfx::ImageSkia::ImageSkiaReps image_reps = image_.image_reps(); | 111 gfx::ImageSkia::ImageSkiaReps image_reps = image_.image_reps(); |
112 for (gfx::ImageSkia::ImageSkiaReps::const_iterator it = image_reps.begin(); | 112 for (gfx::ImageSkia::ImageSkiaReps::const_iterator it = image_reps.begin(); |
113 it != image_reps.end(); ++it) { | 113 it != image_reps.end(); ++it) { |
114 shadow.GetRepresentation(it->scale_factor()); | 114 shadow.GetRepresentation(it->scale_factor()); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 apps_grid_view_->SetSelectedItem(this); | 308 apps_grid_view_->SetSelectedItem(this); |
309 title_->SetEnabledColor(kTitleHoverColor); | 309 title_->SetEnabledColor(kTitleHoverColor); |
310 } else { | 310 } else { |
311 apps_grid_view_->ClearSelectedItem(this); | 311 apps_grid_view_->ClearSelectedItem(this); |
312 model_->SetHighlighted(false); | 312 model_->SetHighlighted(false); |
313 title_->SetEnabledColor(kTitleColor); | 313 title_->SetEnabledColor(kTitleColor); |
314 } | 314 } |
315 } | 315 } |
316 | 316 |
317 } // namespace app_list | 317 } // namespace app_list |
OLD | NEW |