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

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

Issue 8363036: ui/gfx: Change Canvas::ScaleInt() to just Canvas::Scale(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address Peter's review Created 9 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
« no previous file with comments | « ui/gfx/canvas_skia.cc ('k') | views/view.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/controls/menu/menu_image_util.h" 5 #include "views/controls/menu/menu_image_util.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "grit/ui_resources.h" 8 #include "grit/ui_resources.h"
9 #include "third_party/skia/include/effects/SkGradientShader.h" 9 #include "third_party/skia/include/effects/SkGradientShader.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 return new SkBitmap(canvas.ExtractBitmap()); 83 return new SkBitmap(canvas.ExtractBitmap());
84 } 84 }
85 85
86 SkBitmap* GetRtlSubmenuArrowImage() { 86 SkBitmap* GetRtlSubmenuArrowImage() {
87 static SkBitmap* kRtlArrow = NULL; 87 static SkBitmap* kRtlArrow = NULL;
88 if (!kRtlArrow) { 88 if (!kRtlArrow) {
89 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 89 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
90 SkBitmap* r = rb.GetBitmapNamed(IDR_MENU_ARROW); 90 SkBitmap* r = rb.GetBitmapNamed(IDR_MENU_ARROW);
91 gfx::CanvasSkia canvas(r->width(), r->height(), false); 91 gfx::CanvasSkia canvas(r->width(), r->height(), false);
92 canvas.ScaleInt(-1, 1); 92 canvas.Scale(-1, 1);
93 canvas.DrawBitmapInt(*r, - r->width(), 0); 93 canvas.DrawBitmapInt(*r, - r->width(), 0);
94 kRtlArrow = new SkBitmap(canvas.ExtractBitmap()); 94 kRtlArrow = new SkBitmap(canvas.ExtractBitmap());
95 } 95 }
96 return kRtlArrow; 96 return kRtlArrow;
97 } 97 }
98 98
99 } // namespace 99 } // namespace
100 100
101 namespace views { 101 namespace views {
102 102
103 const SkBitmap* GetRadioButtonImage(bool selected) { 103 const SkBitmap* GetRadioButtonImage(bool selected) {
104 static const SkBitmap* kRadioOn = CreateRadioButtonImage(true); 104 static const SkBitmap* kRadioOn = CreateRadioButtonImage(true);
105 static const SkBitmap* kRadioOff = CreateRadioButtonImage(false); 105 static const SkBitmap* kRadioOff = CreateRadioButtonImage(false);
106 106
107 return selected ? kRadioOn : kRadioOff; 107 return selected ? kRadioOn : kRadioOff;
108 } 108 }
109 109
110 const SkBitmap* GetSubmenuArrowImage() { 110 const SkBitmap* GetSubmenuArrowImage() {
111 return base::i18n::IsRTL() ? 111 return base::i18n::IsRTL() ?
112 GetRtlSubmenuArrowImage() : 112 GetRtlSubmenuArrowImage() :
113 ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_MENU_ARROW); 113 ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_MENU_ARROW);
114 } 114 }
115 115
116 } // namespace views; 116 } // namespace views;
OLDNEW
« no previous file with comments | « ui/gfx/canvas_skia.cc ('k') | views/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698