| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "ui/native_theme/native_theme_aurawin.h" | 5 #include "ui/native_theme/native_theme_aurawin.h" |
| 6 | 6 |
| 7 #include "grit/ui_resources.h" | 7 #include "grit/ui_resources.h" |
| 8 #include "third_party/skia/include/core/SkCanvas.h" | 8 #include "third_party/skia/include/core/SkCanvas.h" |
| 9 #include "ui/base/nine_image_painter_factory.h" | 9 #include "ui/base/nine_image_painter_factory.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 gfx::Rect thumb_rect(rect); | 149 gfx::Rect thumb_rect(rect); |
| 150 if (part == NativeTheme::kScrollbarVerticalThumb) | 150 if (part == NativeTheme::kScrollbarVerticalThumb) |
| 151 thumb_rect.Inset(3, 0, 1, 0); | 151 thumb_rect.Inset(3, 0, 1, 0); |
| 152 else | 152 else |
| 153 thumb_rect.Inset(0, 3, 0, 1); | 153 thumb_rect.Inset(0, 3, 0, 1); |
| 154 PaintPainter(GetOrCreatePainter( | 154 PaintPainter(GetOrCreatePainter( |
| 155 kScrollbarThumbImages, state, scrollbar_thumb_painters_), | 155 kScrollbarThumbImages, state, scrollbar_thumb_painters_), |
| 156 sk_canvas, thumb_rect); | 156 sk_canvas, thumb_rect); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void NativeThemeAuraWin::PaintScrollbarCorner(SkCanvas* canvas, |
| 160 State state, |
| 161 const gfx::Rect& rect) const { |
| 162 canvas->drawColor(SkColorSetRGB(0xF1, 0xF1, 0xF1), SkXfermode::kSrc_Mode); |
| 163 } |
| 164 |
| 159 NineImagePainter* NativeThemeAuraWin::GetOrCreatePainter( | 165 NineImagePainter* NativeThemeAuraWin::GetOrCreatePainter( |
| 160 const int images[kMaxState][9], | 166 const int images[kMaxState][9], |
| 161 State state, | 167 State state, |
| 162 scoped_ptr<NineImagePainter> painters[kMaxState]) const { | 168 scoped_ptr<NineImagePainter> painters[kMaxState]) const { |
| 163 if (painters[state]) | 169 if (painters[state]) |
| 164 return painters[state].get(); | 170 return painters[state].get(); |
| 165 if (images[state][0] == 0) { | 171 if (images[state][0] == 0) { |
| 166 // Must always provide normal state images. | 172 // Must always provide normal state images. |
| 167 DCHECK_NE(kNormal, state); | 173 DCHECK_NE(kNormal, state); |
| 168 return GetOrCreatePainter(images, kNormal, painters); | 174 return GetOrCreatePainter(images, kNormal, painters); |
| 169 } | 175 } |
| 170 painters[state] = CreateNineImagePainter(images[state]); | 176 painters[state] = CreateNineImagePainter(images[state]); |
| 171 return painters[state].get(); | 177 return painters[state].get(); |
| 172 } | 178 } |
| 173 | 179 |
| 174 void NativeThemeAuraWin::PaintPainter(NineImagePainter* painter, | 180 void NativeThemeAuraWin::PaintPainter(NineImagePainter* painter, |
| 175 SkCanvas* sk_canvas, | 181 SkCanvas* sk_canvas, |
| 176 const gfx::Rect& rect) const { | 182 const gfx::Rect& rect) const { |
| 177 DCHECK(painter); | 183 DCHECK(painter); |
| 178 scoped_ptr<gfx::Canvas> canvas(CreateCanvas(sk_canvas)); | 184 scoped_ptr<gfx::Canvas> canvas(CreateCanvas(sk_canvas)); |
| 179 painter->Paint(canvas.get(), rect); | 185 painter->Paint(canvas.get(), rect); |
| 180 } | 186 } |
| 181 | 187 |
| 182 } // namespace ui | 188 } // namespace ui |
| OLD | NEW |