OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCLayerTreeHost.h" | 7 #include "CCLayerTreeHost.h" |
8 | 8 |
9 #include "CCFontAtlas.h" | 9 #include "CCFontAtlas.h" |
10 #include "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 return; | 157 return; |
158 } | 158 } |
159 | 159 |
160 // Update m_settings based on capabilities that we got back from the rendere
r. | 160 // Update m_settings based on capabilities that we got back from the rendere
r. |
161 m_settings.acceleratePainting = m_proxy->rendererCapabilities().usingAcceler
atedPainting; | 161 m_settings.acceleratePainting = m_proxy->rendererCapabilities().usingAcceler
atedPainting; |
162 | 162 |
163 // Update m_settings based on partial update capability. | 163 // Update m_settings based on partial update capability. |
164 m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdate
s, m_proxy->maxPartialTextureUpdates()); | 164 m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdate
s, m_proxy->maxPartialTextureUpdates()); |
165 | 165 |
166 m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->r
endererCapabilities().maxTextureSize, CCRenderer::ContentPool); | 166 m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->r
endererCapabilities().maxTextureSize, CCRenderer::ContentPool); |
167 m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize
(), GraphicsContext3D::RGBA); | 167 m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize
(), GL_RGBA); |
168 | 168 |
169 m_rendererInitialized = true; | 169 m_rendererInitialized = true; |
170 | 170 |
171 m_settings.defaultTileSize = IntSize(min(m_settings.defaultTileSize.width(),
m_proxy->rendererCapabilities().maxTextureSize), | 171 m_settings.defaultTileSize = IntSize(min(m_settings.defaultTileSize.width(),
m_proxy->rendererCapabilities().maxTextureSize), |
172 min(m_settings.defaultTileSize.height()
, m_proxy->rendererCapabilities().maxTextureSize)); | 172 min(m_settings.defaultTileSize.height()
, m_proxy->rendererCapabilities().maxTextureSize)); |
173 m_settings.maxUntiledLayerSize = IntSize(min(m_settings.maxUntiledLayerSize.
width(), m_proxy->rendererCapabilities().maxTextureSize), | 173 m_settings.maxUntiledLayerSize = IntSize(min(m_settings.maxUntiledLayerSize.
width(), m_proxy->rendererCapabilities().maxTextureSize), |
174 min(m_settings.maxUntiledLayerSize.
height(), m_proxy->rendererCapabilities().maxTextureSize)); | 174 min(m_settings.maxUntiledLayerSize.
height(), m_proxy->rendererCapabilities().maxTextureSize)); |
175 } | 175 } |
176 | 176 |
177 CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext() | 177 CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext() |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 { | 614 { |
615 size_t readbackBytes = 0; | 615 size_t readbackBytes = 0; |
616 size_t maxBackgroundTextureBytes = 0; | 616 size_t maxBackgroundTextureBytes = 0; |
617 size_t contentsTextureBytes = 0; | 617 size_t contentsTextureBytes = 0; |
618 | 618 |
619 // Start iteration at 1 to skip the root surface as it does not have a textu
re cost. | 619 // Start iteration at 1 to skip the root surface as it does not have a textu
re cost. |
620 for (size_t i = 1; i < updateList.size(); ++i) { | 620 for (size_t i = 1; i < updateList.size(); ++i) { |
621 LayerChromium* renderSurfaceLayer = updateList[i].get(); | 621 LayerChromium* renderSurfaceLayer = updateList[i].get(); |
622 RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface
(); | 622 RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface
(); |
623 | 623 |
624 size_t bytes = CCTexture::memorySizeBytes(renderSurface->contentRect().s
ize(), GraphicsContext3D::RGBA); | 624 size_t bytes = CCTexture::memorySizeBytes(renderSurface->contentRect().s
ize(), GL_RGBA); |
625 contentsTextureBytes += bytes; | 625 contentsTextureBytes += bytes; |
626 | 626 |
627 if (renderSurfaceLayer->backgroundFilters().isEmpty()) | 627 if (renderSurfaceLayer->backgroundFilters().isEmpty()) |
628 continue; | 628 continue; |
629 | 629 |
630 if (bytes > maxBackgroundTextureBytes) | 630 if (bytes > maxBackgroundTextureBytes) |
631 maxBackgroundTextureBytes = bytes; | 631 maxBackgroundTextureBytes = bytes; |
632 if (!readbackBytes) | 632 if (!readbackBytes) |
633 readbackBytes = CCTexture::memorySizeBytes(m_deviceViewportSize, Gra
phicsContext3D::RGBA); | 633 readbackBytes = CCTexture::memorySizeBytes(m_deviceViewportSize, GL_
RGBA); |
634 } | 634 } |
635 return readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes; | 635 return readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes; |
636 } | 636 } |
637 | 637 |
638 bool CCLayerTreeHost::paintMasksForRenderSurface(LayerChromium* renderSurfaceLay
er, CCTextureUpdateQueue& queue) | 638 bool CCLayerTreeHost::paintMasksForRenderSurface(LayerChromium* renderSurfaceLay
er, CCTextureUpdateQueue& queue) |
639 { | 639 { |
640 // Note: Masks and replicas only exist for layers that own render surfaces.
If we reach this point | 640 // Note: Masks and replicas only exist for layers that own render surfaces.
If we reach this point |
641 // in code, we already know that at least something will be drawn into this
render surface, so the | 641 // in code, we already know that at least something will be drawn into this
render surface, so the |
642 // mask and replica should be painted. | 642 // mask and replica should be painted. |
643 | 643 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 else | 817 else |
818 layer->notifyAnimationFinished(wallClockTime); | 818 layer->notifyAnimationFinished(wallClockTime); |
819 } | 819 } |
820 } | 820 } |
821 | 821 |
822 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 822 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
823 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 823 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
824 } | 824 } |
825 | 825 |
826 } // namespace cc | 826 } // namespace cc |
OLD | NEW |