Chromium Code Reviews| 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 #include "ui/native_theme/common_theme.h" | 5 #include "ui/native_theme/common_theme.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "third_party/skia/include/core/SkCanvas.h" | 8 #include "third_party/skia/include/core/SkCanvas.h" |
| 9 #include "ui/base/material_design/material_design_controller.h" | 9 #include "ui/base/material_design/material_design_controller.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 return kThrobberLightColor; | 398 return kThrobberLightColor; |
| 399 | 399 |
| 400 case NativeTheme::kColorId_NumColors: | 400 case NativeTheme::kColorId_NumColors: |
| 401 break; | 401 break; |
| 402 } | 402 } |
| 403 | 403 |
| 404 NOTREACHED(); | 404 NOTREACHED(); |
| 405 return gfx::kPlaceholderColor; | 405 return gfx::kPlaceholderColor; |
| 406 } | 406 } |
| 407 | 407 |
| 408 gfx::Size CommonThemeGetPartSize(NativeTheme::Part part, | |
|
tapted
2016/04/05 08:45:01
remove the declaration in common_theme.h
Elly Fong-Jones
2016/04/05 20:04:24
Done.
| |
| 409 NativeTheme::State state, | |
| 410 const NativeTheme::ExtraParams& extra) { | |
| 411 gfx::Size size; | |
| 412 switch (part) { | |
| 413 case NativeTheme::kComboboxArrow: | |
| 414 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( | |
| 415 IDR_MENU_DROPARROW).Size(); | |
| 416 | |
| 417 default: | |
| 418 break; | |
| 419 } | |
| 420 | |
| 421 return size; | |
| 422 } | |
| 423 | |
| 424 void CommonThemePaintComboboxArrow(SkCanvas* canvas, const gfx::Rect& rect) { | 408 void CommonThemePaintComboboxArrow(SkCanvas* canvas, const gfx::Rect& rect) { |
|
tapted
2016/04/05 08:45:02
Can this method (and the declaration) be removed?
Elly Fong-Jones
2016/04/05 20:04:24
Done.
| |
| 425 gfx::ImageSkia* arrow = ui::ResourceBundle::GetSharedInstance(). | 409 gfx::ImageSkia* arrow = ui::ResourceBundle::GetSharedInstance(). |
| 426 GetImageSkiaNamed(IDR_MENU_DROPARROW); | 410 GetImageSkiaNamed(IDR_MENU_DROPARROW); |
| 427 CommonThemeCreateCanvas(canvas)->DrawImageInt(*arrow, rect.x(), rect.y()); | 411 CommonThemeCreateCanvas(canvas)->DrawImageInt(*arrow, rect.x(), rect.y()); |
| 428 } | 412 } |
| 429 | 413 |
| 430 void CommonThemePaintMenuItemBackground( | 414 void CommonThemePaintMenuItemBackground( |
| 431 const NativeTheme* theme, | 415 const NativeTheme* theme, |
| 432 SkCanvas* canvas, | 416 SkCanvas* canvas, |
| 433 NativeTheme::State state, | 417 NativeTheme::State state, |
| 434 const gfx::Rect& rect, | 418 const gfx::Rect& rect, |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 460 scoped_ptr<gfx::Canvas> CommonThemeCreateCanvas(SkCanvas* sk_canvas) { | 444 scoped_ptr<gfx::Canvas> CommonThemeCreateCanvas(SkCanvas* sk_canvas) { |
| 461 // TODO(pkotwicz): Do something better and don't infer device | 445 // TODO(pkotwicz): Do something better and don't infer device |
| 462 // scale factor from canvas scale. | 446 // scale factor from canvas scale. |
| 463 SkMatrix m = sk_canvas->getTotalMatrix(); | 447 SkMatrix m = sk_canvas->getTotalMatrix(); |
| 464 float device_scale = static_cast<float>(SkScalarAbs(m.getScaleX())); | 448 float device_scale = static_cast<float>(SkScalarAbs(m.getScaleX())); |
| 465 return make_scoped_ptr(new gfx::Canvas(skia::SharePtr(sk_canvas), | 449 return make_scoped_ptr(new gfx::Canvas(skia::SharePtr(sk_canvas), |
| 466 device_scale)); | 450 device_scale)); |
| 467 } | 451 } |
| 468 | 452 |
| 469 } // namespace ui | 453 } // namespace ui |
| OLD | NEW |