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

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

Issue 10824359: Remove ImageSkia::empty and ImageSkia::extractSubset (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « ui/app_list/app_list_item_view.cc ('k') | ui/base/resource/resource_bundle.cc » ('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/search_result_view.h" 5 #include "ui/app_list/search_result_view.h"
6 6
7 #include "ui/app_list/search_result.h" 7 #include "ui/app_list/search_result.h"
8 #include "ui/app_list/search_result_list_view.h" 8 #include "ui/app_list/search_result_list_view.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/gfx/font.h" 10 #include "ui/gfx/font.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 } 205 }
206 206
207 void SearchResultView::OnIconChanged() { 207 void SearchResultView::OnIconChanged() {
208 gfx::ImageSkia image(result_ ? result_->icon() : gfx::ImageSkia()); 208 gfx::ImageSkia image(result_ ? result_->icon() : gfx::ImageSkia());
209 // Note this might leave the view with an old icon. But it is needed to avoid 209 // Note this might leave the view with an old icon. But it is needed to avoid
210 // flash when a SearchResult's icon is loaded asynchronously. In this case, it 210 // flash when a SearchResult's icon is loaded asynchronously. In this case, it
211 // looks nicer to keep the stale icon for a little while on screen instead of 211 // looks nicer to keep the stale icon for a little while on screen instead of
212 // clearing it out. It should work correctly as long as the SearchResult does 212 // clearing it out. It should work correctly as long as the SearchResult does
213 // not forget to SetIcon when it's ready. 213 // not forget to SetIcon when it's ready.
214 if (image.empty()) 214 if (image.isNull())
215 return; 215 return;
216 216
217 // Scales down big icons but leave small ones unchanged. 217 // Scales down big icons but leave small ones unchanged.
218 if (image.width() > kIconDimension || image.height() > kIconDimension) 218 if (image.width() > kIconDimension || image.height() > kIconDimension)
219 icon_->SetImageSize(gfx::Size(kIconDimension, kIconDimension)); 219 icon_->SetImageSize(gfx::Size(kIconDimension, kIconDimension));
220 else 220 else
221 icon_->ResetImageSize(); 221 icon_->ResetImageSize();
222 222
223 icon_->SetImage(image); 223 icon_->SetImage(image);
224 } 224 }
225 225
226 } // namespace app_list 226 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/app_list_item_view.cc ('k') | ui/base/resource/resource_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698