diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-11 14:55:52 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-11 14:55:52 +0000 |
commit | 885038e916c81e9308a88de23f797e8371f9c2a0 (patch) | |
tree | 4344f3691e246c4fddbea756f827e2c80d94e6fa | |
parent | 11f595b2430eaa775245f7d7c24babf5a3e6fa09 (diff) | |
download | chromium_src-885038e916c81e9308a88de23f797e8371f9c2a0.zip chromium_src-885038e916c81e9308a88de23f797e8371f9c2a0.tar.gz chromium_src-885038e916c81e9308a88de23f797e8371f9c2a0.tar.bz2 |
Eliminate skia::PlatformCanvas - Step 1 (linux)
Patch corresponding to r80955 on linux.
Review URL: http://codereview.chromium.org/6813050
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81099 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ui/gfx/native_theme.h | 6 | ||||
-rw-r--r-- | ui/gfx/native_theme_chromeos.cc | 24 | ||||
-rw-r--r-- | ui/gfx/native_theme_chromeos.h | 24 | ||||
-rw-r--r-- | ui/gfx/native_theme_linux.cc | 30 | ||||
-rw-r--r-- | ui/gfx/native_theme_linux.h | 34 | ||||
-rw-r--r-- | ui/gfx/native_theme_win.cc | 6 | ||||
-rw-r--r-- | ui/gfx/native_theme_win.h | 2 | ||||
-rw-r--r-- | webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc | 6 |
8 files changed, 62 insertions, 70 deletions
diff --git a/ui/gfx/native_theme.h b/ui/gfx/native_theme.h index e3e66a6..77a9f04 100644 --- a/ui/gfx/native_theme.h +++ b/ui/gfx/native_theme.h @@ -9,10 +9,6 @@ #include "skia/ext/platform_canvas.h" #include "ui/gfx/native_widget_types.h" -namespace skia { -class PlatformCanvas; -} - namespace gfx { class Rect; @@ -131,7 +127,7 @@ class NativeTheme { virtual Size GetPartSize(Part part) const = 0; // Paint the part to the canvas. - virtual void Paint(skia::PlatformCanvas* canvas, + virtual void Paint(SkCanvas* canvas, Part part, State state, const gfx::Rect& rect, diff --git a/ui/gfx/native_theme_chromeos.cc b/ui/gfx/native_theme_chromeos.cc index 3a4b397..e286d27 100644 --- a/ui/gfx/native_theme_chromeos.cc +++ b/ui/gfx/native_theme_chromeos.cc @@ -296,7 +296,7 @@ gfx::Size NativeThemeChromeos::GetPartSize(Part part) const { } void NativeThemeChromeos::PaintScrollbarTrack( - skia::PlatformCanvas* canvas, + SkCanvas* canvas, Part part, State state, const ScrollbarTrackExtraParams& extra_params, @@ -342,7 +342,7 @@ void NativeThemeChromeos::PaintScrollbarTrack( } } -void NativeThemeChromeos::PaintScrollbarThumb(skia::PlatformCanvas* canvas, +void NativeThemeChromeos::PaintScrollbarThumb(SkCanvas* canvas, Part part, State state, const gfx::Rect& rect) const { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); int resource_id = IDR_SCROLL_THUMB; @@ -387,7 +387,7 @@ void NativeThemeChromeos::PaintScrollbarThumb(skia::PlatformCanvas* canvas, } } -void NativeThemeChromeos::PaintArrowButton(skia::PlatformCanvas* canvas, +void NativeThemeChromeos::PaintArrowButton(SkCanvas* canvas, const gfx::Rect& rect, Part part, State state) const { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); int resource_id = @@ -407,7 +407,7 @@ void NativeThemeChromeos::PaintArrowButton(skia::PlatformCanvas* canvas, rect.x(), rect.y(), rect.width(), rect.height()); } -void NativeThemeChromeos::PaintCheckbox(skia::PlatformCanvas* canvas, +void NativeThemeChromeos::PaintCheckbox(SkCanvas* canvas, State state, const gfx::Rect& rect, const ButtonExtraParams& button) const { PaintButtonLike(canvas, state, rect, true); @@ -428,7 +428,7 @@ void NativeThemeChromeos::PaintCheckbox(skia::PlatformCanvas* canvas, } } -void NativeThemeChromeos::PaintRadio(skia::PlatformCanvas* canvas, +void NativeThemeChromeos::PaintRadio(SkCanvas* canvas, State state, const gfx::Rect& rect, const ButtonExtraParams& button) const { @@ -461,14 +461,14 @@ void NativeThemeChromeos::PaintRadio(skia::PlatformCanvas* canvas, } } -void NativeThemeChromeos::PaintButton(skia::PlatformCanvas* canvas, +void NativeThemeChromeos::PaintButton(SkCanvas* canvas, State state, const gfx::Rect& rect, const ButtonExtraParams& button) const { PaintButtonLike(canvas, state, rect, button.has_border); } -void NativeThemeChromeos::PaintTextField(skia::PlatformCanvas* canvas, +void NativeThemeChromeos::PaintTextField(SkCanvas* canvas, State state, const gfx::Rect& rect, const TextFieldExtraParams& text) const { @@ -515,7 +515,7 @@ void NativeThemeChromeos::PaintTextField(skia::PlatformCanvas* canvas, canvas->drawPath(border, stroke_paint); } -void NativeThemeChromeos::PaintSliderTrack(skia::PlatformCanvas* canvas, +void NativeThemeChromeos::PaintSliderTrack(SkCanvas* canvas, State state, const gfx::Rect& rect, const SliderExtraParams& slider) const { @@ -548,7 +548,7 @@ void NativeThemeChromeos::PaintSliderTrack(skia::PlatformCanvas* canvas, canvas->drawPath(border, stroke_paint); } -void NativeThemeChromeos::PaintSliderThumb(skia::PlatformCanvas* canvas, +void NativeThemeChromeos::PaintSliderThumb(SkCanvas* canvas, State state, const gfx::Rect& rect, const SliderExtraParams& slider) const { @@ -558,7 +558,7 @@ void NativeThemeChromeos::PaintSliderThumb(skia::PlatformCanvas* canvas, PaintButtonLike(canvas, state, rect, true); } -void NativeThemeChromeos::PaintInnerSpinButton(skia::PlatformCanvas* canvas, +void NativeThemeChromeos::PaintInnerSpinButton(SkCanvas* canvas, State state, const gfx::Rect& rect, const InnerSpinButtonExtraParams& spin_button) const { @@ -569,7 +569,7 @@ void NativeThemeChromeos::PaintInnerSpinButton(skia::PlatformCanvas* canvas, NativeThemeLinux::PaintInnerSpinButton(canvas, state, bounds, spin_button); } -void NativeThemeChromeos::PaintProgressBar(skia::PlatformCanvas* canvas, +void NativeThemeChromeos::PaintProgressBar(SkCanvas* canvas, State state, const gfx::Rect& rect, const ProgressBarExtraParams& progress_bar) const { @@ -696,7 +696,7 @@ SkBitmap* NativeThemeChromeos::GetHorizontalBitmapNamed(int resource_id) const { return NULL; } -void NativeThemeChromeos::PaintButtonLike(skia::PlatformCanvas* canvas, +void NativeThemeChromeos::PaintButtonLike(SkCanvas* canvas, State state, const gfx::Rect& rect, bool stroke_border) const { SkPath border; GetRoundRectPath(rect, kBorderCornerRadius, &border); diff --git a/ui/gfx/native_theme_chromeos.h b/ui/gfx/native_theme_chromeos.h index 97d1606..7f5ab16 100644 --- a/ui/gfx/native_theme_chromeos.h +++ b/ui/gfx/native_theme_chromeos.h @@ -21,58 +21,58 @@ class NativeThemeChromeos : public gfx::NativeThemeLinux { virtual gfx::Size GetPartSize(Part part) const OVERRIDE; // NativeThemeLinux overrides - virtual void PaintScrollbarTrack(skia::PlatformCanvas* canvas, + virtual void PaintScrollbarTrack(SkCanvas* canvas, Part part, State state, const ScrollbarTrackExtraParams& extra_params, const gfx::Rect& rect) const OVERRIDE; - virtual void PaintArrowButton(skia::PlatformCanvas* canvas, + virtual void PaintArrowButton(SkCanvas* canvas, const gfx::Rect& rect, Part direction, State state) const OVERRIDE; - virtual void PaintScrollbarThumb(skia::PlatformCanvas* canvas, + virtual void PaintScrollbarThumb(SkCanvas* canvas, Part part, State state, const gfx::Rect& rect) const OVERRIDE; // Draw the checkbox. - virtual void PaintCheckbox(skia::PlatformCanvas* canvas, + virtual void PaintCheckbox(SkCanvas* canvas, State state, const gfx::Rect& rect, const ButtonExtraParams& button) const OVERRIDE; // Draw the radio. - virtual void PaintRadio(skia::PlatformCanvas* canvas, + virtual void PaintRadio(SkCanvas* canvas, State state, const gfx::Rect& rect, const ButtonExtraParams& button) const OVERRIDE; // Draw the push button. - virtual void PaintButton(skia::PlatformCanvas* canvas, + virtual void PaintButton(SkCanvas* canvas, State state, const gfx::Rect& rect, const ButtonExtraParams& button) const OVERRIDE; // Draw the text field. - virtual void PaintTextField(skia::PlatformCanvas* canvas, + virtual void PaintTextField(SkCanvas* canvas, State state, const gfx::Rect& rect, const TextFieldExtraParams& text) const OVERRIDE; // Draw the slider track. - virtual void PaintSliderTrack(skia::PlatformCanvas* canvas, + virtual void PaintSliderTrack(SkCanvas* canvas, State state, const gfx::Rect& rect, const SliderExtraParams& slider) const OVERRIDE; // Draw the slider thumb. - virtual void PaintSliderThumb(skia::PlatformCanvas* canvas, + virtual void PaintSliderThumb(SkCanvas* canvas, State state, const gfx::Rect& rect, const SliderExtraParams& slider) const OVERRIDE; // Draw the inner spin button. - virtual void PaintInnerSpinButton(skia::PlatformCanvas* canvas, + virtual void PaintInnerSpinButton(SkCanvas* canvas, State state, const gfx::Rect& rect, const InnerSpinButtonExtraParams& spin_button) const OVERRIDE; // Draw the progress bar. - virtual void PaintProgressBar(skia::PlatformCanvas* canvas, + virtual void PaintProgressBar(SkCanvas* canvas, State state, const gfx::Rect& rect, const ProgressBarExtraParams& progress_bar) const OVERRIDE; @@ -80,7 +80,7 @@ class NativeThemeChromeos : public gfx::NativeThemeLinux { SkBitmap* GetHorizontalBitmapNamed(int resource_id) const; // Paint a button like rounded rect with gradient background and stroke. - void PaintButtonLike(skia::PlatformCanvas* canvas, + void PaintButtonLike(SkCanvas* canvas, State state, const gfx::Rect& rect, bool stroke_border) const; // Cached images. Resource loader caches all retrieved bitmaps and keeps diff --git a/ui/gfx/native_theme_linux.cc b/ui/gfx/native_theme_linux.cc index 5a81c4c..95259d0 100644 --- a/ui/gfx/native_theme_linux.cc +++ b/ui/gfx/native_theme_linux.cc @@ -109,7 +109,7 @@ gfx::Size NativeThemeLinux::GetPartSize(Part part) const { } void NativeThemeLinux::PaintArrowButton( - skia::PlatformCanvas* canvas, + SkCanvas* canvas, const gfx::Rect& rect, Part direction, State state) const { int widthMiddle, lengthMiddle; SkPaint paint; @@ -234,7 +234,7 @@ void NativeThemeLinux::PaintArrowButton( canvas->drawPath(path, paint); } -void NativeThemeLinux::Paint(skia::PlatformCanvas* canvas, +void NativeThemeLinux::Paint(SkCanvas* canvas, Part part, State state, const gfx::Rect& rect, @@ -287,7 +287,7 @@ void NativeThemeLinux::Paint(skia::PlatformCanvas* canvas, } } -void NativeThemeLinux::PaintScrollbarTrack(skia::PlatformCanvas* canvas, +void NativeThemeLinux::PaintScrollbarTrack(SkCanvas* canvas, Part part, State state, const ScrollbarTrackExtraParams& extra_params, @@ -308,7 +308,7 @@ void NativeThemeLinux::PaintScrollbarTrack(skia::PlatformCanvas* canvas, DrawBox(canvas, rect, paint); } -void NativeThemeLinux::PaintScrollbarThumb(skia::PlatformCanvas* canvas, +void NativeThemeLinux::PaintScrollbarThumb(SkCanvas* canvas, Part part, State state, const gfx::Rect& rect) const { @@ -387,7 +387,7 @@ void NativeThemeLinux::PaintScrollbarThumb(skia::PlatformCanvas* canvas, } } -void NativeThemeLinux::PaintCheckbox(skia::PlatformCanvas* canvas, +void NativeThemeLinux::PaintCheckbox(SkCanvas* canvas, State state, const gfx::Rect& rect, const ButtonExtraParams& button) const { @@ -412,7 +412,7 @@ void NativeThemeLinux::PaintCheckbox(skia::PlatformCanvas* canvas, bounds.x(), bounds.y(), bounds.width(), bounds.height()); } -void NativeThemeLinux::PaintRadio(skia::PlatformCanvas* canvas, +void NativeThemeLinux::PaintRadio(SkCanvas* canvas, State state, const gfx::Rect& rect, const ButtonExtraParams& button) const { @@ -433,7 +433,7 @@ void NativeThemeLinux::PaintRadio(skia::PlatformCanvas* canvas, bounds.x(), bounds.y(), bounds.width(), bounds.height()); } -void NativeThemeLinux::PaintButton(skia::PlatformCanvas* canvas, +void NativeThemeLinux::PaintButton(SkCanvas* canvas, State state, const gfx::Rect& rect, const ButtonExtraParams& button) const { @@ -502,7 +502,7 @@ void NativeThemeLinux::PaintButton(skia::PlatformCanvas* canvas, } } -void NativeThemeLinux::PaintTextField(skia::PlatformCanvas* canvas, +void NativeThemeLinux::PaintTextField(SkCanvas* canvas, State state, const gfx::Rect& rect, const TextFieldExtraParams& text) const { @@ -593,7 +593,7 @@ void NativeThemeLinux::PaintTextField(skia::PlatformCanvas* canvas, } void NativeThemeLinux::PaintMenuList( - skia::PlatformCanvas* canvas, + SkCanvas* canvas, State state, const gfx::Rect& rect, const MenuListExtraParams& menu_list) const { @@ -619,7 +619,7 @@ void NativeThemeLinux::PaintMenuList( canvas->drawPath(path, paint); } -void NativeThemeLinux::PaintSliderTrack(skia::PlatformCanvas* canvas, +void NativeThemeLinux::PaintSliderTrack(SkCanvas* canvas, State state, const gfx::Rect& rect, const SliderExtraParams& slider) const { @@ -644,7 +644,7 @@ void NativeThemeLinux::PaintSliderTrack(skia::PlatformCanvas* canvas, canvas->drawRect(skrect, paint); } -void NativeThemeLinux::PaintSliderThumb(skia::PlatformCanvas* canvas, +void NativeThemeLinux::PaintSliderThumb(SkCanvas* canvas, State state, const gfx::Rect& rect, const SliderExtraParams& slider) const { @@ -682,7 +682,7 @@ void NativeThemeLinux::PaintSliderThumb(skia::PlatformCanvas* canvas, } } -void NativeThemeLinux::PaintInnerSpinButton(skia::PlatformCanvas* canvas, +void NativeThemeLinux::PaintInnerSpinButton(SkCanvas* canvas, State state, const gfx::Rect& rect, const InnerSpinButtonExtraParams& spin_button) const { @@ -704,7 +704,7 @@ void NativeThemeLinux::PaintInnerSpinButton(skia::PlatformCanvas* canvas, PaintArrowButton(canvas, half, kScrollbarDownArrow, south_state); } -void NativeThemeLinux::PaintProgressBar(skia::PlatformCanvas* canvas, +void NativeThemeLinux::PaintProgressBar(SkCanvas* canvas, State state, const gfx::Rect& rect, const ProgressBarExtraParams& progress_bar) const { @@ -757,7 +757,7 @@ void NativeThemeLinux::PaintProgressBar(skia::PlatformCanvas* canvas, } bool NativeThemeLinux::IntersectsClipRectInt( - skia::PlatformCanvas* canvas, int x, int y, int w, int h) const { + SkCanvas* canvas, int x, int y, int w, int h) const { SkRect clip; return canvas->getClipBounds(&clip) && clip.intersect(SkIntToScalar(x), SkIntToScalar(y), SkIntToScalar(x + w), @@ -796,7 +796,7 @@ void NativeThemeLinux::DrawBox(SkCanvas* canvas, } void NativeThemeLinux::DrawBitmapInt( - skia::PlatformCanvas* canvas, const SkBitmap& bitmap, + SkCanvas* canvas, const SkBitmap& bitmap, int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y, int dest_w, int dest_h) const { DLOG_ASSERT(src_x + src_w < std::numeric_limits<int16_t>::max() && diff --git a/ui/gfx/native_theme_linux.h b/ui/gfx/native_theme_linux.h index 2b117c1..bc7ce36 100644 --- a/ui/gfx/native_theme_linux.h +++ b/ui/gfx/native_theme_linux.h @@ -9,10 +9,6 @@ #include "skia/ext/platform_canvas.h" #include "ui/gfx/native_theme.h" -namespace skia { -class PlatformCanvas; -} - namespace gfx { class Rect; class Size; @@ -25,7 +21,7 @@ class NativeThemeLinux : public NativeTheme { // NativeTheme implementation: virtual gfx::Size GetPartSize(Part part) const; - virtual void Paint(skia::PlatformCanvas* canvas, + virtual void Paint(SkCanvas* canvas, Part part, State state, const gfx::Rect& rect, @@ -37,73 +33,73 @@ class NativeThemeLinux : public NativeTheme { // Draw the arrow. Used by scrollbar and inner spin button. virtual void PaintArrowButton( - skia::PlatformCanvas* gc, + SkCanvas* gc, const gfx::Rect& rect, Part direction, State state) const; // Paint the scrollbar track. Done before the thumb so that it can contain // alpha. - virtual void PaintScrollbarTrack(skia::PlatformCanvas* canvas, + virtual void PaintScrollbarTrack(SkCanvas* canvas, Part part, State state, const ScrollbarTrackExtraParams& extra_params, const gfx::Rect& rect) const; // Draw the scrollbar thumb over the track. - virtual void PaintScrollbarThumb(skia::PlatformCanvas* canvas, + virtual void PaintScrollbarThumb(SkCanvas* canvas, Part part, State state, const gfx::Rect& rect) const; // Draw the checkbox. - virtual void PaintCheckbox(skia::PlatformCanvas* canvas, + virtual void PaintCheckbox(SkCanvas* canvas, State state, const gfx::Rect& rect, const ButtonExtraParams& button) const; // Draw the radio. - virtual void PaintRadio(skia::PlatformCanvas* canvas, + virtual void PaintRadio(SkCanvas* canvas, State state, const gfx::Rect& rect, const ButtonExtraParams& button) const; // Draw the push button. - virtual void PaintButton(skia::PlatformCanvas* canvas, + virtual void PaintButton(SkCanvas* canvas, State state, const gfx::Rect& rect, const ButtonExtraParams& button) const; // Draw the text field. - virtual void PaintTextField(skia::PlatformCanvas* canvas, + virtual void PaintTextField(SkCanvas* canvas, State state, const gfx::Rect& rect, const TextFieldExtraParams& text) const; // Draw the menu list. - virtual void PaintMenuList(skia::PlatformCanvas* canvas, + virtual void PaintMenuList(SkCanvas* canvas, State state, const gfx::Rect& rect, const MenuListExtraParams& menu_list) const; // Draw the slider track. - virtual void PaintSliderTrack(skia::PlatformCanvas* canvas, + virtual void PaintSliderTrack(SkCanvas* canvas, State state, const gfx::Rect& rect, const SliderExtraParams& slider) const; // Draw the slider thumb. - virtual void PaintSliderThumb(skia::PlatformCanvas* canvas, + virtual void PaintSliderThumb(SkCanvas* canvas, State state, const gfx::Rect& rect, const SliderExtraParams& slider) const; // Draw the inner spin button. - virtual void PaintInnerSpinButton(skia::PlatformCanvas* canvas, + virtual void PaintInnerSpinButton(SkCanvas* canvas, State state, const gfx::Rect& rect, const InnerSpinButtonExtraParams& spin_button) const; // Draw the progress bar. - virtual void PaintProgressBar(skia::PlatformCanvas* canvas, + virtual void PaintProgressBar(SkCanvas* canvas, State state, const gfx::Rect& rect, const ProgressBarExtraParams& progress_bar) const; protected: - bool IntersectsClipRectInt(skia::PlatformCanvas* canvas, + bool IntersectsClipRectInt(SkCanvas* canvas, int x, int y, int w, int h) const; - void DrawBitmapInt(skia::PlatformCanvas* canvas, const SkBitmap& bitmap, + void DrawBitmapInt(SkCanvas* canvas, const SkBitmap& bitmap, int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y, int dest_w, int dest_h) const; diff --git a/ui/gfx/native_theme_win.cc b/ui/gfx/native_theme_win.cc index ce5f1e1..e0364b7 100644 --- a/ui/gfx/native_theme_win.cc +++ b/ui/gfx/native_theme_win.cc @@ -123,12 +123,12 @@ gfx::Size NativeThemeWin::GetPartSize(Part part) const { return SUCCEEDED(hr) ? Size(size.cx, size.cy) : Size(); } -void NativeThemeWin::Paint(skia::PlatformCanvas* canvas, +void NativeThemeWin::Paint(SkCanvas* canvas, Part part, State state, const gfx::Rect& rect, const ExtraParams& extra) const { - HDC hdc = canvas->beginPlatformPaint(); + HDC hdc = skia::BeginPlatformPaint(canvas); switch (part) { case kCheckbox: @@ -160,7 +160,7 @@ void NativeThemeWin::Paint(skia::PlatformCanvas* canvas, DCHECK(false); } - canvas->endPlatformPaint(); + skia::EndPlatformPaint(canvas); } HRESULT NativeThemeWin::PaintScrollbarArrow(HDC hdc, diff --git a/ui/gfx/native_theme_win.h b/ui/gfx/native_theme_win.h index 3ec1d55..d92ba58 100644 --- a/ui/gfx/native_theme_win.h +++ b/ui/gfx/native_theme_win.h @@ -310,7 +310,7 @@ class NativeThemeWin : public NativeTheme { // NativeTheme Implementation: virtual gfx::Size GetPartSize(Part part) const; - virtual void Paint(skia::PlatformCanvas* canvas, + virtual void Paint(SkCanvas* canvas, Part part, State state, const gfx::Rect& rect, diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc b/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc index 9a0fb6b..769bc39 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc +++ b/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -111,9 +111,9 @@ void WebPluginDelegateImpl::Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect) { if (!windowless_) return; - cairo_t* context = canvas->beginPlatformPaint(); + cairo_t* context = skia::BeginPlatformPaint(canvas); WindowlessPaint(context, rect); - canvas->endPlatformPaint(); + skia::EndPlatformPaint(canvas); } void WebPluginDelegateImpl::Print(cairo_t* context) { |