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

Side by Side Diff: ui/views/controls/menu/menu_image_util.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup Created 8 years, 1 month 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
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/views/controls/menu/menu_image_util.h" 5 #include "ui/views/controls/menu/menu_image_util.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "grit/ui_resources.h" 9 #include "grit/ui_resources.h"
10 #include "third_party/skia/include/effects/SkGradientShader.h" 10 #include "third_party/skia/include/effects/SkGradientShader.h"
(...skipping 25 matching lines...) Expand all
36 class RadioButtonImageSource : public gfx::CanvasImageSource { 36 class RadioButtonImageSource : public gfx::CanvasImageSource {
37 public: 37 public:
38 explicit RadioButtonImageSource(bool selected) 38 explicit RadioButtonImageSource(bool selected)
39 : CanvasImageSource(gfx::Size(kIndicatorSize + 2, kIndicatorSize + 2), 39 : CanvasImageSource(gfx::Size(kIndicatorSize + 2, kIndicatorSize + 2),
40 false), 40 false),
41 selected_(selected) { 41 selected_(selected) {
42 } 42 }
43 virtual ~RadioButtonImageSource() {} 43 virtual ~RadioButtonImageSource() {}
44 44
45 virtual void Draw(gfx::Canvas* canvas) OVERRIDE { 45 virtual void Draw(gfx::Canvas* canvas) OVERRIDE {
46 canvas->Translate(gfx::Point(1, 1)); 46 canvas->Translate(gfx::Vector2d(1, 1));
47 47
48 SkPoint gradient_points[3]; 48 SkPoint gradient_points[3];
49 gradient_points[0].iset(0, 0); 49 gradient_points[0].iset(0, 0);
50 gradient_points[1].iset(0, 50 gradient_points[1].iset(0,
51 static_cast<int>(kIndicatorSize * kGradientStop)); 51 static_cast<int>(kIndicatorSize * kGradientStop));
52 gradient_points[2].iset(0, kIndicatorSize); 52 gradient_points[2].iset(0, kIndicatorSize);
53 SkColor gradient_colors[3] = { kGradient0, kGradient1, kGradient2 }; 53 SkColor gradient_colors[3] = { kGradient0, kGradient1, kGradient2 };
54 SkShader* shader = SkGradientShader::CreateLinear( 54 SkShader* shader = SkGradientShader::CreateLinear(
55 gradient_points, gradient_colors, NULL, arraysize(gradient_points), 55 gradient_points, gradient_colors, NULL, arraysize(gradient_points),
56 SkShader::kClamp_TileMode, NULL); 56 SkShader::kClamp_TileMode, NULL);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 return selected ? kRadioOn : kRadioOff; 145 return selected ? kRadioOn : kRadioOff;
146 } 146 }
147 147
148 const gfx::ImageSkia* GetSubmenuArrowImage() { 148 const gfx::ImageSkia* GetSubmenuArrowImage() {
149 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 149 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
150 return base::i18n::IsRTL() ? GetRtlSubmenuArrowImage() 150 return base::i18n::IsRTL() ? GetRtlSubmenuArrowImage()
151 : rb.GetImageNamed(IDR_MENU_ARROW).ToImageSkia(); 151 : rb.GetImageNamed(IDR_MENU_ARROW).ToImageSkia();
152 } 152 }
153 153
154 } // namespace views 154 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698