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

Side by Side Diff: ui/app_list/views/cached_label.h

Issue 12771021: Make painting app list items more efficient by caching the labels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: respond to comments Created 7 years, 9 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/views/app_list_item_view.cc ('k') | ui/app_list/views/cached_label.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_APP_LIST_VIEWS_CACHED_LABEL_H_
6 #define UI_APP_LIST_VIEWS_CACHED_LABEL_H_
7
8 #include "ui/gfx/image/image_skia.h"
9 #include "ui/views/controls/label.h"
10 #include "ui/views/view.h"
11
12 namespace gfx {
13 class Canvas;
14 }
15
16 namespace app_list {
17
18 // Subclass of views::Label that caches the rendered text in an ImageSkia.
19 class CachedLabel : public views::Label {
20 public:
21 CachedLabel();
22
23 // Have the next call to OnPaint() update the backing image.
24 void Invalidate() { needs_repaint_ = true; }
25
26 #if defined(OS_WIN)
27 // views::View overrides.
28 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
29 #endif
30
31 private:
32 // Calls the base label's OnPaint() to paint into a backing image.
33 void PaintToBackingImage();
34
35 bool needs_repaint_;
36 gfx::ImageSkia image_;
37 };
38
39 } // namespace app_list
40
41 #endif // UI_APP_LIST_VIEWS_CACHED_LABEL_H_
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_item_view.cc ('k') | ui/app_list/views/cached_label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698