summaryrefslogtreecommitdiffstats
path: root/ui/views
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-20 00:10:13 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-20 00:10:13 +0000
commitfc22f9ef9b459af24ca666e44350d0c8b27b312b (patch)
treeef042cfcc658dc359e2958cdd2d063cf2d4d814a /ui/views
parente24f876c537646cab5a9e8492658f570ccd7da4a (diff)
downloadchromium_src-fc22f9ef9b459af24ca666e44350d0c8b27b312b.zip
chromium_src-fc22f9ef9b459af24ca666e44350d0c8b27b312b.tar.gz
chromium_src-fc22f9ef9b459af24ca666e44350d0c8b27b312b.tar.bz2
Make CanvasSkia take a gfx::Size as the first parameter.
BUG=100898 R=pkasting@chromium.org TBR=ben@chromium.org,stevenjb@chromium.org Review URL: http://codereview.chromium.org/8990003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115046 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views')
-rw-r--r--ui/views/controls/glow_hover_controller.cc2
-rw-r--r--ui/views/controls/menu/menu_controller.cc3
-rw-r--r--ui/views/controls/menu/menu_image_util.cc6
-rw-r--r--ui/views/controls/menu/menu_win.cc3
-rw-r--r--ui/views/controls/menu/native_menu_win.cc5
-rw-r--r--ui/views/controls/table/native_table_win.cc7
-rw-r--r--ui/views/controls/table/table_view.cc9
-rw-r--r--ui/views/controls/tree/tree_view.cc2
-rw-r--r--ui/views/drag_utils.cc4
-rw-r--r--ui/views/widget/native_widget_win.cc6
10 files changed, 25 insertions, 22 deletions
diff --git a/ui/views/controls/glow_hover_controller.cc b/ui/views/controls/glow_hover_controller.cc
index 49ec068..1306c88 100644
--- a/ui/views/controls/glow_hover_controller.cc
+++ b/ui/views/controls/glow_hover_controller.cc
@@ -69,7 +69,7 @@ void GlowHoverController::Draw(gfx::Canvas* canvas,
return;
// Draw a radial gradient to hover_canvas.
- gfx::CanvasSkia hover_canvas(view_->width(), view_->height(), false);
+ gfx::CanvasSkia hover_canvas(view_->size(), false);
// Draw a radial gradient to hover_canvas.
int radius = view_->width() / 3;
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index b0c80de..8a6e5c5 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -477,8 +477,7 @@ void MenuController::OnMouseDragged(SubmenuView* source,
gfx::Point press_loc(press_pt_);
View::ConvertPointToScreen(source->GetScrollViewContainer(), &press_loc);
View::ConvertPointToView(NULL, item, &press_loc);
- // TODO(beng): Convert to CanvasSkia
- gfx::CanvasSkia canvas(item->width(), item->height(), false);
+ gfx::CanvasSkia canvas(gfx::Size(item->width(), item->height()), false);
item->PaintButton(&canvas, MenuItemView::PB_FOR_DRAG);
OSExchangeData data;
diff --git a/ui/views/controls/menu/menu_image_util.cc b/ui/views/controls/menu/menu_image_util.cc
index 061b3f5..ee71c69 100644
--- a/ui/views/controls/menu/menu_image_util.cc
+++ b/ui/views/controls/menu/menu_image_util.cc
@@ -10,6 +10,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/point.h"
+#include "ui/gfx/size.h"
namespace {
@@ -29,7 +30,8 @@ const SkColor kIndicatorStroke = SkColorSetRGB(0, 0, 0);
SkBitmap* CreateRadioButtonImage(bool selected) {
// + 2 (1px on each side) to cover rounding error.
- gfx::CanvasSkia canvas(kIndicatorSize + 2, kIndicatorSize + 2, false);
+ gfx::CanvasSkia canvas(gfx::Size(kIndicatorSize + 2, kIndicatorSize + 2),
+ false);
canvas.Translate(gfx::Point(1, 1));
SkPoint gradient_points[3];
@@ -88,7 +90,7 @@ SkBitmap* GetRtlSubmenuArrowImage() {
if (!kRtlArrow) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
SkBitmap* r = rb.GetBitmapNamed(IDR_MENU_ARROW);
- gfx::CanvasSkia canvas(r->width(), r->height(), false);
+ gfx::CanvasSkia canvas(gfx::Size(r->width(), r->height()), false);
canvas.Scale(-1, 1);
canvas.DrawBitmapInt(*r, - r->width(), 0);
kRtlArrow = new SkBitmap(canvas.ExtractBitmap());
diff --git a/ui/views/controls/menu/menu_win.cc b/ui/views/controls/menu/menu_win.cc
index e1ad7a5..5928f74 100644
--- a/ui/views/controls/menu/menu_win.cc
+++ b/ui/views/controls/menu/menu_win.cc
@@ -184,7 +184,8 @@ class MenuHostWindow : public ui::WindowImpl {
// Draw the icon after the label, otherwise it would be covered
// by the label.
if (data->icon.width() != 0 && data->icon.height() != 0) {
- gfx::CanvasSkia canvas(data->icon.width(), data->icon.height(), false);
+ gfx::CanvasSkia canvas(gfx::Size(data->icon.width(),
+ data->icon.height()), false);
canvas.sk_canvas()->drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
canvas.DrawBitmapInt(data->icon, 0, 0);
skia::DrawToNativeContext(
diff --git a/ui/views/controls/menu/native_menu_win.cc b/ui/views/controls/menu/native_menu_win.cc
index f0dff18..711ac99 100644
--- a/ui/views/controls/menu/native_menu_win.cc
+++ b/ui/views/controls/menu/native_menu_win.cc
@@ -248,7 +248,7 @@ class NativeMenuWin::MenuHostWindow {
if (data->native_menu_win->model_->GetIconAt(data->model_index, &icon)) {
// We currently don't support items with both icons and checkboxes.
DCHECK(type != ui::MenuModel::TYPE_CHECK);
- gfx::CanvasSkia canvas(icon.width(), icon.height(), false);
+ gfx::CanvasSkia canvas(gfx::Size(icon.width(), icon.height()), false);
canvas.sk_canvas()->drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
canvas.DrawBitmapInt(icon, 0, 0);
skia::DrawToNativeContext(
@@ -273,7 +273,8 @@ class NativeMenuWin::MenuHostWindow {
int icon_y = kItemTopMargin +
(height - kItemTopMargin - kItemBottomMargin -
config.check_height) / 2;
- gfx::CanvasSkia canvas(config.check_width, config.check_height, false);
+ gfx::CanvasSkia canvas(gfx::Size(config.check_width,
+ config.check_height), false);
NativeTheme::ExtraParams extra;
extra.menu_check.is_radio = false;
gfx::Rect bounds(0, 0, config.check_width, config.check_height);
diff --git a/ui/views/controls/table/native_table_win.cc b/ui/views/controls/table/native_table_win.cc
index 704ff0c..6aca928 100644
--- a/ui/views/controls/table/native_table_win.cc
+++ b/ui/views/controls/table/native_table_win.cc
@@ -393,7 +393,7 @@ void NativeTableWin::CreateNativeControl() {
// We create 2 phony images because we are going to switch images at every
// refresh in order to force a refresh of the icon area (somehow the clip
// rect does not include the icon).
- gfx::CanvasSkia canvas(kImageSize, kImageSize, false);
+ gfx::CanvasSkia canvas(gfx::Size(kImageSize, kImageSize), false);
// Make the background completely transparent.
canvas.sk_canvas()->drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
{
@@ -513,8 +513,9 @@ LRESULT NativeTableWin::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) {
client_rect.top += content_offset_;
// Make sure the region need to paint is visible.
if (IntersectRect(&intersection, &icon_rect, &client_rect)) {
- gfx::CanvasSkia canvas(icon_rect.right - icon_rect.left,
- icon_rect.bottom - icon_rect.top, false);
+ gfx::CanvasSkia canvas(
+ gfx::Size(icon_rect.right - icon_rect.left,
+ icon_rect.bottom - icon_rect.top), false);
// It seems the state in nmcd.uItemState is not correct.
// We'll retrieve it explicitly.
diff --git a/ui/views/controls/table/table_view.cc b/ui/views/controls/table/table_view.cc
index bdafbe5..83c4027 100644
--- a/ui/views/controls/table/table_view.cc
+++ b/ui/views/controls/table/table_view.cc
@@ -805,7 +805,7 @@ HWND TableView::CreateNativeControl(HWND parent_container) {
// We create 2 phony images because we are going to switch images at every
// refresh in order to force a refresh of the icon area (somehow the clip
// rect does not include the icon).
- gfx::CanvasSkia canvas(kImageSize, kImageSize, false);
+ gfx::CanvasSkia canvas(gfx::Size(kImageSize, kImageSize), false);
// Make the background completely transparent.
canvas.sk_canvas()->drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
{
@@ -1152,7 +1152,7 @@ void TableView::PaintAltText() {
HDC dc = GetDC(GetNativeControlHWND());
gfx::Font font = GetAltTextFont();
gfx::Rect bounds = GetAltTextBounds();
- gfx::CanvasSkia canvas(bounds.width(), bounds.height(), false);
+ gfx::CanvasSkia canvas(bounds.size(), false);
// Pad by 1 for halo.
canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1,
1, bounds.width() - 2, bounds.height() - 2,
@@ -1236,8 +1236,9 @@ LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) {
client_rect.top += content_offset_;
// Make sure the region need to paint is visible.
if (IntersectRect(&intersection, &icon_rect, &client_rect)) {
- gfx::CanvasSkia canvas(icon_rect.right - icon_rect.left,
- icon_rect.bottom - icon_rect.top, false);
+ gfx::CanvasSkia canvas(
+ gfx::Size(icon_rect.right - icon_rect.left,
+ icon_rect.bottom - icon_rect.top), false);
// It seems the state in nmcd.uItemState is not correct.
// We'll retrieve it explicitly.
diff --git a/ui/views/controls/tree/tree_view.cc b/ui/views/controls/tree/tree_view.cc
index 5913633..eaec67c 100644
--- a/ui/views/controls/tree/tree_view.cc
+++ b/ui/views/controls/tree/tree_view.cc
@@ -698,7 +698,7 @@ HIMAGELIST TreeView::CreateImageList() {
// IDR_FOLDER_CLOSED if they aren't already.
if (model_images[i].width() != width ||
model_images[i].height() != height) {
- gfx::CanvasSkia canvas(width, height, false);
+ gfx::CanvasSkia canvas(gfx::Size(width, height), false);
// Make the background completely transparent.
canvas.sk_canvas()->drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
diff --git a/ui/views/drag_utils.cc b/ui/views/drag_utils.cc
index 181a599..ae2a3e9 100644
--- a/ui/views/drag_utils.cc
+++ b/ui/views/drag_utils.cc
@@ -47,7 +47,7 @@ void SetURLAndDragImage(const GURL& url,
button.SetBounds(0, 0, prefsize.width(), prefsize.height());
// Render the image.
- gfx::CanvasSkia canvas(prefsize.width(), prefsize.height(), false);
+ gfx::CanvasSkia canvas(prefsize, false);
button.PaintButton(&canvas, views::TextButton::PB_FOR_DRAG);
SetDragImageOnDataObject(canvas, prefsize,
gfx::Point(prefsize.width() / 2, prefsize.height() / 2), data);
@@ -67,7 +67,7 @@ void CreateDragImageForFile(const FilePath& file_name,
// Add +2 here to allow room for the halo.
const int height = font.GetHeight() + icon->height() +
kLinkDragImageVPadding + 2;
- gfx::CanvasSkia canvas(width, height, false /* translucent */);
+ gfx::CanvasSkia canvas(gfx::Size(width, height), false /* translucent */);
// Paint the icon.
canvas.DrawBitmapInt(*icon, (width - icon->width()) / 2, 0);
diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc
index bf22fc7..dfa75f7 100644
--- a/ui/views/widget/native_widget_win.cc
+++ b/ui/views/widget/native_widget_win.cc
@@ -2252,10 +2252,8 @@ void NativeWidgetWin::ClientAreaSizeChanged() {
if (compositor_.get())
compositor_->WidgetSizeChanged(s);
delegate_->OnNativeWidgetSizeChanged(s);
- if (use_layered_buffer_) {
- layered_window_contents_.reset(
- new gfx::CanvasSkia(s.width(), s.height(), false));
- }
+ if (use_layered_buffer_)
+ layered_window_contents_.reset(new gfx::CanvasSkia(s, false));
}
void NativeWidgetWin::ResetWindowRegion(bool force) {