From de89b1aa0a100f46600ed48b6b3b57759c446447 Mon Sep 17 00:00:00 2001 From: Teng-Hui Zhu Date: Fri, 18 Mar 2011 15:41:20 -0700 Subject: Support drawing paused and loading image as GL texture bug:4142131 Change-Id: I871924cb7587077f50fdf4f9a00056f795a8daea --- WebKit/android/RenderSkinMediaButton.cpp | 17 ++++++++++++++--- WebKit/android/RenderSkinMediaButton.h | 5 ++--- .../WebCoreSupport/MediaPlayerPrivateAndroid.cpp | 6 +++--- 3 files changed, 19 insertions(+), 9 deletions(-) (limited to 'WebKit/android') diff --git a/WebKit/android/RenderSkinMediaButton.cpp b/WebKit/android/RenderSkinMediaButton.cpp index 6a11eda..745fa88 100644 --- a/WebKit/android/RenderSkinMediaButton.cpp +++ b/WebKit/android/RenderSkinMediaButton.cpp @@ -54,9 +54,12 @@ static const PatchData gFiles[] = { "ic_media_rew.png", 0, 0 }, // REWIND { "ic_media_ff.png", 0, 0 }, // FORWARD { "ic_media_fullscreen.png", 0, 0 }, // FULLSCREEN + { "spinner_76_outer_holo.png", 0, 0 }, // SPINNER_OUTER + { "spinner_76_inner_holo.png", 0, 0 }, // SPINNER_INNER + { "ic_media_video_poster.png", 0, 0 }, // VIDEO { "btn_media_player_disabled.9.png", 0, 0 }, // BACKGROUND_SLIDER - { "scrubber_track_holo_dark.9.png", 0, 0 }, // SLIDER_TRACK - { "scrubber_control_holo.png", 0, 0 } // SLIDER_THUMB + { "scrubber_track_holo_dark.9.png", 0, 0 }, // SLIDER_TRACK + { "scrubber_control_holo.png", 0, 0 } // SLIDER_THUMB }; static SkBitmap gButton[sizeof(gFiles)/sizeof(gFiles[0])]; @@ -124,6 +127,14 @@ void RenderSkinMediaButton::Draw(SkCanvas* canvas, const IntRect& r, int buttonT paint.setColor(backgroundColor); break; } + case SPINNER_OUTER: + case SPINNER_INNER: + case VIDEO: + { + drawsBackgroundColor = false; + imageIndex = buttonType + 1; + break; + } case BACKGROUND_SLIDER: { drawsBackgroundColor = false; @@ -200,4 +211,4 @@ void RenderSkinMediaButton::Draw(SkCanvas* canvas, const IntRect& r, int buttonT } } -} //WebCore +} // WebCore diff --git a/WebKit/android/RenderSkinMediaButton.h b/WebKit/android/RenderSkinMediaButton.h index 026f538..6aa9c4e 100644 --- a/WebKit/android/RenderSkinMediaButton.h +++ b/WebKit/android/RenderSkinMediaButton.h @@ -34,8 +34,7 @@ namespace WebCore { class IntRect; class RenderObject; -class RenderSkinMediaButton -{ +class RenderSkinMediaButton { public: /** * Initialize the class before use. Uses the AssetManager to initialize any @@ -51,7 +50,7 @@ public: /** * Button types */ - enum { PAUSE, PLAY, MUTE, REWIND, FORWARD, FULLSCREEN, BACKGROUND_SLIDER, SLIDER_TRACK, SLIDER_THUMB }; + enum { PAUSE, PLAY, MUTE, REWIND, FORWARD, FULLSCREEN, SPINNER_OUTER, SPINNER_INNER , VIDEO, BACKGROUND_SLIDER, SLIDER_TRACK, SLIDER_THUMB }; /** * Slider dimensions */ diff --git a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp index 4cc9cf4..d61b0dd 100644 --- a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp +++ b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp @@ -567,7 +567,7 @@ static void OnTimeupdate(JNIEnv* env, jobject obj, int position, int pointer) // Return value: true when the video layer is found. static bool SendSurfaceTexture(JNIEnv* env, jobject obj, jobject surfTex, int baseLayer, int videoLayerId, - int textureName, bool updateTexture) { + int textureName, int playerState) { if (!surfTex) return false; @@ -590,7 +590,7 @@ static bool SendSurfaceTexture(JNIEnv* env, jobject obj, jobject surfTex, return false; // Set the SurfaceTexture to the layer we found - videoLayer->setSurfaceTexture(texture, textureName, updateTexture); + videoLayer->setSurfaceTexture(texture, textureName, static_cast(playerState)); return true; } @@ -607,7 +607,7 @@ static JNINativeMethod g_MediaPlayerMethods[] = { (void*) OnPaused }, { "nativeOnPosterFetched", "(Landroid/graphics/Bitmap;I)V", (void*) OnPosterFetched }, - { "nativeSendSurfaceTexture", "(Landroid/graphics/SurfaceTexture;IIIZ)Z", + { "nativeSendSurfaceTexture", "(Landroid/graphics/SurfaceTexture;IIII)Z", (void*) SendSurfaceTexture }, { "nativeOnTimeupdate", "(II)V", (void*) OnTimeupdate }, -- cgit v1.1