Changeset 126046 in webkit
- Timestamp:
- Aug 20, 2012 11:23:08 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r126045 r126046 1 2012-08-20 Dana Jansens <danakj@chromium.org> 2 3 [chromium] Update HUD resources as a final step to drawing a frame 4 https://bugs.webkit.org/show_bug.cgi?id=93743 5 6 Reviewed by Adrienne Walker. 7 8 The HUD should be painted as a last step, after the whole frame has been 9 generated. This introduces a new "updateHudTexture" method on the HUD layer 10 and has the HUD layer save itself on CCLayerTreeHostImpl so that it can 11 call back to this method. 12 13 This allows the CCLayerTreeHostImpl to cause the HUD layer to update its 14 texture as a final step before drawing the frame, allowing the HUD texture 15 to contain all possible information about the current frame. 16 17 * platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp: 18 (WebCore::CCHeadsUpDisplayLayerImpl::willDraw): 19 (WebCore): 20 (WebCore::CCHeadsUpDisplayLayerImpl::appendQuads): 21 (WebCore::CCHeadsUpDisplayLayerImpl::updateHudTexture): 22 * platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h: 23 (CCHeadsUpDisplayLayerImpl): 24 * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: 25 (WebCore::CCLayerTreeHost::finishCommitOnImplThread): 26 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: 27 (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl): 28 (WebCore::CCLayerTreeHostImpl::drawLayers): 29 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: 30 (WebCore): 31 (WebCore::CCLayerTreeHostImpl::setHudLayer): 32 (WebCore::CCLayerTreeHostImpl::hudLayer): 33 (CCLayerTreeHostImpl): 34 1 35 2012-08-20 Ian Vollick <vollick@chromium.org> 2 36 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp
r125932 r126046 88 88 m_hudTexture->free(); 89 89 90 if (!m_hudTexture->id() && !m_hudTexture->allocate(CCRenderer::ImplPool, bounds(), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny)) 90 if (!m_hudTexture->id()) 91 m_hudTexture->allocate(CCRenderer::ImplPool, bounds(), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); 92 } 93 94 void CCHeadsUpDisplayLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) 95 { 96 if (!m_hudTexture->id()) 97 return; 98 99 IntRect quadRect(IntPoint(), bounds()); 100 bool premultipliedAlpha = true; 101 FloatRect uvRect(0, 0, 1, 1); 102 bool flipped = false; 103 quadList.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_hudTexture->id(), premultipliedAlpha, uvRect, flipped)); 104 } 105 106 void CCHeadsUpDisplayLayerImpl::updateHudTexture(CCResourceProvider* resourceProvider) 107 { 108 if (!m_hudTexture->id()) 91 109 return; 92 110 … … 109 127 ASSERT(bitmap->config() == SkBitmap::kARGB_8888_Config); 110 128 resourceProvider->upload(m_hudTexture->id(), static_cast<const uint8_t*>(bitmap->getPixels()), layerRect, layerRect, IntSize()); 111 }112 113 void CCHeadsUpDisplayLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&)114 {115 if (!m_hudTexture->id())116 return;117 118 IntRect quadRect(IntPoint(), bounds());119 bool premultipliedAlpha = true;120 FloatRect uvRect(0, 0, 1, 1);121 bool flipped = false;122 quadList.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_hudTexture->id(), premultipliedAlpha, uvRect, flipped));123 129 } 124 130 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h
r125932 r126046 51 51 virtual void willDraw(CCResourceProvider*) OVERRIDE; 52 52 virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; 53 void updateHudTexture(CCResourceProvider*); 53 54 virtual void didDraw(CCResourceProvider*) OVERRIDE; 54 55 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
r125932 r126046 29 29 #include "CCFontAtlas.h" 30 30 #include "CCGraphicsContext.h" 31 #include "CCHeadsUpDisplayLayerImpl.h" 31 32 #include "CCLayerAnimationController.h" 32 33 #include "CCLayerIterator.h" … … 237 238 hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostImpl->detachLayerTree(), hostImpl)); 238 239 240 if (!m_hudLayer) 241 hostImpl->setHudLayer(0); 242 else 243 hostImpl->setHudLayer(static_cast<CCHeadsUpDisplayLayerImpl*>(CCLayerTreeHostCommon::findLayerInSubtree(hostImpl->rootLayer(), m_hudLayer->id()))); 244 239 245 // We may have added an animation during the tree sync. This will cause both layer tree hosts 240 246 // to visit their controllers. -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
r126018 r126046 33 33 #include "CCFontAtlas.h" 34 34 #include "CCFrameRateCounter.h" 35 #include "CCHeadsUpDisplayLayerImpl.h" 35 36 #include "CCLayerIterator.h" 36 37 #include "CCLayerTreeHost.h" … … 120 121 , m_rootScrollLayerImpl(0) 121 122 , m_currentlyScrollingLayerImpl(0) 123 , m_hudLayerImpl(0) 122 124 , m_scrollingLayerIdFromPreviousTree(-1) 123 125 , m_scrollDeltaIsInScreenSpace(false) … … 548 550 m_fpsCounter->markBeginningOfFrame(currentTime()); 549 551 550 m_layerRenderer->drawFrame(frame.renderPasses, frame.renderPassesById);551 552 552 if (m_settings.showDebugRects()) 553 553 m_debugRectHistory->saveDebugRectsForCurrentFrame(m_rootLayerImpl.get(), *frame.renderSurfaceLayerList, frame.occludingScreenSpaceRects, settings()); 554 555 // Because the contents of the HUD depend on everything else in the frame, the contents 556 // of its texture are updated as the last thing before the frame is drawn. 557 if (m_hudLayerImpl) 558 m_hudLayerImpl->updateHudTexture(m_resourceProvider.get()); 559 560 m_layerRenderer->drawFrame(frame.renderPasses, frame.renderPassesById); 554 561 555 562 // Once a RenderPass has been drawn, its damage should be cleared in -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h
r126018 r126046 42 42 class CCDebugRectHistory; 43 43 class CCFrameRateCounter; 44 class CCHeadsUpDisplayLayerImpl; 44 45 class CCLayerImpl; 45 46 class CCLayerTreeHostImplTimeSourceAdapter; … … 141 142 CCLayerImpl* rootLayer() { return m_rootLayerImpl.get(); } 142 143 144 void setHudLayer(CCHeadsUpDisplayLayerImpl* layerImpl) { m_hudLayerImpl = layerImpl; } 145 CCHeadsUpDisplayLayerImpl* hudLayer() { return m_hudLayerImpl; } 146 143 147 // Release ownership of the current layer tree and replace it with an empty 144 148 // tree. Returns the root layer of the detached tree. … … 268 272 CCLayerImpl* m_rootScrollLayerImpl; 269 273 CCLayerImpl* m_currentlyScrollingLayerImpl; 274 CCHeadsUpDisplayLayerImpl* m_hudLayerImpl; 270 275 int m_scrollingLayerIdFromPreviousTree; 271 276 bool m_scrollDeltaIsInScreenSpace;
Note: See TracChangeset
for help on using the changeset viewer.