OLD | NEW |
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 #ifndef UI_NATIVE_THEME_NATIVE_THEME_AURA_H_ | 5 #ifndef UI_NATIVE_THEME_NATIVE_THEME_AURA_H_ |
6 #define UI_NATIVE_THEME_NATIVE_THEME_AURA_H_ | 6 #define UI_NATIVE_THEME_NATIVE_THEME_AURA_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include <stdint.h> |
| 9 |
9 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" |
10 #include "ui/native_theme/native_theme_base.h" | 12 #include "ui/native_theme/native_theme_base.h" |
11 | 13 |
12 namespace gfx { | 14 namespace gfx { |
13 class NineImagePainter; | 15 class NineImagePainter; |
14 } | 16 } |
15 | 17 |
16 namespace ui { | 18 namespace ui { |
17 | 19 |
18 // Aura implementation of native theme support. | 20 // Aura implementation of native theme support. |
19 class NATIVE_THEME_EXPORT NativeThemeAura : public NativeThemeBase { | 21 class NATIVE_THEME_EXPORT NativeThemeAura : public NativeThemeBase { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 scrollbar_arrow_button_painters_[kNumStates]; | 82 scrollbar_arrow_button_painters_[kNumStates]; |
81 | 83 |
82 private: | 84 private: |
83 struct DualPainter { | 85 struct DualPainter { |
84 // For overlay scrollbar thumbs, fill and stroke are controlled separately, | 86 // For overlay scrollbar thumbs, fill and stroke are controlled separately, |
85 // and each state is achieved by painting with different opacity. This | 87 // and each state is achieved by painting with different opacity. This |
86 // struct bundles information of painter generated using assets and alpha | 88 // struct bundles information of painter generated using assets and alpha |
87 // value associated with each state, so that a DualPainter for overlay | 89 // value associated with each state, so that a DualPainter for overlay |
88 // scrollbar thumb would only need state as input to paint correctly. | 90 // scrollbar thumb would only need state as input to paint correctly. |
89 DualPainter(scoped_ptr<gfx::NineImagePainter> fill_painter, | 91 DualPainter(scoped_ptr<gfx::NineImagePainter> fill_painter, |
90 const uint8 fill_alphas[kNumStates], | 92 const uint8_t fill_alphas[kNumStates], |
91 scoped_ptr<gfx::NineImagePainter> stroke_painter, | 93 scoped_ptr<gfx::NineImagePainter> stroke_painter, |
92 const uint8 stroke_alphas[kNumStates]); | 94 const uint8_t stroke_alphas[kNumStates]); |
93 ~DualPainter(); | 95 ~DualPainter(); |
94 | 96 |
95 scoped_ptr<gfx::NineImagePainter> fill_painter; | 97 scoped_ptr<gfx::NineImagePainter> fill_painter; |
96 const uint8* const fill_alphas; | 98 const uint8_t* const fill_alphas; |
97 scoped_ptr<gfx::NineImagePainter> stroke_painter; | 99 scoped_ptr<gfx::NineImagePainter> stroke_painter; |
98 const uint8* const stroke_alphas; | 100 const uint8_t* const stroke_alphas; |
99 }; | 101 }; |
100 | 102 |
101 // Returns DualPainter from specific fill and stroke, creating if necessary. | 103 // Returns DualPainter from specific fill and stroke, creating if necessary. |
102 scoped_ptr<DualPainter> CreateDualPainter( | 104 scoped_ptr<DualPainter> CreateDualPainter( |
103 const int fill_image_ids[9], | 105 const int fill_image_ids[9], |
104 const uint8 fill_alphas[kNumStates], | 106 const uint8_t fill_alphas[kNumStates], |
105 const int stroke_image_ids[9], | 107 const int stroke_image_ids[9], |
106 const uint8 stroke_alphas[kNumStates]) const; | 108 const uint8_t stroke_alphas[kNumStates]) const; |
107 | 109 |
108 // Paints |dualPainter| into the canvas using |rect| and specific alpha. | 110 // Paints |dualPainter| into the canvas using |rect| and specific alpha. |
109 void PaintDualPainter(DualPainter* dual_painter, | 111 void PaintDualPainter(DualPainter* dual_painter, |
110 SkCanvas* sk_canvas, | 112 SkCanvas* sk_canvas, |
111 const gfx::Rect& rect, | 113 const gfx::Rect& rect, |
112 State state) const; | 114 State state) const; |
113 | 115 |
114 void PaintDualPainterTransition(DualPainter* dual_painter, | 116 void PaintDualPainterTransition(DualPainter* dual_painter, |
115 SkCanvas* sk_canvas, | 117 SkCanvas* sk_canvas, |
116 const gfx::Rect& rect, | 118 const gfx::Rect& rect, |
117 State startState, | 119 State startState, |
118 State endState, | 120 State endState, |
119 double progress) const; | 121 double progress) const; |
120 | 122 |
121 mutable scoped_ptr<DualPainter> scrollbar_overlay_thumb_painter_; | 123 mutable scoped_ptr<DualPainter> scrollbar_overlay_thumb_painter_; |
122 | 124 |
123 DISALLOW_COPY_AND_ASSIGN(NativeThemeAura); | 125 DISALLOW_COPY_AND_ASSIGN(NativeThemeAura); |
124 }; | 126 }; |
125 | 127 |
126 } // namespace ui | 128 } // namespace ui |
127 | 129 |
128 #endif // UI_NATIVE_THEME_NATIVE_THEME_AURA_H_ | 130 #endif // UI_NATIVE_THEME_NATIVE_THEME_AURA_H_ |
OLD | NEW |