Commit 9e3fd540 authored by aroben@apple.com's avatar aroben@apple.com
Browse files

Notify layers that their animations have started when we flush the context, not when we render

r76372 separated context flushing from rendering, but this bit of code got left behind.

Reviewed by Sam Weinig.

* platform/graphics/ca/win/CACFLayerTreeHost.cpp:
(WebCore::CACFLayerTreeHost::render): Moved code to notify the layers from here to
notifyAnimationsStarted.
(WebCore::CACFLayerTreeHost::flushPendingLayerChangesNow): Added a call to
notifyAnimationsStarted after we flush the context.
(WebCore::CACFLayerTreeHost::notifyAnimationsStarted): Added. Code came from render. Changed
to call PlatformCALayer::animationStarted rather than calling through to the client
directly.

* platform/graphics/ca/win/CACFLayerTreeHost.h: Added notifyAniamtionsStarted.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76762 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ca766f78
2011-01-26 Adam Roben <aroben@apple.com>
Notify layers that their animations have started when we flush the context, not when we
render
r76372 separated context flushing from rendering, but this bit of code got left behind.
Reviewed by Sam Weinig.
* platform/graphics/ca/win/CACFLayerTreeHost.cpp:
(WebCore::CACFLayerTreeHost::render): Moved code to notify the layers from here to
notifyAnimationsStarted.
(WebCore::CACFLayerTreeHost::flushPendingLayerChangesNow): Added a call to
notifyAnimationsStarted after we flush the context.
(WebCore::CACFLayerTreeHost::notifyAnimationsStarted): Added. Code came from render. Changed
to call PlatformCALayer::animationStarted rather than calling through to the client
directly.
* platform/graphics/ca/win/CACFLayerTreeHost.h: Added notifyAniamtionsStarted.
2011-01-26 Adam Roben <aroben@apple.com> 2011-01-26 Adam Roben <aroben@apple.com>
   
Small cleanup in MediaPlayerPrivateFullscreenWindow Small cleanup in MediaPlayerPrivateFullscreenWindow
...@@ -439,26 +439,12 @@ void CACFLayerTreeHost::render(const Vector<CGRect>& windowDirtyRects) ...@@ -439,26 +439,12 @@ void CACFLayerTreeHost::render(const Vector<CGRect>& windowDirtyRects)
return; return;
} }
// All pending animations will have been started with the flush. Fire the animationStarted calls
double currentTime = WTF::currentTime();
double currentMediaTime = CACurrentMediaTime();
double t = currentTime + wkCACFContextGetLastCommitTime(m_context) - currentMediaTime;
ASSERT(t <= currentTime);
HashSet<RefPtr<PlatformCALayer> >::iterator end = m_pendingAnimatedLayers.end();
for (HashSet<RefPtr<PlatformCALayer> >::iterator it = m_pendingAnimatedLayers.begin(); it != end; ++it) {
PlatformCALayerClient* owner = (*it)->owner();
owner->platformCALayerAnimationStarted(t);
}
m_pendingAnimatedLayers.clear();
CGRect bounds = this->bounds(); CGRect bounds = this->bounds();
// Give the renderer some space to use. This needs to be valid until the // Give the renderer some space to use. This needs to be valid until the
// wkCACFContextFinishUpdate() call below. // wkCACFContextFinishUpdate() call below.
char space[4096]; char space[4096];
if (!wkCACFContextBeginUpdate(m_context, space, sizeof(space), currentMediaTime, bounds, windowDirtyRects.data(), windowDirtyRects.size())) if (!wkCACFContextBeginUpdate(m_context, space, sizeof(space), CACurrentMediaTime(), bounds, windowDirtyRects.data(), windowDirtyRects.size()))
return; return;
HRESULT err = S_OK; HRESULT err = S_OK;
...@@ -549,9 +535,25 @@ void CACFLayerTreeHost::flushPendingLayerChangesNow() ...@@ -549,9 +535,25 @@ void CACFLayerTreeHost::flushPendingLayerChangesNow()
renderSoon(); renderSoon();
// All pending animations will have been started with the flush. Fire the animationStarted calls.
notifyAnimationsStarted();
m_isFlushingLayerChanges = false; m_isFlushingLayerChanges = false;
} }
void CACFLayerTreeHost::notifyAnimationsStarted()
{
double currentTime = WTF::currentTime();
double time = currentTime + wkCACFContextGetLastCommitTime(m_context) - CACurrentMediaTime();
ASSERT(time <= currentTime);
HashSet<RefPtr<PlatformCALayer> >::iterator end = m_pendingAnimatedLayers.end();
for (HashSet<RefPtr<PlatformCALayer> >::iterator it = m_pendingAnimatedLayers.begin(); it != end; ++it)
(*it)->animationStarted(time);
m_pendingAnimatedLayers.clear();
}
CGRect CACFLayerTreeHost::bounds() const CGRect CACFLayerTreeHost::bounds() const
{ {
RECT clientRect; RECT clientRect;
......
...@@ -88,6 +88,7 @@ private: ...@@ -88,6 +88,7 @@ private:
void destroyRenderer(); void destroyRenderer();
void renderSoon(); void renderSoon();
void renderTimerFired(Timer<CACFLayerTreeHost>*); void renderTimerFired(Timer<CACFLayerTreeHost>*);
void notifyAnimationsStarted();
CGRect bounds() const; CGRect bounds() const;
......
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