Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: ui/native_theme/common_theme.cc

Issue 1863503002: test hypothesis (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: zappity Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/native_theme/common_theme.h ('k') | ui/native_theme/native_theme.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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,
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) {
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,
(...skipping 26 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « ui/native_theme/common_theme.h ('k') | ui/native_theme/native_theme.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698