diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-19 21:18:34 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-19 21:18:34 +0000 |
commit | 8c89e779666552bdfc748989f9870b6c7cf94cfd (patch) | |
tree | aa10b38ba18cebc73e8e0445320e37aaaacd6551 /webkit/glue | |
parent | 5b5251300453200903df3967d79f89a07ecb2a7d (diff) | |
download | chromium_src-8c89e779666552bdfc748989f9870b6c7cf94cfd.zip chromium_src-8c89e779666552bdfc748989f9870b6c7cf94cfd.tar.gz chromium_src-8c89e779666552bdfc748989f9870b6c7cf94cfd.tar.bz2 |
Change WebCanvas to be a CGContext on Mac.
This change removes the code that previously existed to render HTML5 video on Mac. That code was already broken (video doesn't work at all on tip-of-tree), and so instead of trying to translate broken code, I just removed it. Andrew approved this.
R=amanda,scherkus
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/174022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23742 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/webframe_impl.cc | 14 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.h | 2 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.cc | 15 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.h | 10 | ||||
-rw-r--r-- | webkit/glue/webmediaplayer_impl.cc | 5 | ||||
-rw-r--r-- | webkit/glue/webpopupmenu_impl.cc | 12 |
6 files changed, 42 insertions, 16 deletions
diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index 799e0e5..40038b6 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -1054,8 +1054,7 @@ float WebFrameImpl::printPage(int page, WebCanvas* canvas) { PlatformContextSkia context(canvas); GraphicsContext spool(&context); #elif defined(OS_MACOSX) - CGContextRef context = canvas->beginPlatformPaint(); - GraphicsContext spool(context); + GraphicsContext spool(canvas); WebCore::LocalCurrentGraphicsContext localContext(&spool); #endif @@ -1526,21 +1525,22 @@ void WebFrameImpl::Layout() { FromFrame(child)->Layout(); } -void WebFrameImpl::Paint(skia::PlatformCanvas* canvas, const WebRect& rect) { +void WebFrameImpl::Paint(WebCanvas* canvas, const WebRect& rect) { static StatsRate rendering("WebFramePaintTime"); StatsScope<StatsRate> rendering_scope(rendering); if (!rect.isEmpty()) { IntRect dirty_rect(webkit_glue::WebRectToIntRect(rect)); -#if defined(OS_MACOSX) - CGContextRef context = canvas->getTopPlatformDevice().GetBitmapContext(); - GraphicsContext gc(context); +#if WEBKIT_USING_CG + GraphicsContext gc(canvas); WebCore::LocalCurrentGraphicsContext localContext(&gc); -#else +#elif WEBKIT_USING_SKIA PlatformContextSkia context(canvas); // PlatformGraphicsContext is actually a pointer to PlatformContextSkia GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context)); +#else + NOTIMPLEMENTED(); #endif if (frame_->document() && frameview()) { frameview()->paint(&gc, dirty_rect); diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h index 87b2244..ef37d48 100644 --- a/webkit/glue/webframe_impl.h +++ b/webkit/glue/webframe_impl.h @@ -179,7 +179,7 @@ class WebFrameImpl : public WebKit::WebFrame, WebCore::HTMLFrameOwnerElement* owner_element); void Layout(); - void Paint(skia::PlatformCanvas* canvas, const WebKit::WebRect& rect); + void Paint(WebKit::WebCanvas* canvas, const WebKit::WebRect& rect); void CreateFrameView(); diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index 1952c27..4fd1626 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2009 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. @@ -34,6 +34,7 @@ #include "base/string_util.h" #include "base/sys_info.h" #include "base/sys_string_conversions.h" +#include "skia/ext/platform_canvas.h" #include "third_party/skia/include/core/SkBitmap.h" #include "webkit/api/public/WebHistoryItem.h" #include "webkit/api/public/WebString.h" @@ -48,6 +49,7 @@ #include "webkit_version.h" // Generated +using WebKit::WebCanvas; using WebKit::WebFrame; using WebKit::WebHistoryItem; using WebKit::WebString; @@ -437,4 +439,15 @@ bool ShouldForcefullyTerminatePluginProcess() { return g_forcefully_terminate_plugin_process; } +WebCanvas* ToWebCanvas(skia::PlatformCanvas* canvas) { +#if WEBKIT_USING_SKIA + return canvas; +#elif WEBKIT_USING_CG + return canvas->getTopPlatformDevice().GetBitmapContext(); +#else + NOTIMPLEMENTED(); + return NULL; +#endif +} + } // namespace webkit_glue diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h index 686e676..c52f0b1 100644 --- a/webkit/glue/webkit_glue.h +++ b/webkit/glue/webkit_glue.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2009 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. @@ -17,6 +17,7 @@ #include "base/clipboard.h" #include "base/file_path.h" #include "base/string16.h" +#include "webkit/api/public/WebCanvas.h" class GURL; class SkBitmap; @@ -24,6 +25,10 @@ class StringPiece; class WebView; struct WebPluginInfo; +namespace skia { +class PlatformCanvas; +} + namespace WebKit { class WebFrame; class WebString; @@ -104,6 +109,9 @@ bool ShouldForcefullyTerminatePluginProcess(); FilePath::StringType WebStringToFilePathString(const WebKit::WebString& str); WebKit::WebString FilePathStringToWebString(const FilePath::StringType& str); +// Returns a WebCanvas pointer associated with the given Skia canvas. +WebKit::WebCanvas* ToWebCanvas(skia::PlatformCanvas*); + //---- END FUNCTIONS IMPLEMENTED BY WEBKIT/GLUE ------------------------------- diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc index 9eae37b..d3d3679 100644 --- a/webkit/glue/webmediaplayer_impl.cc +++ b/webkit/glue/webmediaplayer_impl.cc @@ -425,7 +425,12 @@ void WebMediaPlayerImpl::paint(WebCanvas* canvas, DCHECK(MessageLoop::current() == main_loop_); DCHECK(proxy_); +#if WEBKIT_USING_SKIA proxy_->Paint(canvas, rect); +#else + // TODO(darin): Implement this for Mac, where WebCanvas is a CGContext. + NOTIMPLEMENTED(); +#endif } bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const { diff --git a/webkit/glue/webpopupmenu_impl.cc b/webkit/glue/webpopupmenu_impl.cc index 326a326..9a9d7b7 100644 --- a/webkit/glue/webpopupmenu_impl.cc +++ b/webkit/glue/webpopupmenu_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2009 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. @@ -144,15 +144,15 @@ void WebPopupMenuImpl::paint(WebCanvas* canvas, const WebRect& rect) { return; if (!rect.isEmpty()) { -#if defined(OS_MACOSX) - CGContextRef context = canvas->getTopPlatformDevice().GetBitmapContext(); - GraphicsContext gc(context); -#else +#if WEBKIT_USING_CG + GraphicsContext gc(canvas); +#elif WEBKIT_USING_SKIA PlatformContextSkia context(canvas); // PlatformGraphicsContext is actually a pointer to PlatformContextSkia. GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context)); +#else + NOTIMPLEMENTED(); #endif - widget_->paint(&gc, webkit_glue::WebRectToIntRect(rect)); } } |