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

Side by Side Diff: ui/gfx/native_theme_chromeos.cc

Issue 9565021: ui/gfx: Drop unused args from PaintMenuBackgroundColor() and pass gfx::Size instead of gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/native_theme_chromeos.h ('k') | no next file » | 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/gfx/native_theme_chromeos.h" 5 #include "ui/gfx/native_theme_chromeos.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "grit/gfx_resources.h" 9 #include "grit/gfx_resources.h"
10 #include "third_party/skia/include/core/SkPaint.h" 10 #include "third_party/skia/include/core/SkPaint.h"
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 const InnerSpinButtonExtraParams& spin_button) const { 654 const InnerSpinButtonExtraParams& spin_button) const {
655 // Adjust bounds to compensate the overridden "2px inset" parent border. 655 // Adjust bounds to compensate the overridden "2px inset" parent border.
656 gfx::Rect bounds = rect; 656 gfx::Rect bounds = rect;
657 bounds.Inset(0, -1, -1, -1); 657 bounds.Inset(0, -1, -1, -1);
658 658
659 NativeThemeBase::PaintInnerSpinButton(canvas, state, bounds, spin_button); 659 NativeThemeBase::PaintInnerSpinButton(canvas, state, bounds, spin_button);
660 } 660 }
661 661
662 void NativeThemeChromeos::PaintMenuPopupBackground( 662 void NativeThemeChromeos::PaintMenuPopupBackground(
663 SkCanvas* canvas, 663 SkCanvas* canvas,
664 State state, 664 const gfx::Size& size) const {
665 const gfx::Rect& rect,
666 const MenuListExtraParams& menu_list) const {
667 static const SkColor kGradientColors[2] = { 665 static const SkColor kGradientColors[2] = {
668 SK_ColorWHITE, 666 SK_ColorWHITE,
669 SkColorSetRGB(0xF0, 0xF0, 0xF0) 667 SkColorSetRGB(0xF0, 0xF0, 0xF0)
670 }; 668 };
671 669
672 static const SkScalar kGradientPoints[2] = { 670 static const SkScalar kGradientPoints[2] = {
673 SkIntToScalar(0), 671 SkIntToScalar(0),
674 SkIntToScalar(1) 672 SkIntToScalar(1)
675 }; 673 };
676 674
677 SkPoint points[2]; 675 SkPoint points[2];
678 points[0].iset(0, 0); 676 points[0].iset(0, 0);
679 points[1].iset(0, rect.height()); 677 points[1].iset(0, size.height());
680 678
681 SkShader* shader = SkGradientShader::CreateLinear(points, 679 SkShader* shader = SkGradientShader::CreateLinear(points,
682 kGradientColors, kGradientPoints, arraysize(kGradientPoints), 680 kGradientColors, kGradientPoints, arraysize(kGradientPoints),
683 SkShader::kRepeat_TileMode); 681 SkShader::kRepeat_TileMode);
684 DCHECK(shader); 682 DCHECK(shader);
685 683
686 SkPaint paint; 684 SkPaint paint;
687 paint.setShader(shader); 685 paint.setShader(shader);
688 shader->unref(); 686 shader->unref();
689 687
690 paint.setStyle(SkPaint::kFill_Style); 688 paint.setStyle(SkPaint::kFill_Style);
691 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 689 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
692 690
693 canvas->drawRect(gfx::RectToSkRect(gfx::Rect(rect.size())), paint); 691 canvas->drawRect(gfx::RectToSkRect(gfx::Rect(size)), paint);
694 } 692 }
695 693
696 void NativeThemeChromeos::PaintProgressBar(SkCanvas* canvas, 694 void NativeThemeChromeos::PaintProgressBar(SkCanvas* canvas,
697 State state, 695 State state,
698 const gfx::Rect& rect, 696 const gfx::Rect& rect,
699 const ProgressBarExtraParams& progress_bar) const { 697 const ProgressBarExtraParams& progress_bar) const {
700 static const int kBorderWidth = 1; 698 static const int kBorderWidth = 1;
701 static const SkColor kBackgroundColors[] = { 699 static const SkColor kBackgroundColors[] = {
702 kProgressBarBackgroundGradient0, 700 kProgressBarBackgroundGradient0,
703 kProgressBarBackgroundGradient1, 701 kProgressBarBackgroundGradient1,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 829
832 if (stroke_border) { 830 if (stroke_border) {
833 SkPaint stroke_paint; 831 SkPaint stroke_paint;
834 GetStrokePaint(state, &stroke_paint); 832 GetStrokePaint(state, &stroke_paint);
835 canvas->drawPath(border, stroke_paint); 833 canvas->drawPath(border, stroke_paint);
836 } 834 }
837 } 835 }
838 836
839 } // namespace gfx 837 } // namespace gfx
840 838
OLDNEW
« no previous file with comments | « ui/gfx/native_theme_chromeos.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698