2009-04-28 Eric Carlson <eric.carlson@apple.com>

        Reviewed by Adam Roben
        
        <rdar://problem/6769968> media/video-size-intrinsic-scale.html fails on Windows
        https://bugs.webkit.org/show_bug.cgi?id=25094
        
        Display movies saved with a non-identity matrix at the correct size.

        * platform/graphics/win/QTMovieWin.cpp:
        (QTMovieWinPrivate::QTMovieWinPrivate): Initialize m_widthScaleFactor and m_heightScaleFactor.
        (QTMovieWinPrivate::cacheMovieScale): New, calculate difference between initial
        size and natural size so naturalSize() accounts for non-identity movie matrix.
        (QTMovieWinPrivate::task):Call cacheMovieScale when load state reaches
        kMovieLoadStateLoaded for the first time. kMovieLoadState -> QTMovieLoadState.
        (QTMovieWinPrivate::drawingComplete): kMovieLoadState -> QTMovieLoadState.
        (QTMovieWinPrivate::createGWorld): Don't bother creating gworld until load state reaches
        kMovieLoadStateLoaded because we do not try to draw it before that point.
        (QTMovieWinPrivate::setSize): Do not change movie box before reaching kMovieLoadStateLoaded
        because we need to get the movie's initial size in cacheMovieScale.
        (QTMovieWin::getNaturalSize): Multiply width and height by initial scale.

2009-04-28  Eric Carlson  <eric.carlson@apple.com>

        Reviewed by Adam Roben

        <rdar://problem/6769968> media/video-size-intrinsic-scale.html fails on Windows
        https://bugs.webkit.org/show_bug.cgi?id=25094

        * platform/win/Skipped: Re-enable video-size-intrinsic-scale.html.



