Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / app_list / views / cached_label.h
blob15d5917e85ae27b3fd1fee4048c0468b06006d82
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.
5 #ifndef UI_APP_LIST_VIEWS_CACHED_LABEL_H_
6 #define UI_APP_LIST_VIEWS_CACHED_LABEL_H_
8 #include "ui/gfx/image/image_skia.h"
9 #include "ui/views/controls/label.h"
10 #include "ui/views/view.h"
12 namespace gfx {
13 class Canvas;
16 namespace app_list {
18 // Subclass of views::Label that caches the rendered text in an ImageSkia.
19 class CachedLabel : public views::Label {
20 public:
21 CachedLabel();
23 // Have the next call to OnPaint() update the backing image.
24 void Invalidate() { needs_repaint_ = true; }
26 // Calls the base label's OnPaint() to paint into a backing image.
27 void PaintToBackingImage();
29 #if defined(OS_WIN)
30 // Overridden from views::View:
31 void OnPaint(gfx::Canvas* canvas) override;
32 #endif
34 // Overridden from ui::LayerDelegate:
35 void OnDeviceScaleFactorChanged(float device_scale_factor) override;
37 private:
38 bool needs_repaint_;
39 gfx::ImageSkia image_;
42 } // namespace app_list
44 #endif // UI_APP_LIST_VIEWS_CACHED_LABEL_H_