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/api | |
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/api')
-rw-r--r-- | webkit/api/public/WebCanvas.h | 20 | ||||
-rw-r--r-- | webkit/api/src/WebMediaPlayerClientImpl.cpp | 32 | ||||
-rw-r--r-- | webkit/api/src/WebMediaPlayerClientImpl.h | 2 |
3 files changed, 19 insertions, 35 deletions
diff --git a/webkit/api/public/WebCanvas.h b/webkit/api/public/WebCanvas.h index 0b47676..d7bf334 100644 --- a/webkit/api/public/WebCanvas.h +++ b/webkit/api/public/WebCanvas.h @@ -1,10 +1,10 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -33,12 +33,20 @@ #include "WebCommon.h" -namespace skia { - class PlatformCanvas; -} +#if WEBKIT_USING_SKIA +namespace skia { class PlatformCanvas; } +#elif WEBKIT_USING_CG +struct CGContext; +#endif namespace WebKit { +#if WEBKIT_USING_SKIA typedef skia::PlatformCanvas WebCanvas; +#elif WEBKIT_USING_CG + typedef struct CGContext WebCanvas; +#else + #error "Need to define WebCanvas" +#endif } #endif diff --git a/webkit/api/src/WebMediaPlayerClientImpl.cpp b/webkit/api/src/WebMediaPlayerClientImpl.cpp index e9d5220..400fa7e 100644 --- a/webkit/api/src/WebMediaPlayerClientImpl.cpp +++ b/webkit/api/src/WebMediaPlayerClientImpl.cpp @@ -27,9 +27,12 @@ #include "KURL.h" #include "MediaPlayer.h" #include "NotImplemented.h" -#include "PlatformContextSkia.h" #include <wtf/Assertions.h> +#if WEBKIT_USING_SKIA +#include "PlatformContextSkia.h" +#endif + using namespace WebCore; namespace WebKit { @@ -331,32 +334,7 @@ void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re #if WEBKIT_USING_SKIA m_webMediaPlayer->paint(context->platformContext()->canvas(), rect); #elif WEBKIT_USING_CG - // If there is no preexisting platform canvas, or if the size has - // changed, recreate the canvas. This is to avoid recreating the bitmap - // buffer over and over for each frame of video. - if (!m_webCanvas || - m_webCanvas->getDevice()->width() != rect.width() || - m_webCanvas->getDevice()->height() != rect.height()) { - m_webCanvas.set(new WebCanvas(rect.width(), rect.height(), true)); - } - - IntRect normalized_rect(0, 0, rect.width(), rect.height()); - m_webMediaPlayer->paint(m_webCanvas.get(), normalized_rect); - - // The mac coordinate system is flipped vertical from the normal skia - // coordinates. During painting of the frame, flip the coordinates - // system and, for simplicity, also translate the clip rectangle to - // start at 0,0. - CGContext* cgContext = context->platformContext(); - CGContextSaveGState(cgContext); - CGContextTranslateCTM(cgContext, rect.x(), rect.height() + rect.y()); - CGContextScaleCTM(cgContext, 1.0, -1.0); - CGRect normalized_cgrect = normalized_rect; // For DrawToContext. - - m_webCanvas->getTopPlatformDevice().DrawToContext( - context->platformContext(), 0, 0, &normalized_cgrect); - - CGContextRestoreGState(cgContext); + m_webMediaPlayer->paint(context->platformContext(), rect); #else notImplemented(); #endif diff --git a/webkit/api/src/WebMediaPlayerClientImpl.h b/webkit/api/src/WebMediaPlayerClientImpl.h index c4d8063..8c5add0 100644 --- a/webkit/api/src/WebMediaPlayerClientImpl.h +++ b/webkit/api/src/WebMediaPlayerClientImpl.h @@ -36,7 +36,6 @@ #include "WebMediaPlayerClient.h" #include "MediaPlayerPrivate.h" -#include "WebCanvas.h" #include <wtf/OwnPtr.h> namespace WebKit { @@ -104,7 +103,6 @@ namespace WebKit { WebCore::MediaPlayer* m_mediaPlayer; OwnPtr<WebMediaPlayer> m_webMediaPlayer; - OwnPtr<WebKit::WebCanvas> m_webCanvas; }; } // namespace WebKit |