| 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 "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "ui/native_theme/fallback_theme.h" | 10 #include "ui/native_theme/fallback_theme.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 State startState, | 56 State startState, |
| 57 State endState, | 57 State endState, |
| 58 double progress, | 58 double progress, |
| 59 const gfx::Rect& rect) const | 59 const gfx::Rect& rect) const |
| 60 OVERRIDE; | 60 OVERRIDE; |
| 61 | 61 |
| 62 // Returns the NineImagePainter used to paint the specified state, creating if | 62 // Returns the NineImagePainter used to paint the specified state, creating if |
| 63 // necessary. If no image is provided for the specified state the normal state | 63 // necessary. If no image is provided for the specified state the normal state |
| 64 // images are used. | 64 // images are used. |
| 65 gfx::NineImagePainter* GetOrCreatePainter( | 65 gfx::NineImagePainter* GetOrCreatePainter( |
| 66 const int image_ids[kMaxState][9], | 66 const int image_ids[kNumStates][9], |
| 67 State state, | 67 State state, |
| 68 scoped_ptr<gfx::NineImagePainter> painters[kMaxState]) const; | 68 scoped_ptr<gfx::NineImagePainter> painters[kNumStates]) const; |
| 69 | 69 |
| 70 // Paints |painter| into the canvas using |rect|. | 70 // Paints |painter| into the canvas using |rect|. |
| 71 void PaintPainter(gfx::NineImagePainter* painter, | 71 void PaintPainter(gfx::NineImagePainter* painter, |
| 72 SkCanvas* sk_canvas, | 72 SkCanvas* sk_canvas, |
| 73 const gfx::Rect& rect) const; | 73 const gfx::Rect& rect) const; |
| 74 | 74 |
| 75 mutable scoped_ptr<gfx::NineImagePainter> scrollbar_track_painter_; | 75 mutable scoped_ptr<gfx::NineImagePainter> scrollbar_track_painter_; |
| 76 | 76 |
| 77 mutable scoped_ptr<gfx::NineImagePainter> | 77 mutable scoped_ptr<gfx::NineImagePainter> |
| 78 scrollbar_thumb_painters_[kMaxState]; | 78 scrollbar_thumb_painters_[kNumStates]; |
| 79 | 79 |
| 80 mutable scoped_ptr<gfx::NineImagePainter> | 80 mutable scoped_ptr<gfx::NineImagePainter> |
| 81 scrollbar_arrow_button_painters_[kMaxState]; | 81 scrollbar_arrow_button_painters_[kNumStates]; |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 struct DualPainter { | 84 struct DualPainter { |
| 85 // For overlay scrollbar thumbs, fill and stroke are controlled separately, | 85 // For overlay scrollbar thumbs, fill and stroke are controlled separately, |
| 86 // and each state is achieved by painting with different opacity. This | 86 // and each state is achieved by painting with different opacity. This |
| 87 // struct bundles information of painter generated using assets and alpha | 87 // struct bundles information of painter generated using assets and alpha |
| 88 // value associated with each state, so that a DualPainter for overlay | 88 // value associated with each state, so that a DualPainter for overlay |
| 89 // scrollbar thumb would only need state as input to paint correctly. | 89 // scrollbar thumb would only need state as input to paint correctly. |
| 90 DualPainter(scoped_ptr<gfx::NineImagePainter> fill_painter, | 90 DualPainter(scoped_ptr<gfx::NineImagePainter> fill_painter, |
| 91 const uint8 fill_alphas[kMaxState], | 91 const uint8 fill_alphas[kNumStates], |
| 92 scoped_ptr<gfx::NineImagePainter> stroke_painter, | 92 scoped_ptr<gfx::NineImagePainter> stroke_painter, |
| 93 const uint8 stroke_alphas[kMaxState]); | 93 const uint8 stroke_alphas[kNumStates]); |
| 94 ~DualPainter(); | 94 ~DualPainter(); |
| 95 | 95 |
| 96 scoped_ptr<gfx::NineImagePainter> fill_painter; | 96 scoped_ptr<gfx::NineImagePainter> fill_painter; |
| 97 const uint8* const fill_alphas; | 97 const uint8* const fill_alphas; |
| 98 scoped_ptr<gfx::NineImagePainter> stroke_painter; | 98 scoped_ptr<gfx::NineImagePainter> stroke_painter; |
| 99 const uint8* const stroke_alphas; | 99 const uint8* const stroke_alphas; |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 // Returns DualPainter from specific fill and stroke, creating if necessary. | 102 // Returns DualPainter from specific fill and stroke, creating if necessary. |
| 103 scoped_ptr<DualPainter> CreateDualPainter( | 103 scoped_ptr<DualPainter> CreateDualPainter( |
| 104 const int fill_image_ids[9], | 104 const int fill_image_ids[9], |
| 105 const uint8 fill_alphas[kMaxState], | 105 const uint8 fill_alphas[kNumStates], |
| 106 const int stroke_image_ids[9], | 106 const int stroke_image_ids[9], |
| 107 const uint8 stroke_alphas[kMaxState]) const; | 107 const uint8 stroke_alphas[kNumStates]) const; |
| 108 | 108 |
| 109 // Paints |dualPainter| into the canvas using |rect| and specific alpha. | 109 // Paints |dualPainter| into the canvas using |rect| and specific alpha. |
| 110 void PaintDualPainter(DualPainter* dual_painter, | 110 void PaintDualPainter(DualPainter* dual_painter, |
| 111 SkCanvas* sk_canvas, | 111 SkCanvas* sk_canvas, |
| 112 const gfx::Rect& rect, | 112 const gfx::Rect& rect, |
| 113 State state) const; | 113 State state) const; |
| 114 | 114 |
| 115 void PaintDualPainterTransition(DualPainter* dual_painter, | 115 void PaintDualPainterTransition(DualPainter* dual_painter, |
| 116 SkCanvas* sk_canvas, | 116 SkCanvas* sk_canvas, |
| 117 const gfx::Rect& rect, | 117 const gfx::Rect& rect, |
| 118 State startState, | 118 State startState, |
| 119 State endState, | 119 State endState, |
| 120 double progress) const; | 120 double progress) const; |
| 121 | 121 |
| 122 mutable scoped_ptr<DualPainter> scrollbar_overlay_thumb_painter_; | 122 mutable scoped_ptr<DualPainter> scrollbar_overlay_thumb_painter_; |
| 123 | 123 |
| 124 DISALLOW_COPY_AND_ASSIGN(NativeThemeAura); | 124 DISALLOW_COPY_AND_ASSIGN(NativeThemeAura); |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 } // namespace ui | 127 } // namespace ui |
| 128 | 128 |
| 129 #endif // UI_NATIVE_THEME_NATIVE_THEME_AURA_H_ | 129 #endif // UI_NATIVE_THEME_NATIVE_THEME_AURA_H_ |
| OLD | NEW |