diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-25 00:09:14 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-25 00:09:14 +0000 |
commit | 94f206c1c75eb8cc4df2225a1c5c9c7b6fc96679 (patch) | |
tree | 530f51d5c75459999e4adf2a6895884ce1c15ce0 /cc/CCDebugRectHistory.cpp | |
parent | 56235947f2b023fc63cfad692c56df4e92199848 (diff) | |
download | chromium_src-94f206c1c75eb8cc4df2225a1c5c9c7b6fc96679.zip chromium_src-94f206c1c75eb8cc4df2225a1c5c9c7b6fc96679.tar.gz chromium_src-94f206c1c75eb8cc4df2225a1c5c9c7b6fc96679.tar.bz2 |
Here are gyp targets and stubs for compiling libcc and the webkit_compositor bindings in chromium. Everything is guarded behind the off-by-default use_libcc_for_compositor gyp variable. I haven't included the actual code here, but there are scripts to sync. I plan to land + manually sync the code into place until we're ready to flip the gyp switch.
Snapshot from r126652
BUG=
Review URL: https://chromiumcodereview.appspot.com/10828381
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153354 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/CCDebugRectHistory.cpp')
-rw-r--r-- | cc/CCDebugRectHistory.cpp | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/cc/CCDebugRectHistory.cpp b/cc/CCDebugRectHistory.cpp new file mode 100644 index 0000000..6cd7c99 --- /dev/null +++ b/cc/CCDebugRectHistory.cpp @@ -0,0 +1,116 @@ +// Copyright 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "config.h" + +#if USE(ACCELERATED_COMPOSITING) +#include "CCDebugRectHistory.h" + +#include "CCDamageTracker.h" +#include "CCLayerImpl.h" +#include "CCLayerTreeHost.h" +#include "CCMathUtil.h" + +namespace WebCore { + +CCDebugRectHistory::CCDebugRectHistory() +{ +} + +void CCDebugRectHistory::saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, const Vector<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSpaceRects, const CCLayerTreeSettings& settings) +{ + // For now, clear all rects from previous frames. In the future we may want to store + // all debug rects for a history of many frames. + m_debugRects.clear(); + + if (settings.showPaintRects) + savePaintRects(rootLayer); + + if (settings.showPropertyChangedRects) + savePropertyChangedRects(renderSurfaceLayerList); + + if (settings.showSurfaceDamageRects) + saveSurfaceDamageRects(renderSurfaceLayerList); + + if (settings.showScreenSpaceRects) + saveScreenSpaceRects(renderSurfaceLayerList); + + if (settings.showOccludingRects) + saveOccludingRects(occludingScreenSpaceRects); +} + + +void CCDebugRectHistory::savePaintRects(CCLayerImpl* layer) +{ + // We would like to visualize where any layer's paint rect (update rect) has changed, + // regardless of whether this layer is skipped for actual drawing or not. Therefore + // we traverse recursively over all layers, not just the render surface list. + + if (!layer->updateRect().isEmpty() && layer->drawsContent()) { + FloatRect updateContentRect = layer->updateRect(); + updateContentRect.scale(layer->contentBounds().width() / static_cast<float>(layer->bounds().width()), layer->contentBounds().height() / static_cast<float>(layer->bounds().height())); + m_debugRects.append(CCDebugRect(PaintRectType, CCMathUtil::mapClippedRect(layer->screenSpaceTransform(), updateContentRect))); + } + + for (unsigned i = 0; i < layer->children().size(); ++i) + savePaintRects(layer->children()[i].get()); +} + +void CCDebugRectHistory::savePropertyChangedRects(const Vector<CCLayerImpl*>& renderSurfaceLayerList) +{ + for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { + CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; + CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); + ASSERT(renderSurface); + + const Vector<CCLayerImpl*>& layerList = renderSurface->layerList(); + for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerIndex) { + CCLayerImpl* layer = layerList[layerIndex]; + + if (CCLayerTreeHostCommon::renderSurfaceContributesToTarget<CCLayerImpl>(layer, renderSurfaceLayer->id())) + continue; + + if (layer->layerIsAlwaysDamaged()) + continue; + + if (layer->layerPropertyChanged() || layer->layerSurfacePropertyChanged()) + m_debugRects.append(CCDebugRect(PropertyChangedRectType, CCMathUtil::mapClippedRect(layer->screenSpaceTransform(), FloatRect(FloatPoint::zero(), layer->contentBounds())))); + } + } +} + +void CCDebugRectHistory::saveSurfaceDamageRects(const Vector<CCLayerImpl* >& renderSurfaceLayerList) +{ + for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { + CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; + CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); + ASSERT(renderSurface); + + m_debugRects.append(CCDebugRect(SurfaceDamageRectType, CCMathUtil::mapClippedRect(renderSurface->screenSpaceTransform(), renderSurface->damageTracker()->currentDamageRect()))); + } +} + +void CCDebugRectHistory::saveScreenSpaceRects(const Vector<CCLayerImpl* >& renderSurfaceLayerList) +{ + for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { + CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; + CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); + ASSERT(renderSurface); + + m_debugRects.append(CCDebugRect(ScreenSpaceRectType, CCMathUtil::mapClippedRect(renderSurface->screenSpaceTransform(), renderSurface->contentRect()))); + + if (renderSurfaceLayer->replicaLayer()) + m_debugRects.append(CCDebugRect(ReplicaScreenSpaceRectType, CCMathUtil::mapClippedRect(renderSurface->replicaScreenSpaceTransform(), renderSurface->contentRect()))); + } +} + +void CCDebugRectHistory::saveOccludingRects(const Vector<IntRect>& occludingRects) +{ + for (size_t i = 0; i < occludingRects.size(); ++i) + m_debugRects.append(CCDebugRect(OccludingRectType, occludingRects[i])); +} + +} // namespace WebCore + +#endif // USE(ACCELERATED_COMPOSITING) |