git-svn-id: svn://svn.chromium.org/blink/trunk@42939 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 0421f88a
2009-04-28 Eric Carlson <eric.carlson@apple.com>
Reviewed by Adam Roben
<rdar://problem/6769968> media/video-size-intrinsic-scale.html fails on Windows
https://bugs.webkit.org/show_bug.cgi?id=25094
* platform/win/Skipped: Re-enable video-size-intrinsic-scale.html.
2009-04-27 Sam Weinig <sam@webkit.org>
Reviewed by Mark Rowe.
......@@ -559,9 +559,6 @@ fast/forms/mailto/post-multiple-items.html
fast/forms/mailto/post-text-plain-with-accept-charset.html
fast/forms/mailto/post-text-plain.html
# Bug 25094: media/video-size-intrinsic-scale.html fails on Windows <https://bugs.webkit.org/show_bug.cgi?id=25094>
media/video-size-intrinsic-scale.html
# <rdar://6772112> Cookies expire 1 hour too early
fast/cookies/local-file-can-set-cookies.html
......
2009-04-28 Eric Carlson <eric.carlson@apple.com>
Reviewed by Adam Roben
<rdar://problem/6769968> media/video-size-intrinsic-scale.html fails on Windows
https://bugs.webkit.org/show_bug.cgi?id=25094
Display movies saved with a non-identity matrix at the correct size.
* platform/graphics/win/QTMovieWin.cpp:
(QTMovieWinPrivate::QTMovieWinPrivate): Initialize m_widthScaleFactor and m_heightScaleFactor.
(QTMovieWinPrivate::cacheMovieScale): New, calculate difference between initial
size and natural size so naturalSize() accounts for non-identity movie matrix.
(QTMovieWinPrivate::task):Call cacheMovieScale when load state reaches
kMovieLoadStateLoaded for the first time. kMovieLoadState -> QTMovieLoadState.
(QTMovieWinPrivate::drawingComplete): kMovieLoadState -> QTMovieLoadState.
(QTMovieWinPrivate::createGWorld): Don't bother creating gworld until load state reaches
kMovieLoadStateLoaded because we do not try to draw it before that point.
(QTMovieWinPrivate::setSize): Do not change movie box before reaching kMovieLoadStateLoaded
because we need to get the movie's initial size in cacheMovieScale.
(QTMovieWin::getNaturalSize): Multiply width and height by initial scale.
2009-04-28 Sam Weinig <sam@webkit.org>
Reviewed by Dan Bernstein.
......@@ -91,6 +91,7 @@ public:
void createGWorld();
void deleteGWorld();
void clearGWorld();
void cacheMovieScale();
void setSize(int, int);
......@@ -112,6 +113,11 @@ public:
int m_gWorldHeight;
GWorldPtr m_savedGWorld;
long m_loadError;
float m_widthScaleFactor;
float m_heightScaleFactor;
#if !ASSERT_DISABLED
bool m_scaleCached;
#endif
};
QTMovieWinPrivate::QTMovieWinPrivate()
......@@ -133,6 +139,11 @@ QTMovieWinPrivate::QTMovieWinPrivate()
, m_gWorldHeight(0)
, m_savedGWorld(0)
, m_loadError(0)
, m_widthScaleFactor(1)
, m_heightScaleFactor(1)
#if !ASSERT_DISABLED
, m_scaleCached(false)
#endif
{
}
......@@ -179,6 +190,26 @@ void QTMovieWinPrivate::endTask()
updateTaskTimer();
}
void QTMovieWinPrivate::cacheMovieScale()
{
Rect naturalRect;
Rect initialRect;
GetMovieNaturalBoundsRect(m_movie, &naturalRect);
GetMovieBox(m_movie, &initialRect);
int naturalWidth = naturalRect.right - naturalRect.left;
int naturalHeight = naturalRect.bottom - naturalRect.top;
if (naturalWidth)
m_widthScaleFactor = (initialRect.right - initialRect.left) / naturalWidth;
if (naturalHeight)
m_heightScaleFactor = (initialRect.bottom - initialRect.top) / naturalHeight;
#if !ASSERT_DISABLED
m_scaleCached = true;;
#endif
}
void QTMovieWinPrivate::task()
{
ASSERT(m_tasking);
......@@ -192,18 +223,21 @@ void QTMovieWinPrivate::task()
// GetMovieLoadState documentation says that you should not call it more often than every quarter of a second.
if (systemTime() >= m_lastLoadStateCheckTime + 0.25 || m_loadError) {
// If load fails QT's load state is kMovieLoadStateComplete.
// If load fails QT's load state is QTMovieLoadStateComplete.
// This is different from QTKit API and seems strange.
long loadState = m_loadError ? kMovieLoadStateError : GetMovieLoadState(m_movie);
long loadState = m_loadError ? QTMovieLoadStateError : GetMovieLoadState(m_movie);
if (loadState != m_loadState) {
// we only need to erase the movie gworld when the load state changes to loaded while it
// is visible as the gworld is destroyed/created when visibility changes
if (loadState >= QTMovieLoadStateLoaded && m_loadState < QTMovieLoadStateLoaded && m_visible)
if (loadState >= QTMovieLoadStateLoaded && m_loadState < QTMovieLoadStateLoaded) {
if (m_visible)
clearGWorld();
cacheMovieScale();
}
m_loadState = loadState;
if (!m_movieController && m_loadState >= kMovieLoadStateLoaded)
if (!m_movieController && m_loadState >= QTMovieLoadStateLoaded)
createMovieController();
m_client->movieLoadStateChanged(m_movieWin);
if (m_movieWin->m_disabled) {
......@@ -263,7 +297,7 @@ void QTMovieWinPrivate::registerDrawingCallback()
void QTMovieWinPrivate::drawingComplete()
{
if (!m_gWorld || m_movieWin->m_disabled || m_loadState < kMovieLoadStateLoaded)
if (!m_gWorld || m_movieWin->m_disabled || m_loadState < QTMovieLoadStateLoaded)
return;
m_client->movieNewImageAvailable(m_movieWin);
}
......@@ -288,7 +322,7 @@ void QTMovieWinPrivate::updateGWorld()
void QTMovieWinPrivate::createGWorld()
{
ASSERT(!m_gWorld);
if (!m_movie)
if (!m_movie || m_loadState < QTMovieLoadStateLoaded)
return;
m_gWorldWidth = max(cGWorldMinWidth, m_width);
......@@ -338,8 +372,17 @@ void QTMovieWinPrivate::setSize(int width, int height)
return;
m_width = width;
m_height = height;
if (!m_movie)
// Do not change movie box before reaching load state loaded as we grab
// the initial size when task() sees that state for the first time, and
// we need the initial size to be able to scale movie properly.
if (!m_movie || m_loadState < QTMovieLoadStateLoaded)
return;
#if !ASSERT_DISABLED
ASSERT(m_scaleCached);
#endif
Rect bounds;
bounds.top = 0;
bounds.left = 0;
......@@ -483,8 +526,8 @@ void QTMovieWin::getNaturalSize(int& width, int& height)
if (m_private->m_movie)
GetMovieNaturalBoundsRect(m_private->m_movie, &rect);
width = rect.right - rect.left;
height = rect.bottom - rect.top;
width = (rect.right - rect.left) * m_private->m_widthScaleFactor;
height = (rect.bottom - rect.top) * m_private->m_heightScaleFactor;
}
void QTMovieWin::setSize(int width, int height)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment