 Chromium Code Reviews
 Chromium Code Reviews Issue 12771021:
  Make painting app list items more efficient by caching the labels.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 12771021:
  Make painting app list items more efficient by caching the labels.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: ui/app_list/views/app_list_item_view.cc | 
| diff --git a/ui/app_list/views/app_list_item_view.cc b/ui/app_list/views/app_list_item_view.cc | 
| index dcf023a2f3dcd7021afd92f47cae30f6dee3b2f7..640aa57f6cd1d8d98eee4f6814be1e47f1c04bbb 100644 | 
| --- a/ui/app_list/views/app_list_item_view.cc | 
| +++ b/ui/app_list/views/app_list_item_view.cc | 
| @@ -10,6 +10,7 @@ | 
| #include "grit/ui_resources.h" | 
| #include "ui/app_list/app_list_item_model.h" | 
| #include "ui/app_list/views/apps_grid_view.h" | 
| +#include "ui/app_list/views/cached_label.h" | 
| #include "ui/base/accessibility/accessible_view_state.h" | 
| #include "ui/base/animation/throb_animation.h" | 
| #include "ui/base/resource/resource_bundle.h" | 
| @@ -65,7 +66,7 @@ AppListItemView::AppListItemView(AppsGridView* apps_grid_view, | 
| model_(model), | 
| apps_grid_view_(apps_grid_view), | 
| icon_(new views::ImageView), | 
| - title_(new views::Label), | 
| + title_(new CachedLabel), | 
| ui_state_(UI_STATE_NORMAL), | 
| touch_dragging_(false) { | 
| icon_->set_interactive(false); | 
| @@ -77,6 +78,7 @@ AppListItemView::AppListItemView(AppsGridView* apps_grid_view, | 
| title_->SetFont(rb.GetFont(ui::ResourceBundle::SmallBoldFont)); | 
| title_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 
| title_->SetVisible(!model_->is_installing()); | 
| + title_->Invalidate(); | 
| 
benwells
2013/03/12 04:58:11
nit: is this needed? CachedLabel initializes needs
 
koz (OOO until 15th September)
2013/03/13 00:30:36
Not needed, but needs_repaint_ could just as easil
 | 
| const gfx::ShadowValue kIconShadows[] = { | 
| gfx::ShadowValue(gfx::Point(0, 2), 2, SkColorSetARGB(0x24, 0, 0, 0)), | 
| @@ -176,6 +178,7 @@ void AppListItemView::ItemIconChanged() { | 
| void AppListItemView::ItemTitleChanged() { | 
| title_->SetText(UTF8ToUTF16(model_->title())); | 
| + title_->Invalidate(); | 
| } | 
| void AppListItemView::ItemHighlightedChanged() { | 
| @@ -296,6 +299,7 @@ void AppListItemView::StateChanged() { | 
| model_->SetHighlighted(false); | 
| title_->SetEnabledColor(kTitleColor); | 
| } | 
| + title_->Invalidate(); | 
| } | 
| bool AppListItemView::ShouldEnterPushedState(const ui::Event& event) { |