summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authoralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-08 17:36:26 +0000
committeralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-08 17:36:26 +0000
commitafc4ce91f94bc0cb976884e1c1c785a9e75f127a (patch)
tree0c64c063fe026abd1f2a81a97fe04b9dfd514702 /webkit/glue
parent73689e53255c6ac22a90b0cd01fe40180ec2bbba (diff)
downloadchromium_src-afc4ce91f94bc0cb976884e1c1c785a9e75f127a.zip
chromium_src-afc4ce91f94bc0cb976884e1c1c785a9e75f127a.tar.gz
chromium_src-afc4ce91f94bc0cb976884e1c1c785a9e75f127a.tar.bz2
Eliminate skia::PlatformCanvas, a subclass of SkCanvas. Skia provides multiple types of SkCanvas classes that we would like to use. Unfortunately these classes are implemented as subclasses of SkCanvas. Subclassing SkCanvas in both Skia and Chromium makes it impossible to dynamically use any SkCanvas. There is also no reason for chromium to subclass SkCanvas. Most of the extra functionalities can be implemented by hanging meta-data from SkCanvas.
We cannot eliminate skia::PlatformCanvas in one step due to WebKit's dependency on skia::PlatformCanvas. WebKit::WebCanvas is typedef as skia::PlatformDevice. It should be SkCanvas. So we need to do it in multiple steps: 1. Prepare Chromium tree for the change in WebKit::WebCanvas tyepdef. This basically means adding a couple of static_cast<skia::PlatformCanvas>(WebCanvas). 2. Change WebKit::WebCanvas typedef from skia::PlatformCanvas to SkCanvas 3. Eliminate skia::PlatformCanvas in chromium This CL accomplishes the first step on windows. WebKit BUG=https://bugs.webkit.org/show_bug.cgi?id=57563 Review URL: http://codereview.chromium.org/6783023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80955 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/media/video_renderer_impl.cc10
-rw-r--r--webkit/glue/media/video_renderer_impl.h10
-rw-r--r--webkit/glue/media/web_video_renderer.h4
-rw-r--r--webkit/glue/webmediaplayer_impl.cc3
-rw-r--r--webkit/glue/webmediaplayer_impl.h2
-rw-r--r--webkit/glue/webthemeengine_impl_win.cc40
6 files changed, 35 insertions, 34 deletions
diff --git a/webkit/glue/media/video_renderer_impl.cc b/webkit/glue/media/video_renderer_impl.cc
index 3bbd626..5e159fe 100644
--- a/webkit/glue/media/video_renderer_impl.cc
+++ b/webkit/glue/media/video_renderer_impl.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.
@@ -49,7 +49,7 @@ void VideoRendererImpl::SetRect(const gfx::Rect& rect) {
}
// This method is always called on the renderer's thread.
-void VideoRendererImpl::Paint(skia::PlatformCanvas* canvas,
+void VideoRendererImpl::Paint(SkCanvas* canvas,
const gfx::Rect& dest_rect) {
scoped_refptr<media::VideoFrame> video_frame;
GetCurrentFrame(&video_frame);
@@ -98,7 +98,7 @@ void VideoRendererImpl::PutCurrentFrame(
// 4. Canvas is opaque.
// TODO(hclam): The fast paint method should support flipping and mirroring.
// Disable the flipping and mirroring checks once we have it.
-bool VideoRendererImpl::CanFastPaint(skia::PlatformCanvas* canvas,
+bool VideoRendererImpl::CanFastPaint(SkCanvas* canvas,
const gfx::Rect& dest_rect) {
// Fast paint does not handle opacity value other than 1.0. Hence use slow
// paint if opacity is not 1.0. Since alpha = opacity * 0xFF, we check that
@@ -152,7 +152,7 @@ bool VideoRendererImpl::CanFastPaint(skia::PlatformCanvas* canvas,
}
void VideoRendererImpl::SlowPaint(media::VideoFrame* video_frame,
- skia::PlatformCanvas* canvas,
+ SkCanvas* canvas,
const gfx::Rect& dest_rect) {
// 1. Convert YUV frame to RGB.
base::TimeDelta timestamp = video_frame->GetTimestamp();
@@ -199,7 +199,7 @@ void VideoRendererImpl::SlowPaint(media::VideoFrame* video_frame,
}
void VideoRendererImpl::FastPaint(media::VideoFrame* video_frame,
- skia::PlatformCanvas* canvas,
+ SkCanvas* canvas,
const gfx::Rect& dest_rect) {
DCHECK(video_frame->format() == media::VideoFrame::YV12 ||
video_frame->format() == media::VideoFrame::YV16);
diff --git a/webkit/glue/media/video_renderer_impl.h b/webkit/glue/media/video_renderer_impl.h
index b73c099..b14038b 100644
--- a/webkit/glue/media/video_renderer_impl.h
+++ b/webkit/glue/media/video_renderer_impl.h
@@ -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.
//
@@ -30,7 +30,7 @@ class VideoRendererImpl : public WebVideoRenderer {
// WebVideoRenderer implementation.
virtual void SetWebMediaPlayerImplProxy(WebMediaPlayerImpl::Proxy* proxy);
virtual void SetRect(const gfx::Rect& rect);
- virtual void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& dest_rect);
+ virtual void Paint(SkCanvas* canvas, const gfx::Rect& dest_rect);
virtual void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out);
virtual void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame);
@@ -47,18 +47,18 @@ class VideoRendererImpl : public WebVideoRenderer {
private:
// Determine the conditions to perform fast paint. Returns true if we can do
// fast paint otherwise false.
- bool CanFastPaint(skia::PlatformCanvas* canvas, const gfx::Rect& dest_rect);
+ bool CanFastPaint(SkCanvas* canvas, const gfx::Rect& dest_rect);
// Slow paint does a YUV => RGB, and scaled blit in two separate operations.
void SlowPaint(media::VideoFrame* video_frame,
- skia::PlatformCanvas* canvas,
+ SkCanvas* canvas,
const gfx::Rect& dest_rect);
// Fast paint does YUV => RGB, scaling, blitting all in one step into the
// canvas. It's not always safe and appropriate to perform fast paint.
// CanFastPaint() is used to determine the conditions.
void FastPaint(media::VideoFrame* video_frame,
- skia::PlatformCanvas* canvas,
+ SkCanvas* canvas,
const gfx::Rect& dest_rect);
void TransformToSkIRect(const SkMatrix& matrix, const gfx::Rect& src_rect,
diff --git a/webkit/glue/media/web_video_renderer.h b/webkit/glue/media/web_video_renderer.h
index efd3109..9e1eed5 100644
--- a/webkit/glue/media/web_video_renderer.h
+++ b/webkit/glue/media/web_video_renderer.h
@@ -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.
@@ -32,7 +32,7 @@ class WebVideoRenderer : public media::VideoRendererBase {
// |dest_rect|.
//
// Method called on the render thread.
- virtual void Paint(skia::PlatformCanvas* canvas,
+ virtual void Paint(SkCanvas* canvas,
const gfx::Rect& dest_rect) = 0;
// Clients of this class (painter/compositor) should use GetCurrentFrame()
diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc
index c01b331..e204be6 100644
--- a/webkit/glue/webmediaplayer_impl.cc
+++ b/webkit/glue/webmediaplayer_impl.cc
@@ -22,7 +22,6 @@
#include "media/filters/ffmpeg_video_decoder.h"
#include "media/filters/rtc_video_decoder.h"
#include "media/filters/null_audio_renderer.h"
-#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h"
@@ -124,7 +123,7 @@ WebDataSourceBuildObserverHack* WebMediaPlayerImpl::Proxy::GetBuildObserver() {
return build_observer_.get();
}
-void WebMediaPlayerImpl::Proxy::Paint(skia::PlatformCanvas* canvas,
+void WebMediaPlayerImpl::Proxy::Paint(SkCanvas* canvas,
const gfx::Rect& dest_rect) {
DCHECK(MessageLoop::current() == render_loop_);
if (video_renderer_) {
diff --git a/webkit/glue/webmediaplayer_impl.h b/webkit/glue/webmediaplayer_impl.h
index 68b06d5..0a492db 100644
--- a/webkit/glue/webmediaplayer_impl.h
+++ b/webkit/glue/webmediaplayer_impl.h
@@ -102,7 +102,7 @@ class WebMediaPlayerImpl : public WebKit::WebMediaPlayer,
WebDataSourceBuildObserverHack* GetBuildObserver();
// Methods for WebMediaPlayerImpl -> Filter communication.
- void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& dest_rect);
+ void Paint(SkCanvas* canvas, const gfx::Rect& dest_rect);
void SetSize(const gfx::Rect& rect);
void Detach();
void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out);
diff --git a/webkit/glue/webthemeengine_impl_win.cc b/webkit/glue/webthemeengine_impl_win.cc
index dd3f356..61e78ca 100644
--- a/webkit/glue/webthemeengine_impl_win.cc
+++ b/webkit/glue/webthemeengine_impl_win.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.
@@ -27,55 +27,55 @@ static RECT WebRectToRECT(const WebRect& rect) {
void WebThemeEngineImpl::paintButton(
WebCanvas* canvas, int part, int state, int classic_state,
const WebRect& rect) {
- HDC hdc = canvas->beginPlatformPaint();
+ HDC hdc = skia::BeginPlatformPaint(canvas);
RECT native_rect = WebRectToRECT(rect);
gfx::NativeThemeWin::instance()->PaintButton(
hdc, part, state, classic_state, &native_rect);
- canvas->endPlatformPaint();
+ skia::EndPlatformPaint(canvas);
}
void WebThemeEngineImpl::paintMenuList(
WebCanvas* canvas, int part, int state, int classic_state,
const WebRect& rect) {
- HDC hdc = canvas->beginPlatformPaint();
+ HDC hdc = skia::BeginPlatformPaint(canvas);
RECT native_rect = WebRectToRECT(rect);
gfx::NativeThemeWin::instance()->PaintMenuList(
hdc, part, state, classic_state, &native_rect);
- canvas->endPlatformPaint();
+ skia::EndPlatformPaint(canvas);
}
void WebThemeEngineImpl::paintScrollbarArrow(
WebCanvas* canvas, int state, int classic_state,
const WebRect& rect) {
- HDC hdc = canvas->beginPlatformPaint();
+ HDC hdc = skia::BeginPlatformPaint(canvas);
RECT native_rect = WebRectToRECT(rect);
gfx::NativeThemeWin::instance()->PaintScrollbarArrow(
hdc, state, classic_state, &native_rect);
- canvas->endPlatformPaint();
+ skia::EndPlatformPaint(canvas);
}
void WebThemeEngineImpl::paintScrollbarThumb(
WebCanvas* canvas, int part, int state, int classic_state,
const WebRect& rect) {
- HDC hdc = canvas->beginPlatformPaint();
+ HDC hdc = skia::BeginPlatformPaint(canvas);
RECT native_rect = WebRectToRECT(rect);
gfx::NativeThemeWin::instance()->PaintScrollbarThumb(
hdc, part, state, classic_state, &native_rect);
- canvas->endPlatformPaint();
+ skia::EndPlatformPaint(canvas);
}
void WebThemeEngineImpl::paintScrollbarTrack(
WebCanvas* canvas, int part, int state, int classic_state,
const WebRect& rect, const WebRect& align_rect) {
- HDC hdc = canvas->beginPlatformPaint();
+ HDC hdc = skia::BeginPlatformPaint(canvas);
RECT native_rect = WebRectToRECT(rect);
RECT native_align_rect = WebRectToRECT(align_rect);
@@ -83,26 +83,26 @@ void WebThemeEngineImpl::paintScrollbarTrack(
hdc, part, state, classic_state, &native_rect, &native_align_rect,
canvas);
- canvas->endPlatformPaint();
+ skia::EndPlatformPaint(canvas);
}
void WebThemeEngineImpl::paintSpinButton(
WebCanvas* canvas, int part, int state, int classic_state,
const WebRect& rect) {
- HDC hdc = canvas->beginPlatformPaint();
+ HDC hdc = skia::BeginPlatformPaint(canvas);
RECT native_rect = WebRectToRECT(rect);
gfx::NativeThemeWin::instance()->PaintSpinButton(
hdc, part, state, classic_state, &native_rect);
- canvas->endPlatformPaint();
+ skia::EndPlatformPaint(canvas);
}
void WebThemeEngineImpl::paintTextField(
WebCanvas* canvas, int part, int state, int classic_state,
const WebRect& rect, WebColor color, bool fill_content_area,
bool draw_edges) {
- HDC hdc = canvas->beginPlatformPaint();
+ HDC hdc = skia::BeginPlatformPaint(canvas);
RECT native_rect = WebRectToRECT(rect);
COLORREF c = skia::SkColorToCOLORREF(color);
@@ -111,32 +111,34 @@ void WebThemeEngineImpl::paintTextField(
hdc, part, state, classic_state, &native_rect, c, fill_content_area,
draw_edges);
- canvas->endPlatformPaint();
+ skia::EndPlatformPaint(canvas);
}
void WebThemeEngineImpl::paintTrackbar(
WebCanvas* canvas, int part, int state, int classic_state,
const WebRect& rect) {
- HDC hdc = canvas->beginPlatformPaint();
+ HDC hdc = skia::BeginPlatformPaint(canvas);
RECT native_rect = WebRectToRECT(rect);
gfx::NativeThemeWin::instance()->PaintTrackbar(
hdc, part, state, classic_state, &native_rect, canvas);
- canvas->endPlatformPaint();
+ skia::EndPlatformPaint(canvas);
}
void WebThemeEngineImpl::paintProgressBar(
WebCanvas* canvas, const WebRect& barRect, const WebRect& valueRect,
bool determinate, double animatedSeconds)
{
- HDC hdc = canvas->beginPlatformPaint();
+ HDC hdc = skia::BeginPlatformPaint(canvas);
+
RECT native_bar_rect = WebRectToRECT(barRect);
RECT native_value_rect = WebRectToRECT(valueRect);
gfx::NativeThemeWin::instance()->PaintProgressBar(
hdc, &native_bar_rect,
&native_value_rect, determinate, animatedSeconds, canvas);
- canvas->endPlatformPaint();
+
+ skia::EndPlatformPaint(canvas);
}
} // namespace webkit_glue