diff options
author | John Reck <jreck@google.com> | 2012-08-03 16:00:32 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2012-08-06 17:46:09 -0700 |
commit | 3718b58e4da76b7025aa5316a51264c5e38f2569 (patch) | |
tree | 862c59605fa3e2bd61ae279930f1d6cf70edb1f3 /Source/WebKit | |
parent | 6228f1617d7525d64a23edd3b497791c6a06e842 (diff) | |
download | external_webkit-3718b58e4da76b7025aa5316a51264c5e38f2569.zip external_webkit-3718b58e4da76b7025aa5316a51264c5e38f2569.tar.gz external_webkit-3718b58e4da76b7025aa5316a51264c5e38f2569.tar.bz2 |
Remove usages of getCanvas
Everything goes through either PlatformGraphicsContext or recordingCanvas()
Change-Id: I375a4294d2e8d4b467b70c6b8a7f0b96f402f252
Diffstat (limited to 'Source/WebKit')
11 files changed, 39 insertions, 31 deletions
diff --git a/Source/WebKit/android/RenderSkinMediaButton.cpp b/Source/WebKit/android/RenderSkinMediaButton.cpp index b3aa57d..a2f19c3 100644 --- a/Source/WebKit/android/RenderSkinMediaButton.cpp +++ b/Source/WebKit/android/RenderSkinMediaButton.cpp @@ -26,12 +26,13 @@ #define LOG_TAG "WebCore" #include "config.h" -#include "android_graphics.h" +#include "RenderSkinMediaButton.h" + #include "Document.h" #include "IntRect.h" #include "Node.h" #include "RenderObject.h" -#include "RenderSkinMediaButton.h" +#include "RenderSkinAndroid.h" #include "RenderSlider.h" #include "SkCanvas.h" #include "SkNinePatch.h" @@ -88,8 +89,9 @@ void RenderSkinMediaButton::Decode() } } -void RenderSkinMediaButton::Draw(SkCanvas* canvas, const IntRect& r, int buttonType, - bool translucent, RenderObject* o, bool drawBackground) +void RenderSkinMediaButton::Draw(SkCanvas* canvas, const IntRect& r, + MediaButton buttonType, bool translucent, + bool drawBackground, const IntRect& thumb) { if (!gDecoded) { Decode(); @@ -179,9 +181,7 @@ void RenderSkinMediaButton::Draw(SkCanvas* canvas, const IntRect& r, int buttonT SkScalar quarterHeight = SkScalarHalf(SkScalarHalf(bounds.height())); bounds.fTop += quarterHeight + SkScalarHalf(3); bounds.fBottom += -quarterHeight + SK_ScalarHalf; - if (o && o->isSlider()) { - RenderSlider* slider = toRenderSlider(o); - IntRect thumb = slider->thumbRect(); + if (!thumb.isEmpty()) { // Inset the track by half the width of the thumb, so the track // does not appear to go beyond the space where the thumb can // be. diff --git a/Source/WebKit/android/RenderSkinMediaButton.h b/Source/WebKit/android/RenderSkinMediaButton.h index 484b90c..98c9e04 100644 --- a/Source/WebKit/android/RenderSkinMediaButton.h +++ b/Source/WebKit/android/RenderSkinMediaButton.h @@ -26,27 +26,43 @@ #ifndef RenderSkinMediaButton_h #define RenderSkinMediaButton_h -#include "RenderSkinAndroid.h" +#include "IntRect.h" class SkCanvas; namespace WebCore { -class IntRect; -class RenderObject; class RenderSkinMediaButton { public: static void Decode(); + /** - * Draw the skin to the canvas, using the rectangle for its bounds and the - * State to determine which skin to use, i.e. focused or not focused. + * Button types */ - static void Draw(SkCanvas* , const IntRect& , int buttonType, bool translucent = false, - RenderObject* o = 0, bool drawBackground = true); + typedef enum + { + PAUSE, + PLAY, + MUTE, + REWIND, + FORWARD, + FULLSCREEN, + SPINNER_OUTER, + SPINNER_INNER, + VIDEO, + BACKGROUND_SLIDER, + SLIDER_TRACK, + SLIDER_THUMB + } MediaButton; + /** - * Button types + * Draw the skin to the canvas, using the rectangle for its bounds and the + * State to determine which skin to use, i.e. focused or not focused. */ - enum { PAUSE, PLAY, MUTE, REWIND, FORWARD, FULLSCREEN, SPINNER_OUTER, SPINNER_INNER , VIDEO, BACKGROUND_SLIDER, SLIDER_TRACK, SLIDER_THUMB }; + static void Draw(SkCanvas* canvas, const IntRect& rect, MediaButton buttonType, + bool translucent = false, bool drawBackground = true, + const IntRect& thumb = IntRect()); + /** * Slider dimensions */ diff --git a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp index ac5cd9d..f62b2d1 100644 --- a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp +++ b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp @@ -76,7 +76,6 @@ #include "WebViewClientError.h" #include "WebViewCore.h" #include "autofill/WebAutofill.h" -#include "android_graphics.h" #include <androidfw/AssetManager.h> #include <wtf/text/CString.h> diff --git a/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp index 409eff6..de91766 100644 --- a/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp +++ b/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp @@ -286,9 +286,6 @@ public: if (!m_poster || (!m_poster->getPixels() && !m_poster->pixelRef())) return; - SkCanvas* canvas = ctxt->platformContext()->getCanvas(); - if (!canvas) - return; // We paint with the following rules in mind: // - only downscale the poster, never upscale // - maintain the natural aspect ratio of the poster @@ -299,7 +296,7 @@ public: int posterX = ((r.width() - posterWidth) / 2) + r.x(); int posterY = ((r.height() - posterHeight) / 2) + r.y(); IntRect targetRect(posterX, posterY, posterWidth, posterHeight); - canvas->drawBitmapRect(*m_poster, 0, targetRect, 0); + ctxt->platformContext()->drawBitmapRect(*m_poster, 0, targetRect); } void onPosterFetched(SkBitmap* poster) diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp index 4cd39f6..39ae07e 100644 --- a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -89,7 +89,6 @@ #include "WebFrameView.h" #include "WebUrlLoaderClient.h" #include "WebViewCore.h" -#include "android_graphics.h" #include "jni.h" #include "wds/DebugServer.h" diff --git a/Source/WebKit/android/jni/WebFrameView.cpp b/Source/WebKit/android/jni/WebFrameView.cpp index 10e31dc..ed332aa 100644 --- a/Source/WebKit/android/jni/WebFrameView.cpp +++ b/Source/WebKit/android/jni/WebFrameView.cpp @@ -28,7 +28,6 @@ #include <config.h> #include "WebFrameView.h" -#include "android_graphics.h" #include "GraphicsContext.h" #include "Frame.h" #include "FrameTree.h" diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 79019cb..3324bfd 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -131,7 +131,6 @@ #include "WebCoreJni.h" #include "WebFrameView.h" #include "WindowsKeyboardCodes.h" -#include "android_graphics.h" #include "autofill/WebAutofill.h" #include "htmlediting.h" #include "markup.h" diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index c708c25..66dbdc1 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -58,7 +58,6 @@ #include "WebCoreJni.h" #include "WebRequestContext.h" #include "WebViewCore.h" -#include "android_graphics.h" #ifdef GET_NATIVE_VIEW #undef GET_NATIVE_VIEW diff --git a/Source/WebKit/android/plugins/ANPSurfaceInterface.cpp b/Source/WebKit/android/plugins/ANPSurfaceInterface.cpp index 92dbbcd..2b593e2 100644 --- a/Source/WebKit/android/plugins/ANPSurfaceInterface.cpp +++ b/Source/WebKit/android/plugins/ANPSurfaceInterface.cpp @@ -30,7 +30,6 @@ #include "PluginView.h" #include "PluginWidgetAndroid.h" #include "SkANP.h" -#include "android_graphics.h" #include <JNIUtility.h> #include <gui/Surface.h> #include <ui/Rect.h> diff --git a/Source/WebKit/android/plugins/PluginWidgetAndroid.cpp b/Source/WebKit/android/plugins/PluginWidgetAndroid.cpp index 09bb24e..2fd2ef4 100644 --- a/Source/WebKit/android/plugins/PluginWidgetAndroid.cpp +++ b/Source/WebKit/android/plugins/PluginWidgetAndroid.cpp @@ -42,7 +42,6 @@ #include "SkString.h" #include "SkTime.h" #include "WebViewCore.h" -#include "android_graphics.h" #include <JNIUtility.h> //#define PLUGIN_DEBUG_LOCAL // controls the printing of log messages @@ -225,7 +224,7 @@ void PluginWidgetAndroid::viewInvalidate() { m_core->viewInvalidate(rect); } -void PluginWidgetAndroid::draw(SkCanvas* canvas) { +void PluginWidgetAndroid::draw(PlatformGraphicsContext* context) { if (NULL == m_flipPixelRef || !m_flipPixelRef->isDirty()) { return; } @@ -249,10 +248,11 @@ void PluginWidgetAndroid::draw(SkCanvas* canvas) { bitmap) && pkg->pluginFuncs()->event(instance, &event)) { - if (canvas && m_pluginWindow) { + if (context && m_pluginWindow) { SkBitmap bm(bitmap); bm.setPixelRef(m_flipPixelRef); - canvas->drawBitmap(bm, 0, 0); + IntRect dst(0, 0, bm.width(), bm.height()); + context->drawBitmapRect(bm, 0, dst); } } break; diff --git a/Source/WebKit/android/plugins/PluginWidgetAndroid.h b/Source/WebKit/android/plugins/PluginWidgetAndroid.h index 87612dd..73b116b 100644 --- a/Source/WebKit/android/plugins/PluginWidgetAndroid.h +++ b/Source/WebKit/android/plugins/PluginWidgetAndroid.h @@ -28,6 +28,7 @@ #include "android_npapi.h" #include "ANPSystem_npapi.h" +#include "GraphicsContext.h" #include "IntPoint.h" #include "IntRect.h" #include "MediaLayer.h" @@ -98,7 +99,7 @@ struct PluginWidgetAndroid { /* Called to draw into the plugin's bitmap. If canvas is non-null, the bitmap itself is then drawn into the canvas. */ - void draw(SkCanvas* canvas = NULL); + void draw(PlatformGraphicsContext* context = NULL); /* Send this event to the plugin instance. A non-zero value will be returned if the plugin handled the event. |