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

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

Issue 2143893002: Purge the App Launcher code from Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 #ifndef UI_APP_LIST_VIEWS_CACHED_LABEL_H_ 5 #ifndef UI_APP_LIST_VIEWS_CACHED_LABEL_H_
6 #define UI_APP_LIST_VIEWS_CACHED_LABEL_H_ 6 #define UI_APP_LIST_VIEWS_CACHED_LABEL_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "ui/gfx/image/image_skia.h" 9 #include "ui/gfx/image/image_skia.h"
10 #include "ui/views/controls/label.h" 10 #include "ui/views/controls/label.h"
11 #include "ui/views/view.h" 11 #include "ui/views/view.h"
12 12
13 namespace gfx { 13 namespace gfx {
14 class Canvas; 14 class Canvas;
15 } 15 }
16 16
17 namespace app_list { 17 namespace app_list {
18 18
19 // Subclass of views::Label that caches the rendered text in an ImageSkia. 19 // Subclass of views::Label that caches the rendered text in an ImageSkia.
20 class CachedLabel : public views::Label { 20 class CachedLabel : public views::Label {
21 public: 21 public:
22 CachedLabel(); 22 CachedLabel();
23 23
24 // Have the next call to OnPaint() update the backing image. 24 // Have the next call to OnPaint() update the backing image.
25 void Invalidate() { needs_repaint_ = true; } 25 void Invalidate() { needs_repaint_ = true; }
26 26
27 // Calls the base label's OnPaint() to paint into a backing image. 27 // Calls the base label's OnPaint() to paint into a backing image.
28 void PaintToBackingImage(); 28 void PaintToBackingImage();
29 29
30 #if defined(OS_WIN)
31 // Overridden from views::View:
32 void OnPaint(gfx::Canvas* canvas) override;
33 #endif
34
35 // Overridden from ui::LayerDelegate: 30 // Overridden from ui::LayerDelegate:
36 void OnDeviceScaleFactorChanged(float device_scale_factor) override; 31 void OnDeviceScaleFactorChanged(float device_scale_factor) override;
37 32
38 private: 33 private:
39 bool needs_repaint_; 34 bool needs_repaint_;
40 gfx::ImageSkia image_; 35 gfx::ImageSkia image_;
41 }; 36 };
42 37
43 } // namespace app_list 38 } // namespace app_list
44 39
45 #endif // UI_APP_LIST_VIEWS_CACHED_LABEL_H_ 40 #endif // UI_APP_LIST_VIEWS_CACHED_LABEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698