diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-15 07:37:29 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-15 07:37:29 +0000 |
commit | 82522511b7921e8c61742ebd80a4c674c56e7e48 (patch) | |
tree | 381d71de2b9c7b99675e6f2b4523ae0876c72ce8 /views | |
parent | 631cf822bd6e64cf469544b42c9975f5602c29a6 (diff) | |
download | chromium_src-82522511b7921e8c61742ebd80a4c674c56e7e48.zip chromium_src-82522511b7921e8c61742ebd80a4c674c56e7e48.tar.gz chromium_src-82522511b7921e8c61742ebd80a4c674c56e7e48.tar.bz2 |
ChromeCanvas->gfx::Canvas
Rename files too.
TBR=brettw
http://crbug.com/11387
Review URL: http://codereview.chromium.org/113443
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16148 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
57 files changed, 203 insertions, 195 deletions
@@ -1,9 +1,8 @@ include_rules = [ "+app", - "+skia/ext", - "+skia/include", - # TODO(beng): swap these with app/views specific generated resources. "+grit/generated_resources.h", "+grit/theme_resources.h", + "+skia/ext", + "+skia/include", ] diff --git a/views/background.cc b/views/background.cc index 37b1251..5206349 100644 --- a/views/background.cc +++ b/views/background.cc @@ -4,7 +4,7 @@ #include "views/background.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "base/logging.h" #include "skia/ext/skia_utils_win.h" #include "third_party/skia/include/core/SkPaint.h" @@ -22,7 +22,7 @@ class SolidBackground : public Background { SetNativeControlColor(color_); } - void Paint(ChromeCanvas* canvas, View* view) const { + void Paint(gfx::Canvas* canvas, View* view) const { // Fill the background. Note that we don't constrain to the bounds as // canvas is already clipped for us. canvas->drawColor(color_); @@ -47,7 +47,7 @@ class BackgroundPainter : public Background { } - void Paint(ChromeCanvas* canvas, View* view) const { + void Paint(gfx::Canvas* canvas, View* view) const { Painter::PaintPainterAt(0, 0, view->width(), view->height(), canvas, painter_); } diff --git a/views/background.h b/views/background.h index efb2a63..1453749 100644 --- a/views/background.h +++ b/views/background.h @@ -14,7 +14,9 @@ #include "base/basictypes.h" #include "third_party/skia/include/core/SkColor.h" -class ChromeCanvas; +namespace gfx { +class Canvas; +} namespace views { @@ -65,7 +67,7 @@ class Background { Painter* painter); // Render the background for the provided view - virtual void Paint(ChromeCanvas* canvas, View* view) const = 0; + virtual void Paint(gfx::Canvas* canvas, View* view) const = 0; // Set a solid, opaque color to be used when drawing backgrounds of native // controls. Unfortunately alpha=0 is not an option. diff --git a/views/border.cc b/views/border.cc index 9127bce..2e74135 100644 --- a/views/border.cc +++ b/views/border.cc @@ -4,7 +4,7 @@ #include "views/border.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "base/logging.h" namespace views { @@ -16,7 +16,7 @@ class SolidBorder : public Border { public: SolidBorder(int thickness, SkColor color); - virtual void Paint(const View& view, ChromeCanvas* canvas) const; + virtual void Paint(const View& view, gfx::Canvas* canvas) const; virtual void GetInsets(gfx::Insets* insets) const; private: @@ -33,7 +33,7 @@ SolidBorder::SolidBorder(int thickness, SkColor color) insets_(thickness, thickness, thickness, thickness) { } -void SolidBorder::Paint(const View& view, ChromeCanvas* canvas) const { +void SolidBorder::Paint(const View& view, gfx::Canvas* canvas) const { gfx::Rect clip_rect; if (!canvas->GetClipRect(&clip_rect)) return; // Empty clip rectangle, nothing to paint. @@ -70,7 +70,7 @@ class EmptyBorder : public Border { EmptyBorder(int top, int left, int bottom, int right) : top_(top), left_(left), bottom_(bottom), right_(right) {} - virtual void Paint(const View& view, ChromeCanvas* canvas) const {} + virtual void Paint(const View& view, gfx::Canvas* canvas) const {} virtual void GetInsets(gfx::Insets* insets) const { DCHECK(insets); diff --git a/views/border.h b/views/border.h index 98086c2..0e9a41c 100644 --- a/views/border.h +++ b/views/border.h @@ -9,7 +9,9 @@ #include "third_party/skia/include/core/SkColor.h" #include "views/view.h" -class ChromeCanvas; +namespace gfx{ +class Canvas; +} namespace views { @@ -45,7 +47,7 @@ class Border { static Border* CreateEmptyBorder(int top, int left, int bottom, int right); // Renders the border for the specified view. - virtual void Paint(const View& view, ChromeCanvas* canvas) const = 0; + virtual void Paint(const View& view, gfx::Canvas* canvas) const = 0; // Sets the specified insets to the the border insets. virtual void GetInsets(gfx::Insets* insets) const = 0; diff --git a/views/controls/button/checkbox.cc b/views/controls/button/checkbox.cc index af6a7b4..0097251 100644 --- a/views/controls/button/checkbox.cc +++ b/views/controls/button/checkbox.cc @@ -4,7 +4,7 @@ #include "views/controls/button/checkbox.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "views/controls/label.h" namespace views { @@ -85,7 +85,7 @@ void Checkbox::Layout() { native_wrapper_->GetView()->Layout(); } -void Checkbox::PaintFocusBorder(ChromeCanvas* canvas) { +void Checkbox::PaintFocusBorder(gfx::Canvas* canvas) { // Our focus border is rendered by the label, so we don't do anything here. } diff --git a/views/controls/button/checkbox.h b/views/controls/button/checkbox.h index db6706b..86111d1 100644 --- a/views/controls/button/checkbox.h +++ b/views/controls/button/checkbox.h @@ -41,7 +41,7 @@ class Checkbox : public NativeButton { // Overridden from View: virtual gfx::Size GetPreferredSize(); virtual void Layout(); - virtual void PaintFocusBorder(ChromeCanvas* canvas); + virtual void PaintFocusBorder(gfx::Canvas* canvas); virtual View* GetViewForPoint(const gfx::Point& point); virtual View* GetViewForPoint(const gfx::Point& point, bool can_create_floating); diff --git a/views/controls/button/image_button.cc b/views/controls/button/image_button.cc index 3c4c7fe..087b4f0 100644 --- a/views/controls/button/image_button.cc +++ b/views/controls/button/image_button.cc @@ -4,7 +4,7 @@ #include "views/controls/button/image_button.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "app/throb_animation.h" #include "skia/ext/image_operations.h" @@ -20,7 +20,7 @@ ImageButton::ImageButton(ButtonListener* listener) : CustomButton(listener), h_alignment_(ALIGN_LEFT), v_alignment_(ALIGN_TOP) { - // By default, we request that the ChromeCanvas passed to our View::Paint() + // By default, we request that the gfx::Canvas passed to our View::Paint() // implementation is flipped horizontally so that the button's bitmaps are // mirrored when the UI directionality is right-to-left. EnableCanvasFlippingForRTLUI(true); @@ -49,7 +49,7 @@ gfx::Size ImageButton::GetPreferredSize() { return gfx::Size(kDefaultWidth, kDefaultHeight); } -void ImageButton::Paint(ChromeCanvas* canvas) { +void ImageButton::Paint(gfx::Canvas* canvas) { // Call the base class first to paint any background/borders. View::Paint(canvas); diff --git a/views/controls/button/image_button.h b/views/controls/button/image_button.h index da2e0a4..ec3b9ae 100644 --- a/views/controls/button/image_button.h +++ b/views/controls/button/image_button.h @@ -33,7 +33,7 @@ class ImageButton : public CustomButton { // Overridden from View: virtual gfx::Size GetPreferredSize(); - virtual void Paint(ChromeCanvas* canvas); + virtual void Paint(gfx::Canvas* canvas); protected: // Returns the image to paint. This is invoked from paint and returns a value diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc index 6dbf4ae..28045a4 100644 --- a/views/controls/button/menu_button.cc +++ b/views/controls/button/menu_button.cc @@ -5,7 +5,7 @@ #include "views/controls/button/menu_button.h" #include "app/drag_drop_types.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "app/win_util.h" @@ -75,7 +75,7 @@ gfx::Size MenuButton::GetPreferredSize() { return prefsize; } -void MenuButton::Paint(ChromeCanvas* canvas, bool for_drag) { +void MenuButton::Paint(gfx::Canvas* canvas, bool for_drag) { TextButton::Paint(canvas, for_drag); if (show_menu_marker_) { diff --git a/views/controls/button/menu_button.h b/views/controls/button/menu_button.h index cbe9ab8..c9a39dd 100644 --- a/views/controls/button/menu_button.h +++ b/views/controls/button/menu_button.h @@ -7,7 +7,7 @@ #include <windows.h> -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "base/time.h" #include "views/background.h" #include "views/controls/button/text_button.h" @@ -44,7 +44,7 @@ class MenuButton : public TextButton { // Overridden to take into account the potential use of a drop marker. virtual gfx::Size GetPreferredSize(); - virtual void Paint(ChromeCanvas* canvas, bool for_drag); + virtual void Paint(gfx::Canvas* canvas, bool for_drag); // These methods are overriden to implement a simple push button // behavior diff --git a/views/controls/button/native_button.h b/views/controls/button/native_button.h index 8b3fbcf..50aaff73 100644 --- a/views/controls/button/native_button.h +++ b/views/controls/button/native_button.h @@ -5,7 +5,7 @@ #ifndef VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_H_ #define VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_H_ -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "views/controls/button/button.h" #include "views/controls/button/native_button_wrapper.h" diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc index 4f68b90..9bf9e24 100644 --- a/views/controls/button/text_button.cc +++ b/views/controls/button/text_button.cc @@ -4,7 +4,7 @@ #include "views/controls/button/text_button.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "app/l10n_util.h" #include "app/throb_animation.h" #include "app/resource_bundle.h" @@ -67,7 +67,7 @@ TextButtonBorder::~TextButtonBorder() { // //////////////////////////////////////////////////////////////////////////////// -void TextButtonBorder::Paint(const View& view, ChromeCanvas* canvas) const { +void TextButtonBorder::Paint(const View& view, gfx::Canvas* canvas) const { const TextButton* mb = static_cast<const TextButton*>(&view); int state = mb->state(); @@ -182,7 +182,7 @@ void TextButton::ClearMaxTextSize() { max_text_size_ = text_size_; } -void TextButton::Paint(ChromeCanvas* canvas, bool for_drag) { +void TextButton::Paint(gfx::Canvas* canvas, bool for_drag) { if (!for_drag) { PaintBackground(canvas); @@ -318,7 +318,7 @@ bool TextButton::OnMousePressed(const MouseEvent& e) { return true; } -void TextButton::Paint(ChromeCanvas* canvas) { +void TextButton::Paint(gfx::Canvas* canvas) { Paint(canvas, false); } diff --git a/views/controls/button/text_button.h b/views/controls/button/text_button.h index e0e547c..8b3d343 100644 --- a/views/controls/button/text_button.h +++ b/views/controls/button/text_button.h @@ -5,7 +5,7 @@ #ifndef VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ #define VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "third_party/skia/include/core/SkBitmap.h" #include "views/border.h" #include "views/controls/button/custom_button.h" @@ -26,7 +26,7 @@ class TextButtonBorder : public Border { virtual ~TextButtonBorder(); // Render the background for the provided view - virtual void Paint(const View& view, ChromeCanvas* canvas) const; + virtual void Paint(const View& view, gfx::Canvas* canvas) const; // Returns the insets for the border. virtual void GetInsets(gfx::Insets* insets) const; @@ -92,7 +92,7 @@ class TextButton : public CustomButton { // Paint the button into the specified canvas. If |for_drag| is true, the // function paints a drag image representation into the canvas. - virtual void Paint(ChromeCanvas* canvas, bool for_drag); + virtual void Paint(gfx::Canvas* canvas, bool for_drag); // Overridden from View: virtual gfx::Size GetPreferredSize(); @@ -101,7 +101,7 @@ class TextButton : public CustomButton { protected: virtual bool OnMousePressed(const MouseEvent& e); - virtual void Paint(ChromeCanvas* canvas); + virtual void Paint(gfx::Canvas* canvas); private: // The text string that is displayed in the button. diff --git a/views/controls/combo_box.cc b/views/controls/combo_box.cc index 1469c32..966509c 100644 --- a/views/controls/combo_box.cc +++ b/views/controls/combo_box.cc @@ -4,8 +4,8 @@ #include "views/controls/combo_box.h" -#include "app/gfx/chrome_canvas.h" -#include "app/gfx/chrome_font.h" +#include "app/gfx/canvas.h" +#include "app/gfx/font.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/gfx/native_theme.h" diff --git a/views/controls/hwnd_view.cc b/views/controls/hwnd_view.cc index fdf4042..eaefe6c 100644 --- a/views/controls/hwnd_view.cc +++ b/views/controls/hwnd_view.cc @@ -4,7 +4,7 @@ #include "views/controls/hwnd_view.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "base/logging.h" #include "views/focus/focus_manager.h" #include "views/widget/widget.h" @@ -46,7 +46,7 @@ void HWNDView::Detach() { set_installed_clip(false); } -void HWNDView::Paint(ChromeCanvas* canvas) { +void HWNDView::Paint(gfx::Canvas* canvas) { // The area behind our window is black, so during a fast resize (where our // content doesn't draw over the full size of our HWND, and the HWND // background color doesn't show up), we need to cover that blackness with diff --git a/views/controls/hwnd_view.h b/views/controls/hwnd_view.h index a8d52b3..1ad1ef6 100644 --- a/views/controls/hwnd_view.h +++ b/views/controls/hwnd_view.h @@ -41,7 +41,7 @@ class HWNDView : public NativeViewHost { // TODO(sky): convert this to native_view(). HWND GetHWND() const { return native_view(); } - virtual void Paint(ChromeCanvas* canvas); + virtual void Paint(gfx::Canvas* canvas); // Overridden from View. virtual std::string GetClassName() const; diff --git a/views/controls/image_view.cc b/views/controls/image_view.cc index 8f58744..10d87b1 100644 --- a/views/controls/image_view.cc +++ b/views/controls/image_view.cc @@ -4,7 +4,7 @@ #include "views/controls/image_view.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "base/logging.h" namespace views { @@ -104,7 +104,7 @@ void ImageView::ComputeImageOrigin(int image_width, int image_height, } } -void ImageView::Paint(ChromeCanvas* canvas) { +void ImageView::Paint(gfx::Canvas* canvas) { View::Paint(canvas); int image_width = image_.width(); int image_height = image_.height(); diff --git a/views/controls/image_view.h b/views/controls/image_view.h index ca4e2ea..0ad8947 100644 --- a/views/controls/image_view.h +++ b/views/controls/image_view.h @@ -8,7 +8,9 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "views/view.h" -class ChromeCanvas; +namespace gfx { +class Canvas; +} namespace views { @@ -71,7 +73,7 @@ class ImageView : public View { // Return whether the image should be centered inside the view. // Overriden from View virtual gfx::Size GetPreferredSize(); - virtual void Paint(ChromeCanvas* canvas); + virtual void Paint(gfx::Canvas* canvas); // Overriden from View. virtual bool GetTooltipText(int x, int y, std::wstring* tooltip); diff --git a/views/controls/label.cc b/views/controls/label.cc index aed16b9..bf09438 100644 --- a/views/controls/label.cc +++ b/views/controls/label.cc @@ -6,8 +6,8 @@ #include <math.h> -#include "app/gfx/chrome_canvas.h" -#include "app/gfx/chrome_font.h" +#include "app/gfx/canvas.h" +#include "app/gfx/font.h" #include "app/gfx/insets.h" #include "app/gfx/text_elider.h" #include "app/l10n_util.h" @@ -68,7 +68,7 @@ gfx::Size Label::GetPreferredSize() { if (is_multi_line_) { int w = width(), h = 0; - ChromeCanvas::SizeStringInt(text_, font_, &w, &h, ComputeMultiLineFlags()); + gfx::Canvas::SizeStringInt(text_, font_, &w, &h, ComputeMultiLineFlags()); prefsize.SetSize(w, h); } else { prefsize = GetTextSize(); @@ -80,18 +80,18 @@ gfx::Size Label::GetPreferredSize() { } int Label::ComputeMultiLineFlags() { - int flags = ChromeCanvas::MULTI_LINE; + int flags = gfx::Canvas::MULTI_LINE; if (allow_character_break_) - flags |= ChromeCanvas::CHARACTER_BREAK; + flags |= gfx::Canvas::CHARACTER_BREAK; switch (horiz_alignment_) { case ALIGN_LEFT: - flags |= ChromeCanvas::TEXT_ALIGN_LEFT; + flags |= gfx::Canvas::TEXT_ALIGN_LEFT; break; case ALIGN_CENTER: - flags |= ChromeCanvas::TEXT_ALIGN_CENTER; + flags |= gfx::Canvas::TEXT_ALIGN_CENTER; break; case ALIGN_RIGHT: - flags |= ChromeCanvas::TEXT_ALIGN_RIGHT; + flags |= gfx::Canvas::TEXT_ALIGN_RIGHT; break; } return flags; @@ -134,7 +134,7 @@ void Label::CalculateDrawStringParams( } } -void Label::Paint(ChromeCanvas* canvas) { +void Label::Paint(gfx::Canvas* canvas) { PaintBackground(canvas); std::wstring paint_text; gfx::Rect text_bounds; @@ -156,8 +156,8 @@ void Label::Paint(ChromeCanvas* canvas) { // We explicitly OR in MULTI_LINE here since SizeStringInt seems to return // an incorrect height for single line text when the MULTI_LINE flag isn't // specified. o_O... - ChromeCanvas::SizeStringInt(paint_text, font_, &w, &h, - flags | ChromeCanvas::MULTI_LINE); + gfx::Canvas::SizeStringInt(paint_text, font_, &w, &h, + flags | gfx::Canvas::MULTI_LINE); gfx::Rect focus_rect = text_bounds; focus_rect.set_width(w); focus_rect.set_height(h); @@ -165,18 +165,18 @@ void Label::Paint(ChromeCanvas* canvas) { // If the label is a single line of text, then the computed text bound // corresponds directly to the text being drawn and no mirroring is needed // for the RTL case. For multiline text, the text bound is an estimation - // and is recomputed in ChromeCanvas::SizeStringInt(). For multiline text + // and is recomputed in gfx::Canvas::SizeStringInt(). For multiline text // in RTL, we need to take mirroring into account when computing the focus // rectangle. int x = focus_rect.x(); - if (flags & ChromeCanvas::MULTI_LINE) + if (flags & gfx::Canvas::MULTI_LINE) x = MirroredLeftPointForRect(focus_rect); canvas->DrawFocusRect(x, focus_rect.y(), focus_rect.width(), focus_rect.height()); } } -void Label::PaintBackground(ChromeCanvas* canvas) { +void Label::PaintBackground(gfx::Canvas* canvas) { const Background* bg = contains_mouse_ ? GetMouseOverBackground() : NULL; if (!bg) bg = background(); @@ -239,7 +239,7 @@ int Label::GetHeightForWidth(int w) { gfx::Insets insets = GetInsets(); w = std::max<int>(0, w - insets.width()); int h = 0; - ChromeCanvas cc(0, 0, true); + gfx::Canvas cc(0, 0, true); cc.SizeStringInt(text_, font_, &w, &h, ComputeMultiLineFlags()); return h + insets.height(); } diff --git a/views/controls/label.h b/views/controls/label.h index e9ace3f..97b5bc2 100644 --- a/views/controls/label.h +++ b/views/controls/label.h @@ -5,7 +5,7 @@ #ifndef VIEWS_CONTROLS_LABEL_H_ #define VIEWS_CONTROLS_LABEL_H_ -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "googleurl/src/gurl.h" #include "third_party/skia/include/core/SkColor.h" #include "testing/gtest/include/gtest/gtest_prod.h" @@ -67,11 +67,11 @@ class Label : public View { virtual std::string GetClassName() const; // Overridden to paint - virtual void Paint(ChromeCanvas* canvas); + virtual void Paint(gfx::Canvas* canvas); // If the mouse is over the label, and a mouse over background has been // specified, its used. Otherwise super's implementation is invoked - virtual void PaintBackground(ChromeCanvas* canvas); + virtual void PaintBackground(gfx::Canvas* canvas); // Set the font. void SetFont(const gfx::Font& font); diff --git a/views/controls/label_unittest.cc b/views/controls/label_unittest.cc index 54ee5ca..f9bb484 100644 --- a/views/controls/label_unittest.cc +++ b/views/controls/label_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "app/l10n_util.h" #include "base/string_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -394,7 +394,7 @@ TEST(LabelTest, DrawMultiLineString) { EXPECT_EQ(0, text_bounds.y()); EXPECT_GT(text_bounds.width(), kMinTextDimension); EXPECT_GT(text_bounds.height(), kMinTextDimension); - EXPECT_EQ(ChromeCanvas::MULTI_LINE | ChromeCanvas::TEXT_ALIGN_CENTER, flags); + EXPECT_EQ(gfx::Canvas::MULTI_LINE | gfx::Canvas::TEXT_ALIGN_CENTER, flags); gfx::Rect center_bounds(text_bounds); label.SetHorizontalAlignment(Label::ALIGN_LEFT); @@ -406,7 +406,7 @@ TEST(LabelTest, DrawMultiLineString) { EXPECT_EQ(0, text_bounds.y()); EXPECT_GT(text_bounds.width(), kMinTextDimension); EXPECT_GT(text_bounds.height(), kMinTextDimension); - EXPECT_EQ(ChromeCanvas::MULTI_LINE | ChromeCanvas::TEXT_ALIGN_LEFT, flags); + EXPECT_EQ(gfx::Canvas::MULTI_LINE | gfx::Canvas::TEXT_ALIGN_LEFT, flags); label.SetHorizontalAlignment(Label::ALIGN_RIGHT); paint_text.clear(); @@ -417,7 +417,7 @@ TEST(LabelTest, DrawMultiLineString) { EXPECT_EQ(0, text_bounds.y()); EXPECT_GT(text_bounds.width(), kMinTextDimension); EXPECT_GT(text_bounds.height(), kMinTextDimension); - EXPECT_EQ(ChromeCanvas::MULTI_LINE | ChromeCanvas::TEXT_ALIGN_RIGHT, flags); + EXPECT_EQ(gfx::Canvas::MULTI_LINE | gfx::Canvas::TEXT_ALIGN_RIGHT, flags); // Test multiline drawing with a border. gfx::Insets border(19, 92, 23, 2); @@ -435,7 +435,7 @@ TEST(LabelTest, DrawMultiLineString) { EXPECT_EQ(center_bounds.y() + border.top(), text_bounds.y()); EXPECT_EQ(center_bounds.width(), text_bounds.width()); EXPECT_EQ(center_bounds.height(), text_bounds.height()); - EXPECT_EQ(ChromeCanvas::MULTI_LINE | ChromeCanvas::TEXT_ALIGN_CENTER, flags); + EXPECT_EQ(gfx::Canvas::MULTI_LINE | gfx::Canvas::TEXT_ALIGN_CENTER, flags); } } // namespace views diff --git a/views/controls/link.cc b/views/controls/link.cc index d89ce4d..cd506bf 100644 --- a/views/controls/link.cc +++ b/views/controls/link.cc @@ -4,7 +4,7 @@ #include "views/controls/link.h" -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "views/event.h" namespace views { diff --git a/views/controls/menu/chrome_menu.cc b/views/controls/menu/chrome_menu.cc index f0cf28b..264c8b7 100644 --- a/views/controls/menu/chrome_menu.cc +++ b/views/controls/menu/chrome_menu.cc @@ -8,7 +8,7 @@ #include <uxtheme.h> #include <Vssym32.h> -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "app/gfx/color_utils.h" #include "app/l10n_util.h" #include "app/l10n_util_win.h" @@ -335,7 +335,7 @@ class MenuScrollButton : public View { return DragDropTypes::DRAG_NONE; } - virtual void Paint(ChromeCanvas* canvas) { + virtual void Paint(gfx::Canvas* canvas) { HDC dc = canvas->beginPlatformPaint(); // The background. @@ -430,7 +430,7 @@ class MenuScrollViewContainer : public View { kSubmenuBorderSize, kSubmenuBorderSize)); } - virtual void Paint(ChromeCanvas* canvas) { + virtual void Paint(gfx::Canvas* canvas) { HDC dc = canvas->beginPlatformPaint(); CRect bounds(0, 0, width(), height()); NativeTheme::instance()->PaintMenuBackground( @@ -503,7 +503,7 @@ class MenuSeparator : public View { MenuSeparator() { } - void Paint(ChromeCanvas* canvas) { + void Paint(gfx::Canvas* canvas) { // The gutter is rendered before the background. int start_x = 0; int start_y = height() / 3; @@ -873,7 +873,7 @@ void SubmenuView::DidChangeBounds(const gfx::Rect& previous, SchedulePaint(); } -void SubmenuView::PaintChildren(ChromeCanvas* canvas) { +void SubmenuView::PaintChildren(gfx::Canvas* canvas) { View::PaintChildren(canvas); if (drop_item_ && drop_position_ != MenuDelegate::DROP_ON) @@ -1031,7 +1031,7 @@ MenuScrollViewContainer* SubmenuView::GetScrollViewContainer() { return scroll_view_container_; } -void SubmenuView::PaintDropIndicator(ChromeCanvas* canvas, +void SubmenuView::PaintDropIndicator(gfx::Canvas* canvas, MenuItemView* item, MenuDelegate::DropPosition position) { if (position == MenuDelegate::DROP_NONE) @@ -1210,7 +1210,7 @@ void MenuItemView::SetIcon(const SkBitmap& icon) { SchedulePaint(); } -void MenuItemView::Paint(ChromeCanvas* canvas) { +void MenuItemView::Paint(gfx::Canvas* canvas) { Paint(canvas, false); } @@ -1374,15 +1374,15 @@ void MenuItemView::PrepareForRun(bool has_mnemonics) { int MenuItemView::GetDrawStringFlags() { int flags = 0; if (UILayoutIsRightToLeft()) - flags |= ChromeCanvas::TEXT_ALIGN_RIGHT; + flags |= gfx::Canvas::TEXT_ALIGN_RIGHT; else - flags |= ChromeCanvas::TEXT_ALIGN_LEFT; + flags |= gfx::Canvas::TEXT_ALIGN_LEFT; if (has_mnemonics_) { if (show_mnemonics) - flags |= ChromeCanvas::SHOW_PREFIX; + flags |= gfx::Canvas::SHOW_PREFIX; else - flags |= ChromeCanvas::HIDE_PREFIX; + flags |= gfx::Canvas::HIDE_PREFIX; } return flags; } @@ -1423,7 +1423,7 @@ void MenuItemView::AdjustBoundsForRTLUI(RECT* rect) const { *rect = mirrored_rect.ToRECT(); } -void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) { +void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) { bool render_selection = (!for_drag && IsSelected() && parent_menu_item_->GetSubmenu()->GetShowSelection(this)); @@ -1824,7 +1824,7 @@ void MenuController::OnMouseDragged(SubmenuView* source, gfx::Point drag_loc(event.location()); View::ConvertPointToScreen(source->GetScrollViewContainer(), &drag_loc); View::ConvertPointToView(NULL, item, &drag_loc); - ChromeCanvas canvas(item->width(), item->height(), false); + gfx::Canvas canvas(item->width(), item->height(), false); item->Paint(&canvas, true); scoped_refptr<OSExchangeData> data(new OSExchangeData); diff --git a/views/controls/menu/chrome_menu.h b/views/controls/menu/chrome_menu.h index 6622cbd..8ff9ec0 100644 --- a/views/controls/menu/chrome_menu.h +++ b/views/controls/menu/chrome_menu.h @@ -9,7 +9,7 @@ #include <vector> #include "app/drag_drop_types.h" -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "base/gfx/point.h" #include "base/gfx/rect.h" #include "base/message_loop.h" @@ -352,7 +352,7 @@ class MenuItemView : public View { int GetCommand() const { return command_; } // Paints the menu item. - virtual void Paint(ChromeCanvas* canvas); + virtual void Paint(gfx::Canvas* canvas); // Returns the preferred size of this item. virtual gfx::Size GetPreferredSize(); @@ -421,7 +421,7 @@ class MenuItemView : public View { // Actual paint implementation. If for_drag is true, portions of the menu // are not rendered. - void Paint(ChromeCanvas* canvas, bool for_drag); + void Paint(gfx::Canvas* canvas, bool for_drag); // Destroys the window used to display this menu and recursively destroys // the windows used to display all descendants. @@ -517,7 +517,7 @@ class SubmenuView : public View { const gfx::Rect& current); // Painting. - void PaintChildren(ChromeCanvas* canvas); + void PaintChildren(gfx::Canvas* canvas); // Drag and drop methods. These are forwarded to the MenuController. virtual bool CanDrop(const OSExchangeData& data); @@ -578,7 +578,7 @@ class SubmenuView : public View { private: // Paints the drop indicator. This is only invoked if item is non-NULL and // position is not DROP_NONE. - void PaintDropIndicator(ChromeCanvas* canvas, + void PaintDropIndicator(gfx::Canvas* canvas, MenuItemView* item, MenuDelegate::DropPosition position); diff --git a/views/controls/menu/menu_win.cc b/views/controls/menu/menu_win.cc index b10d8dc..eab1816 100644 --- a/views/controls/menu/menu_win.cc +++ b/views/controls/menu/menu_win.cc @@ -12,8 +12,8 @@ #include <atlmisc.h> #include <string> -#include "app/gfx/chrome_canvas.h" -#include "app/gfx/chrome_font.h" +#include "app/gfx/canvas.h" +#include "app/gfx/font.h" #include "app/l10n_util.h" #include "app/l10n_util_win.h" #include "base/gfx/rect.h" @@ -188,7 +188,7 @@ class MenuHostWindow : public CWindowImpl<MenuHostWindow, CWindow, // Draw the icon after the label, otherwise it would be covered // by the label. if (data->icon.width() != 0 && data->icon.height() != 0) { - ChromeCanvas canvas(data->icon.width(), data->icon.height(), false); + gfx::Canvas canvas(data->icon.width(), data->icon.height(), false); canvas.drawColor(SK_ColorBLACK, SkPorterDuff::kClear_Mode); canvas.DrawBitmapInt(data->icon, 0, 0); canvas.getTopPlatformDevice().drawToHDC(hDC, lpdis->rcItem.left + diff --git a/views/controls/native_control.cc b/views/controls/native_control.cc index 6b0b7df..fefed51 100644 --- a/views/controls/native_control.cc +++ b/views/controls/native_control.cc @@ -317,7 +317,7 @@ void NativeControl::SetEnabled(bool enabled) { } } -void NativeControl::Paint(ChromeCanvas* canvas) { +void NativeControl::Paint(gfx::Canvas* canvas) { } void NativeControl::VisibilityChanged(View* starting_from, bool is_visible) { diff --git a/views/controls/native_control.h b/views/controls/native_control.h index 39022a2..22c0fa4 100644 --- a/views/controls/native_control.h +++ b/views/controls/native_control.h @@ -43,7 +43,7 @@ class NativeControl : public View { virtual void SetEnabled(bool enabled); // Overridden to do nothing. - virtual void Paint(ChromeCanvas* canvas); + virtual void Paint(gfx::Canvas* canvas); protected: friend class NativeControlContainer; diff --git a/views/controls/scrollbar/bitmap_scroll_bar.cc b/views/controls/scrollbar/bitmap_scroll_bar.cc index 4fe8934..2d0fbdf 100644 --- a/views/controls/scrollbar/bitmap_scroll_bar.cc +++ b/views/controls/scrollbar/bitmap_scroll_bar.cc @@ -4,7 +4,7 @@ #include "views/controls/scrollbar/bitmap_scroll_bar.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "app/l10n_util.h" #include "base/compiler_specific.h" #include "base/message_loop.h" @@ -140,7 +140,7 @@ class BitmapScrollBarThumb : public View { protected: // View overrides: - virtual void Paint(ChromeCanvas* canvas) { + virtual void Paint(gfx::Canvas* canvas) { canvas->DrawBitmapInt(*start_cap_bitmap(), 0, 0); int top_cap_height = start_cap_bitmap()->height(); int bottom_cap_height = end_cap_bitmap()->height(); @@ -391,7 +391,7 @@ gfx::Size BitmapScrollBar::GetPreferredSize() { return gfx::Size(button_prefsize.width(), button_prefsize.height() * 2); } -void BitmapScrollBar::Paint(ChromeCanvas* canvas) { +void BitmapScrollBar::Paint(gfx::Canvas* canvas) { // Paint the track. gfx::Rect track_bounds = GetTrackBounds(); canvas->TileImageInt(*images_[THUMB_TRACK][thumb_track_state_], diff --git a/views/controls/scrollbar/bitmap_scroll_bar.h b/views/controls/scrollbar/bitmap_scroll_bar.h index 45e3535..904830e 100644 --- a/views/controls/scrollbar/bitmap_scroll_bar.h +++ b/views/controls/scrollbar/bitmap_scroll_bar.h @@ -95,7 +95,7 @@ class BitmapScrollBar : public ScrollBar, // View overrides: virtual gfx::Size GetPreferredSize(); - virtual void Paint(ChromeCanvas* canvas); + virtual void Paint(gfx::Canvas* canvas); virtual void Layout(); virtual bool OnMousePressed(const MouseEvent& event); virtual void OnMouseReleased(const MouseEvent& event, bool canceled); diff --git a/views/controls/single_split_view.cc b/views/controls/single_split_view.cc index 4558ffd..b40fca2 100644 --- a/views/controls/single_split_view.cc +++ b/views/controls/single_split_view.cc @@ -4,7 +4,7 @@ #include "views/controls/single_split_view.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "skia/ext/skia_utils_win.h" #include "views/background.h" diff --git a/views/controls/tabbed_pane.cc b/views/controls/tabbed_pane.cc index 04b7273..a162131 100644 --- a/views/controls/tabbed_pane.cc +++ b/views/controls/tabbed_pane.cc @@ -6,8 +6,8 @@ #include <vssym32.h> -#include "app/gfx/chrome_canvas.h" -#include "app/gfx/chrome_font.h" +#include "app/gfx/canvas.h" +#include "app/gfx/font.h" #include "app/l10n_util_win.h" #include "app/resource_bundle.h" #include "base/gfx/native_theme.h" @@ -37,7 +37,7 @@ class TabBackground : public Background { } virtual ~TabBackground() {} - virtual void Paint(ChromeCanvas* canvas, View* view) const { + virtual void Paint(gfx::Canvas* canvas, View* view) const { HDC dc = canvas->beginPlatformPaint(); RECT r = {0, 0, view->width(), view->height()}; gfx::NativeTheme::instance()->PaintTabPanelBackground(dc, &r); diff --git a/views/controls/table/group_table_view.cc b/views/controls/table/group_table_view.cc index b5d5698..5f26756 100644 --- a/views/controls/table/group_table_view.cc +++ b/views/controls/table/group_table_view.cc @@ -4,7 +4,7 @@ #include "views/controls/table/group_table_view.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "base/compiler_specific.h" #include "base/message_loop.h" #include "base/task.h" diff --git a/views/controls/table/table_view.cc b/views/controls/table/table_view.cc index a476da3..da4aeb04 100644 --- a/views/controls/table/table_view.cc +++ b/views/controls/table/table_view.cc @@ -11,7 +11,7 @@ #include <algorithm> -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "app/gfx/favicon_size.h" #include "app/gfx/icon_util.h" #include "app/l10n_util_win.h" @@ -866,7 +866,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). - ChromeCanvas canvas(kImageSize, kImageSize, false); + gfx::Canvas canvas(kImageSize, kImageSize, false); // Make the background completely transparent. canvas.drawColor(SK_ColorBLACK, SkPorterDuff::kClear_Mode); HICON empty_icon = @@ -1245,7 +1245,7 @@ LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) { client_rect.top += content_offset_; // Make sure the region need to paint is visible. if (intersection.IntersectRect(&icon_rect, &client_rect)) { - ChromeCanvas canvas(icon_rect.Width(), icon_rect.Height(), false); + gfx::Canvas canvas(icon_rect.Width(), icon_rect.Height(), false); // It seems the state in nmcd.uItemState is not correct. // We'll retrieve it explicitly. diff --git a/views/controls/text_field.h b/views/controls/text_field.h index c49c7d7..339580d 100644 --- a/views/controls/text_field.h +++ b/views/controls/text_field.h @@ -10,7 +10,7 @@ #include <string> -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "base/basictypes.h" #include "views/view.h" #include "third_party/skia/include/core/SkColor.h" diff --git a/views/controls/throbber.cc b/views/controls/throbber.cc index 5f10f1f..e15fcb3 100644 --- a/views/controls/throbber.cc +++ b/views/controls/throbber.cc @@ -4,7 +4,7 @@ #include "views/controls/throbber.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "app/resource_bundle.h" #include "base/time.h" #include "grit/theme_resources.h" @@ -66,7 +66,7 @@ gfx::Size Throbber::GetPreferredSize() { return gfx::Size(frames_->height(), frames_->height()); } -void Throbber::Paint(ChromeCanvas* canvas) { +void Throbber::Paint(gfx::Canvas* canvas) { if (!running_ && !paint_while_stopped_) return; @@ -140,7 +140,7 @@ void CheckmarkThrobber::SetChecked(bool checked) { } } -void CheckmarkThrobber::Paint(ChromeCanvas* canvas) { +void CheckmarkThrobber::Paint(gfx::Canvas* canvas) { if (running_) { // Let the throbber throb... Throbber::Paint(canvas); diff --git a/views/controls/throbber.h b/views/controls/throbber.h index bd0e67a..53d669f 100644 --- a/views/controls/throbber.h +++ b/views/controls/throbber.h @@ -31,7 +31,7 @@ class Throbber : public View { // overridden from View virtual gfx::Size GetPreferredSize(); - virtual void Paint(ChromeCanvas* canvas); + virtual void Paint(gfx::Canvas* canvas); protected: // Specifies whether the throbber is currently animating or not @@ -90,7 +90,7 @@ class CheckmarkThrobber : public Throbber { void SetChecked(bool checked); // Overridden from Throbber: - virtual void Paint(ChromeCanvas* canvas); + virtual void Paint(gfx::Canvas* canvas); private: static const int kFrameTimeMs = 30; diff --git a/views/controls/tree/tree_view.cc b/views/controls/tree/tree_view.cc index 39e6103..ceaa461 100644 --- a/views/controls/tree/tree_view.cc +++ b/views/controls/tree/tree_view.cc @@ -8,7 +8,7 @@ #include <atlapp.h> #include <atlmisc.h> -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "app/gfx/icon_util.h" #include "app/l10n_util.h" #include "app/l10n_util_win.h" @@ -684,13 +684,13 @@ LRESULT CALLBACK TreeView::TreeWndProc(HWND window, return 1; case WM_PAINT: { - ChromeCanvasPaint canvas(window); + gfx::CanvasPaint canvas(window); if (canvas.isEmpty()) return 0; HDC dc = canvas.beginPlatformPaint(); if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { - // ChromeCanvas ends up configuring the DC with a mode of GM_ADVANCED. + // gfx::Canvas ends up configuring the DC with a mode of GM_ADVANCED. // For some reason a graphics mode of ADVANCED triggers all the text // to be mirrored when RTL. Set the mode back to COMPATIBLE and // explicitly set the layout. Additionally SetWorldTransform and diff --git a/views/drag_utils.cc b/views/drag_utils.cc index 85498b7..17ba99b 100644 --- a/views/drag_utils.cc +++ b/views/drag_utils.cc @@ -8,8 +8,8 @@ #include <shlobj.h> #include <shobjidl.h> -#include "app/gfx/chrome_canvas.h" -#include "app/gfx/chrome_font.h" +#include "app/gfx/canvas.h" +#include "app/gfx/font.h" #include "app/l10n_util.h" #include "app/os_exchange_data.h" #include "app/resource_bundle.h" @@ -59,7 +59,7 @@ static void SetDragImageOnDataObject(HBITMAP hbitmap, // Blit the contents of the canvas to a new HBITMAP. It is the caller's // responsibility to release the |bits| buffer. -static HBITMAP CreateBitmapFromCanvas(const ChromeCanvas& canvas, +static HBITMAP CreateBitmapFromCanvas(const gfx::Canvas& canvas, int width, int height) { HDC screen_dc = GetDC(NULL); @@ -102,7 +102,7 @@ void SetURLAndDragImage(const GURL& url, button.SetBounds(0, 0, prefsize.width(), prefsize.height()); // Render the image. - ChromeCanvas canvas(prefsize.width(), prefsize.height(), false); + gfx::Canvas canvas(prefsize.width(), prefsize.height(), false); button.Paint(&canvas, true); SetDragImageOnDataObject(canvas, prefsize.width(), prefsize.height(), prefsize.width() / 2, prefsize.height() / 2, @@ -124,7 +124,7 @@ void CreateDragImageForFile(const std::wstring& file_name, // Add +2 here to allow room for the halo. const int height = font.height() + icon->height() + kLinkDragImageVPadding + 2; - ChromeCanvas canvas(width, height, false /* translucent */); + gfx::Canvas canvas(width, height, false /* translucent */); // Paint the icon. canvas.DrawBitmapInt(*icon, (width - icon->width()) / 2, 0); @@ -133,13 +133,13 @@ void CreateDragImageForFile(const std::wstring& file_name, canvas.DrawStringWithHalo(name, font, kFileDragImageTextColor, SK_ColorWHITE, 1, icon->height() + kLinkDragImageVPadding + 1, width - 2, font.height(), - ChromeCanvas::TEXT_ALIGN_CENTER); + gfx::Canvas::TEXT_ALIGN_CENTER); SetDragImageOnDataObject(canvas, width, height, width / 2, kLinkDragImageVPadding, data_object); } -void SetDragImageOnDataObject(const ChromeCanvas& canvas, +void SetDragImageOnDataObject(const gfx::Canvas& canvas, int width, int height, int cursor_x_offset, diff --git a/views/drag_utils.h b/views/drag_utils.h index 22855cfa..5cf68af8 100644 --- a/views/drag_utils.h +++ b/views/drag_utils.h @@ -8,7 +8,9 @@ #include <objidl.h> #include <string> -class ChromeCanvas; +namespace gfx { +class Canvas; +} class GURL; class OSExchangeData; class SkBitmap; @@ -33,7 +35,7 @@ void CreateDragImageForFile(const std::wstring& file_name, // Sets the drag image on data_object from the supplied canvas. width/height // are the size of the image to use, and the offsets give the location of // the hotspot for the drag image. -void SetDragImageOnDataObject(const ChromeCanvas& canvas, +void SetDragImageOnDataObject(const gfx::Canvas& canvas, int width, int height, int cursor_x_offset, diff --git a/views/painter.cc b/views/painter.cc index d44eef8..438c851 100644 --- a/views/painter.cc +++ b/views/painter.cc @@ -4,7 +4,7 @@ #include "views/painter.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "app/resource_bundle.h" #include "base/logging.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -25,7 +25,7 @@ class GradientPainter : public Painter { virtual ~GradientPainter() { } - void Paint(int w, int h, ChromeCanvas* canvas) { + void Paint(int w, int h, gfx::Canvas* canvas) { SkPaint paint; SkPoint p[2]; p[0].set(SkIntToScalar(0), SkIntToScalar(0)); @@ -58,7 +58,7 @@ class GradientPainter : public Painter { // static void Painter::PaintPainterAt(int x, int y, int w, int h, - ChromeCanvas* canvas, Painter* painter) { + gfx::Canvas* canvas, Painter* painter) { DCHECK(canvas && painter); if (w < 0 || h < 0) return; @@ -77,7 +77,7 @@ ImagePainter::ImagePainter(const int image_resource_names[], images_.push_back(rb.GetBitmapNamed(image_resource_names[i])); } -void ImagePainter::Paint(int w, int h, ChromeCanvas* canvas) { +void ImagePainter::Paint(int w, int h, gfx::Canvas* canvas) { canvas->DrawBitmapInt(*images_[BORDER_TOP_LEFT], 0, 0); canvas->TileImageInt(*images_[BORDER_TOP], images_[BORDER_TOP_LEFT]->width(), @@ -147,7 +147,7 @@ HorizontalPainter::HorizontalPainter(const int image_resource_names[]) { images_[LEFT]->height() == images_[CENTER]->height()); } -void HorizontalPainter::Paint(int w, int h, ChromeCanvas* canvas) { +void HorizontalPainter::Paint(int w, int h, gfx::Canvas* canvas) { if (w < (images_[LEFT]->width() + images_[CENTER]->width() + images_[RIGHT]->width())) { // No room to paint. diff --git a/views/painter.h b/views/painter.h index 71d5565..9cef45f 100644 --- a/views/painter.h +++ b/views/painter.h @@ -10,7 +10,9 @@ #include "base/basictypes.h" #include "third_party/skia/include/core/SkColor.h" -class ChromeCanvas; +namespace gfx { +class Canvas; +} class SkBitmap; namespace views { @@ -23,7 +25,7 @@ class Painter { // A convenience method for painting a Painter in a particular region. // This translates the canvas to x/y and paints the painter. static void PaintPainterAt(int x, int y, int w, int h, - ChromeCanvas* canvas, Painter* painter); + gfx::Canvas* canvas, Painter* painter); // Creates a painter that draws a gradient between the two colors. static Painter* CreateHorizontalGradient(SkColor c1, SkColor c2); @@ -32,7 +34,7 @@ class Painter { virtual ~Painter() {} // Paints the painter in the specified region. - virtual void Paint(int w, int h, ChromeCanvas* canvas) = 0; + virtual void Paint(int w, int h, gfx::Canvas* canvas) = 0; }; // ImagePainter paints 8 (or 9) images into a box. The four corner @@ -64,7 +66,7 @@ class ImagePainter : public Painter { virtual ~ImagePainter() {} // Paints the images. - virtual void Paint(int w, int h, ChromeCanvas* canvas); + virtual void Paint(int w, int h, gfx::Canvas* canvas); // Returns the specified image. The returned image should NOT be deleted. SkBitmap* GetImage(BorderElements element) { @@ -94,7 +96,7 @@ class HorizontalPainter : public Painter { virtual ~HorizontalPainter() {} // Paints the images. - virtual void Paint(int w, int h, ChromeCanvas* canvas); + virtual void Paint(int w, int h, gfx::Canvas* canvas); // Height of the images. int height() const { return height_; } diff --git a/views/view.cc b/views/view.cc index 5430a8f..e085f15 100644 --- a/views/view.cc +++ b/views/view.cc @@ -10,7 +10,7 @@ #endif #include "app/drag_drop_types.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "app/l10n_util.h" #include "base/logging.h" #include "base/message_loop.h" @@ -299,28 +299,28 @@ void View::SchedulePaint(int x, int y, int w, int h) { SchedulePaint(gfx::Rect(x, y, w, h), false); } -void View::Paint(ChromeCanvas* canvas) { +void View::Paint(gfx::Canvas* canvas) { PaintBackground(canvas); PaintFocusBorder(canvas); PaintBorder(canvas); } -void View::PaintBackground(ChromeCanvas* canvas) { +void View::PaintBackground(gfx::Canvas* canvas) { if (background_.get()) background_->Paint(canvas, this); } -void View::PaintBorder(ChromeCanvas* canvas) { +void View::PaintBorder(gfx::Canvas* canvas) { if (border_.get()) border_->Paint(*this, canvas); } -void View::PaintFocusBorder(ChromeCanvas* canvas) { +void View::PaintFocusBorder(gfx::Canvas* canvas) { if (HasFocus() && IsFocusable()) canvas->DrawFocusRect(0, 0, width(), height()); } -void View::PaintChildren(ChromeCanvas* canvas) { +void View::PaintChildren(gfx::Canvas* canvas) { int i, c; for (i = 0, c = GetChildViewCount(); i < c; ++i) { View* child = GetChildViewAt(i); @@ -332,7 +332,7 @@ void View::PaintChildren(ChromeCanvas* canvas) { } } -void View::ProcessPaint(ChromeCanvas* canvas) { +void View::ProcessPaint(gfx::Canvas* canvas) { if (!IsVisible()) { return; } diff --git a/views/view.h b/views/view.h index 16c1f35..8612248 100644 --- a/views/view.h +++ b/views/view.h @@ -24,11 +24,11 @@ struct IDataObject; #endif // defined(OS_WIN) namespace gfx { +class Canvas; class Insets; class Path; } -class ChromeCanvas; class OSExchangeData; class ViewAccessibilityWrapper; class ThemeProvider; @@ -288,19 +288,19 @@ class View : public AcceleratorTarget { ui_mirroring_is_enabled_for_rtl_languages_ = enable; } - // This method determines whether the ChromeCanvas object passed to + // This method determines whether the gfx::Canvas object passed to // View::Paint() needs to be transformed such that anything drawn on the // canvas object during View::Paint() is flipped horizontally. // // By default, this function returns false (which is the initial value of // |flip_canvas_on_paint_for_rtl_ui_|). View subclasses that need to paint on - // a flipped ChromeCanvas when the UI layout is right-to-left need to call + // a flipped gfx::Canvas when the UI layout is right-to-left need to call // EnableCanvasFlippingForRTLUI(). bool FlipCanvasOnPaintForRTLUI() const { return flip_canvas_on_paint_for_rtl_ui_ ? UILayoutIsRightToLeft() : false; } - // Enables or disables flipping of the ChromeCanvas during View::Paint(). + // Enables or disables flipping of the gfx::Canvas during View::Paint(). // Note that if canvas flipping is enabled, the canvas will be flipped only // if the UI layout is right-to-left; that is, the canvas will be flipped // only if UILayoutIsRightToLeft() returns true. @@ -368,21 +368,21 @@ class View : public AcceleratorTarget { // Default implementation paints the background if it is defined // // Override this method when implementing a new control. - virtual void Paint(ChromeCanvas* canvas); + virtual void Paint(gfx::Canvas* canvas); // Paint the background if any. This method is called by Paint() and // should rarely be invoked directly. - virtual void PaintBackground(ChromeCanvas* canvas); + virtual void PaintBackground(gfx::Canvas* canvas); // Paint the border if any. This method is called by Paint() and // should rarely be invoked directly. - virtual void PaintBorder(ChromeCanvas* canvas); + virtual void PaintBorder(gfx::Canvas* canvas); // Paints the focus border (only if the view has the focus). // This method is called by Paint() and should rarely be invoked directly. // The default implementation paints a gray border around the view. Override // it for custom focus effects. - virtual void PaintFocusBorder(ChromeCanvas* canvas); + virtual void PaintFocusBorder(gfx::Canvas* canvas); // Paint this View immediately. virtual void PaintNow(); @@ -786,10 +786,10 @@ class View : public AcceleratorTarget { // inside a custom graphics. // To customize painting override either the Paint or PaintChildren method, // not this one. - virtual void ProcessPaint(ChromeCanvas* canvas); + virtual void ProcessPaint(gfx::Canvas* canvas); // Paint the View's child Views, in reverse order. - virtual void PaintChildren(ChromeCanvas* canvas); + virtual void PaintChildren(gfx::Canvas* canvas); // Sets the ContextMenuController. Setting this to non-null makes the View // process mouse events. @@ -1199,7 +1199,7 @@ class View : public AcceleratorTarget { // language like Arabic or Hebrew. bool ui_mirroring_is_enabled_for_rtl_languages_; - // Indicates whether or not the ChromeCanvas object passed to View::Paint() + // Indicates whether or not the gfx::Canvas object passed to View::Paint() // is going to be flipped horizontally (using the appropriate transform) on // right-to-left locales for this View. bool flip_canvas_on_paint_for_rtl_ui_; diff --git a/views/view_unittest.cc b/views/view_unittest.cc index 11d5821..b5377eb 100644 --- a/views/view_unittest.cc +++ b/views/view_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "app/gfx/path.h" #include "base/clipboard.h" #include "base/message_loop.h" @@ -48,7 +48,7 @@ void PaintRootView(views::RootView* root, bool empty_paint) { // User isn't logged in, so that PaintNow will generate an empty rectangle. // Invoke paint directly. gfx::Rect paint_rect = root->GetScheduledPaintRect(); - ChromeCanvas canvas(paint_rect.width(), paint_rect.height(), true); + gfx::Canvas canvas(paint_rect.width(), paint_rect.height(), true); canvas.TranslateInt(-paint_rect.x(), -paint_rect.y()); canvas.ClipRectInt(0, 0, paint_rect.width(), paint_rect.height()); root->ProcessPaint(&canvas); @@ -131,7 +131,7 @@ class TestView : public View { virtual bool OnMousePressed(const MouseEvent& event); virtual bool OnMouseDragged(const MouseEvent& event); virtual void OnMouseReleased(const MouseEvent& event, bool canceled); - virtual void Paint(ChromeCanvas* canvas); + virtual void Paint(gfx::Canvas* canvas); // DidChangeBounds test bool did_change_bounds_; @@ -350,7 +350,7 @@ TEST_F(ViewTest, MouseEvent) { // Painting //////////////////////////////////////////////////////////////////////////////// -void TestView::Paint(ChromeCanvas* canvas) { +void TestView::Paint(gfx::Canvas* canvas) { canvas->getClipBounds(&last_clip_); } diff --git a/views/view_win.cc b/views/view_win.cc index 6dfe183..92a6396 100644 --- a/views/view_win.cc +++ b/views/view_win.cc @@ -5,7 +5,7 @@ #include "views/view.h" #include "app/drag_drop_types.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "app/gfx/path.h" #include "app/os_exchange_data.h" #include "base/scoped_handle.h" diff --git a/views/widget/root_view.cc b/views/widget/root_view.cc index bc012c8..fb64756 100644 --- a/views/widget/root_view.cc +++ b/views/widget/root_view.cc @@ -7,7 +7,7 @@ #include <algorithm> #include "app/drag_drop_types.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #if defined(OS_WIN) #include "base/base_drag_source.h" #endif @@ -147,7 +147,7 @@ class ScopedProcessingPaint { }; #endif -void RootView::ProcessPaint(ChromeCanvas* canvas) { +void RootView::ProcessPaint(gfx::Canvas* canvas) { #ifndef NDEBUG ScopedProcessingPaint processing_paint(&is_processing_paint_); #endif diff --git a/views/widget/root_view.h b/views/widget/root_view.h index 1ebb3e1..ae73eef 100644 --- a/views/widget/root_view.h +++ b/views/widget/root_view.h @@ -65,7 +65,7 @@ class RootView : public View, virtual void SchedulePaint(int x, int y, int w, int h); // Paint this RootView and its child Views. - virtual void ProcessPaint(ChromeCanvas* canvas); + virtual void ProcessPaint(gfx::Canvas* canvas); // If the invalid rect is non-empty and there is a pending paint the RootView // is painted immediately. This is internally invoked as the result of diff --git a/views/widget/root_view_gtk.cc b/views/widget/root_view_gtk.cc index 61bb5f5..9010960 100644 --- a/views/widget/root_view_gtk.cc +++ b/views/widget/root_view_gtk.cc @@ -6,7 +6,7 @@ #include <gtk/gtk.h> -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "base/logging.h" #include "third_party/skia/include/core/SkColor.h" @@ -17,7 +17,7 @@ void RootView::UpdateCursor(const MouseEvent& e) { } void RootView::OnPaint(GdkEventExpose* event) { - ChromeCanvasPaint canvas(event); + gfx::CanvasPaint canvas(event); if (!canvas.isEmpty()) { SchedulePaint(gfx::Rect(canvas.rectangle()), false); diff --git a/views/widget/root_view_win.cc b/views/widget/root_view_win.cc index ac4a50d..14ca68a6 100644 --- a/views/widget/root_view_win.cc +++ b/views/widget/root_view_win.cc @@ -5,7 +5,7 @@ #include "views/widget/root_view.h" #include "app/drag_drop_types.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "base/base_drag_source.h" #include "base/logging.h" #include "views/widget/root_view_drop_target.h" @@ -40,7 +40,7 @@ void RootView::OnPaint(HWND hwnd) { RECT win_version = original_dirty_region.ToRECT(); InvalidateRect(hwnd, &win_version, FALSE); } - ChromeCanvasPaint canvas(hwnd); + gfx::CanvasPaint canvas(hwnd); if (!canvas.isEmpty()) { const PAINTSTRUCT& ps = canvas.paintStruct(); SchedulePaint(gfx::Rect(ps.rcPaint), false); diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index 5da1b63..e58978f 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -4,7 +4,7 @@ #include "views/widget/widget_win.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "app/win_util.h" #include "base/gfx/native_theme.h" #include "base/string_util.h" @@ -898,9 +898,9 @@ Window* WidgetWin::GetWindowImpl(HWND hwnd) { } void WidgetWin::SizeContents(const CRect& window_rect) { - contents_.reset(new ChromeCanvas(window_rect.Width(), - window_rect.Height(), - false)); + contents_.reset(new gfx::Canvas(window_rect.Width(), + window_rect.Height(), + false)); } void WidgetWin::PaintLayeredWindow() { diff --git a/views/widget/widget_win.h b/views/widget/widget_win.h index b39362f..ae846aa 100644 --- a/views/widget/widget_win.h +++ b/views/widget/widget_win.h @@ -16,9 +16,8 @@ #include "views/layout_manager.h" #include "views/widget/widget.h" -class ChromeCanvas; - namespace gfx { +class Canvas; class Rect; } @@ -608,7 +607,7 @@ class WidgetWin : public Widget, // A canvas that contains the window contents in the case of a layered // window. - scoped_ptr<ChromeCanvas> contents_; + scoped_ptr<gfx::Canvas> contents_; // Whether or not the window should delete itself when it is destroyed. // Set this to false via its setter for stack allocated instances. diff --git a/views/window/custom_frame_view.cc b/views/window/custom_frame_view.cc index f7f9ab3..2869c07 100644 --- a/views/window/custom_frame_view.cc +++ b/views/window/custom_frame_view.cc @@ -4,8 +4,8 @@ #include "views/window/custom_frame_view.h" -#include "app/gfx/chrome_canvas.h" -#include "app/gfx/chrome_font.h" +#include "app/gfx/canvas.h" +#include "app/gfx/font.h" #include "app/gfx/path.h" #include "app/resource_bundle.h" #include "app/theme_provider.h" @@ -210,7 +210,7 @@ void CustomFrameView::ResetWindowControls() { /////////////////////////////////////////////////////////////////////////////// // CustomFrameView, View overrides: -void CustomFrameView::Paint(ChromeCanvas* canvas) { +void CustomFrameView::Paint(gfx::Canvas* canvas) { if (frame_->IsMaximized()) PaintMaximizedFrameBorder(canvas); else @@ -295,7 +295,7 @@ int CustomFrameView::TitleCoordinates(int* title_top_spacing, BottomEdgeThicknessWithinNonClientHeight(); } -void CustomFrameView::PaintRestoredFrameBorder(ChromeCanvas* canvas) { +void CustomFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) { // Window frame mode. ResourceBundle& rb = ResourceBundle::GetSharedInstance(); @@ -373,7 +373,7 @@ void CustomFrameView::PaintRestoredFrameBorder(ChromeCanvas* canvas) { } void CustomFrameView::PaintMaximizedFrameBorder( - ChromeCanvas* canvas) { + gfx::Canvas* canvas) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); SkBitmap* top_edge = rb.GetBitmapNamed(IDR_WINDOW_TOP_CENTER); @@ -388,7 +388,7 @@ void CustomFrameView::PaintMaximizedFrameBorder( frame_->GetClientView()->y() - edge_height, width(), edge_height); } -void CustomFrameView::PaintTitleBar(ChromeCanvas* canvas) { +void CustomFrameView::PaintTitleBar(gfx::Canvas* canvas) { WindowDelegate* d = frame_->GetDelegate(); // It seems like in some conditions we can be asked to paint after the window @@ -402,7 +402,7 @@ void CustomFrameView::PaintTitleBar(ChromeCanvas* canvas) { title_bounds_.width(), title_bounds_.height()); } -void CustomFrameView::PaintRestoredClientEdge(ChromeCanvas* canvas) { +void CustomFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { gfx::Rect client_area_bounds = frame_->GetClientView()->bounds(); int client_area_top = client_area_bounds.y(); diff --git a/views/window/custom_frame_view.h b/views/window/custom_frame_view.h index 0c41009..bee9e62 100644 --- a/views/window/custom_frame_view.h +++ b/views/window/custom_frame_view.h @@ -11,12 +11,12 @@ #include "views/window/window_resources.h" namespace gfx{ +class Canvas; class Font; class Size; class Path; class Point; } -class ChromeCanvas; namespace views { @@ -45,7 +45,7 @@ class CustomFrameView : public NonClientFrameView, virtual void ResetWindowControls(); // View overrides: - virtual void Paint(ChromeCanvas* canvas); + virtual void Paint(gfx::Canvas* canvas); virtual void Layout(); virtual gfx::Size GetPreferredSize(); @@ -75,10 +75,10 @@ class CustomFrameView : public NonClientFrameView, int* title_thickness) const; // Paint various sub-components of this view. - void PaintRestoredFrameBorder(ChromeCanvas* canvas); - void PaintMaximizedFrameBorder(ChromeCanvas* canvas); - void PaintTitleBar(ChromeCanvas* canvas); - void PaintRestoredClientEdge(ChromeCanvas* canvas); + void PaintRestoredFrameBorder(gfx::Canvas* canvas); + void PaintMaximizedFrameBorder(gfx::Canvas* canvas); + void PaintTitleBar(gfx::Canvas* canvas); + void PaintRestoredClientEdge(gfx::Canvas* canvas); // Layout various sub-components of this view. void LayoutWindowControls(); diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc index 9e25462..978d45a 100644 --- a/views/window/dialog_client_view.cc +++ b/views/window/dialog_client_view.cc @@ -8,8 +8,8 @@ #include <uxtheme.h> #include <vsstyle.h> -#include "app/gfx/chrome_canvas.h" -#include "app/gfx/chrome_font.h" +#include "app/gfx/canvas.h" +#include "app/gfx/font.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/gfx/native_theme.h" @@ -34,7 +34,7 @@ void UpdateButtonHelper(NativeButton* button_view, button_view->SetVisible(delegate->IsDialogButtonVisible(button)); } -void FillViewWithSysColor(ChromeCanvas* canvas, View* view, COLORREF color) { +void FillViewWithSysColor(gfx::Canvas* canvas, View* view, COLORREF color) { SkColor sk_color = SkColorSetRGB(GetRValue(color), GetGValue(color), GetBValue(color)); canvas->FillRectInt(sk_color, 0, 0, view->width(), view->height()); @@ -250,11 +250,11 @@ int DialogClientView::NonClientHitTest(const gfx::Point& point) { //////////////////////////////////////////////////////////////////////////////// // DialogClientView, View overrides: -void DialogClientView::Paint(ChromeCanvas* canvas) { +void DialogClientView::Paint(gfx::Canvas* canvas) { FillViewWithSysColor(canvas, this, GetSysColor(COLOR_3DFACE)); } -void DialogClientView::PaintChildren(ChromeCanvas* canvas) { +void DialogClientView::PaintChildren(gfx::Canvas* canvas) { View::PaintChildren(canvas); if (!window()->IsMaximized() && !window()->IsMinimized()) PaintSizeBox(canvas); @@ -347,7 +347,7 @@ void DialogClientView::ButtonPressed(Button* sender) { //////////////////////////////////////////////////////////////////////////////// // DialogClientView, private: -void DialogClientView::PaintSizeBox(ChromeCanvas* canvas) { +void DialogClientView::PaintSizeBox(gfx::Canvas* canvas) { if (window()->GetDelegate()->CanResize() || window()->GetDelegate()->CanMaximize()) { HDC dc = canvas->beginPlatformPaint(); diff --git a/views/window/dialog_client_view.h b/views/window/dialog_client_view.h index c1e6ed8..ecb9449 100644 --- a/views/window/dialog_client_view.h +++ b/views/window/dialog_client_view.h @@ -5,7 +5,7 @@ #ifndef VIEWS_WINDOW_DIALOG_CLIENT_VIEW_H_ #define VIEWS_WINDOW_DIALOG_CLIENT_VIEW_H_ -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "views/focus/focus_manager.h" #include "views/controls/button/button.h" #include "views/window/client_view.h" @@ -61,8 +61,8 @@ class DialogClientView : public ClientView, protected: // View overrides: - virtual void Paint(ChromeCanvas* canvas); - virtual void PaintChildren(ChromeCanvas* canvas); + virtual void Paint(gfx::Canvas* canvas); + virtual void PaintChildren(gfx::Canvas* canvas); virtual void Layout(); virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); virtual gfx::Size GetPreferredSize(); @@ -74,7 +74,7 @@ class DialogClientView : public ClientView, private: // Paint the size box in the bottom right corner of the window if it is // resizable. - void PaintSizeBox(ChromeCanvas* canvas); + void PaintSizeBox(gfx::Canvas* canvas); // Returns the width of the specified dialog button using the correct font. int GetButtonWidth(int button) const; diff --git a/views/window/window_win.cc b/views/window/window_win.cc index 9c06e21..78fa32e 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -6,8 +6,8 @@ #include <shellapi.h> -#include "app/gfx/chrome_canvas.h" -#include "app/gfx/chrome_font.h" +#include "app/gfx/canvas.h" +#include "app/gfx/font.h" #include "app/gfx/icon_util.h" #include "app/gfx/path.h" #include "app/l10n_util.h" @@ -862,11 +862,11 @@ void WindowWin::OnNCPaint(HRGN rgn) { root_view->SchedulePaint(gfx::Rect(dirty_region), false); - // ChromeCanvasPaints destructor does the actual painting. As such, wrap the + // gfx::CanvasPaints destructor does the actual painting. As such, wrap the // following in a block to force paint to occur so that we can release the dc. { - ChromeCanvasPaint canvas(dc, opaque(), dirty_region.left, dirty_region.top, - dirty_region.Width(), dirty_region.Height()); + gfx::CanvasPaint canvas(dc, opaque(), dirty_region.left, dirty_region.top, + dirty_region.Width(), dirty_region.Height()); root_view->ProcessPaint(&canvas); } |