Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: cc/render_pass.cc

Issue 11365239: cc: Add support for debugging layer borders directly in the compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_host.cc ('k') | cc/render_surface_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/render_pass.h" 5 #include "cc/render_pass.h"
6 6
7 #include "cc/layer_impl.h" 7 #include "cc/layer_impl.h"
8 #include "cc/math_util.h" 8 #include "cc/math_util.h"
9 #include "cc/occlusion_tracker.h" 9 #include "cc/occlusion_tracker.h"
10 #include "cc/quad_culler.h" 10 #include "cc/quad_culler.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 copyPass->setHasTransparentBackground(m_hasTransparentBackground); 47 copyPass->setHasTransparentBackground(m_hasTransparentBackground);
48 copyPass->setHasOcclusionFromOutsideTargetSurface(m_hasOcclusionFromOutsideT argetSurface); 48 copyPass->setHasOcclusionFromOutsideTargetSurface(m_hasOcclusionFromOutsideT argetSurface);
49 copyPass->setFilters(m_filters); 49 copyPass->setFilters(m_filters);
50 copyPass->setBackgroundFilters(m_backgroundFilters); 50 copyPass->setBackgroundFilters(m_backgroundFilters);
51 copyPass->setFilter(m_filter); 51 copyPass->setFilter(m_filter);
52 return copyPass.Pass(); 52 return copyPass.Pass();
53 } 53 }
54 54
55 void RenderPass::appendQuadsForLayer(LayerImpl* layer, OcclusionTrackerImpl* occ lusionTracker, AppendQuadsData& appendQuadsData) 55 void RenderPass::appendQuadsForLayer(LayerImpl* layer, OcclusionTrackerImpl* occ lusionTracker, AppendQuadsData& appendQuadsData)
56 { 56 {
57 const bool forSurface = false; 57 bool forSurface = false;
58 QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionTra cker, layer->hasDebugBorders(), forSurface); 58 QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionTra cker, layer->showDebugBorders(), forSurface);
59 59
60 layer->appendQuads(quadCuller, appendQuadsData); 60 layer->appendQuads(quadCuller, appendQuadsData);
61 } 61 }
62 62
63 void RenderPass::appendQuadsForRenderSurfaceLayer(LayerImpl* layer, const Render Pass* contributingRenderPass, OcclusionTrackerImpl* occlusionTracker, AppendQuad sData& appendQuadsData) 63 void RenderPass::appendQuadsForRenderSurfaceLayer(LayerImpl* layer, const Render Pass* contributingRenderPass, OcclusionTrackerImpl* occlusionTracker, AppendQuad sData& appendQuadsData)
64 { 64 {
65 const bool forSurface = true; 65 bool forSurface = true;
66 QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionTra cker, layer->hasDebugBorders(), forSurface); 66 QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionTra cker, layer->showDebugBorders(), forSurface);
67 67
68 bool isReplica = false; 68 bool isReplica = false;
69 layer->renderSurface()->appendQuads(quadCuller, appendQuadsData, isReplica, contributingRenderPass->id()); 69 layer->renderSurface()->appendQuads(quadCuller, appendQuadsData, isReplica, contributingRenderPass->id());
70 70
71 // Add replica after the surface so that it appears below the surface. 71 // Add replica after the surface so that it appears below the surface.
72 if (layer->hasReplica()) { 72 if (layer->hasReplica()) {
73 isReplica = true; 73 isReplica = true;
74 layer->renderSurface()->appendQuads(quadCuller, appendQuadsData, isRepli ca, contributingRenderPass->id()); 74 layer->renderSurface()->appendQuads(quadCuller, appendQuadsData, isRepli ca, contributingRenderPass->id());
75 } 75 }
76 } 76 }
77 77
78 void RenderPass::appendQuadsToFillScreen(LayerImpl* rootLayer, SkColor screenBac kgroundColor, const OcclusionTrackerImpl& occlusionTracker) 78 void RenderPass::appendQuadsToFillScreen(LayerImpl* rootLayer, SkColor screenBac kgroundColor, const OcclusionTrackerImpl& occlusionTracker)
79 { 79 {
80 if (!rootLayer || !screenBackgroundColor) 80 if (!rootLayer || !screenBackgroundColor)
81 return; 81 return;
82 82
83 Region fillRegion = occlusionTracker.computeVisibleRegionInScreen(); 83 Region fillRegion = occlusionTracker.computeVisibleRegionInScreen();
84 if (fillRegion.IsEmpty()) 84 if (fillRegion.IsEmpty())
85 return; 85 return;
86 86
87 bool forSurface = false; 87 bool forSurface = false;
88 QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, rootLayer, &occlusi onTracker, rootLayer->hasDebugBorders(), forSurface); 88 QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, rootLayer, &occlusi onTracker, rootLayer->showDebugBorders(), forSurface);
89 89
90 // Manually create the quad state for the gutter quads, as the root layer 90 // Manually create the quad state for the gutter quads, as the root layer
91 // doesn't have any bounds and so can't generate this itself. 91 // doesn't have any bounds and so can't generate this itself.
92 // FIXME: Make the gutter quads generated by the solid color layer (make it smarter about generating quads to fill unoccluded areas). 92 // FIXME: Make the gutter quads generated by the solid color layer (make it smarter about generating quads to fill unoccluded areas).
93 gfx::Rect rootTargetRect = rootLayer->renderSurface()->contentRect(); 93 gfx::Rect rootTargetRect = rootLayer->renderSurface()->contentRect();
94 float opacity = 1; 94 float opacity = 1;
95 bool opaque = true; 95 bool opaque = true;
96 SharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(SharedQuadS tate::create(rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity , opaque)); 96 SharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(SharedQuadS tate::create(rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity , opaque));
97 DCHECK(rootLayer->screenSpaceTransform().isInvertible()); 97 DCHECK(rootLayer->screenSpaceTransform().isInvertible());
98 WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransf orm().inverse(); 98 WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransf orm().inverse();
99 for (Region::Iterator fillRects(fillRegion); fillRects.has_rect(); fillRects .next()) { 99 for (Region::Iterator fillRects(fillRegion); fillRects.has_rect(); fillRects .next()) {
100 // The root layer transform is composed of translations and scales only, no perspective, so mapping is sufficient. 100 // The root layer transform is composed of translations and scales only, no perspective, so mapping is sufficient.
101 gfx::Rect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, fi llRects.rect()); 101 gfx::Rect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, fi llRects.rect());
102 // Skip the quad culler and just append the quads directly to avoid occl usion checks. 102 // Skip the quad culler and just append the quads directly to avoid occl usion checks.
103 m_quadList.append(SolidColorDrawQuad::create(sharedQuadState, layerRect, screenBackgroundColor).PassAs<DrawQuad>()); 103 m_quadList.append(SolidColorDrawQuad::create(sharedQuadState, layerRect, screenBackgroundColor).PassAs<DrawQuad>());
104 } 104 }
105 } 105 }
106 106
107 void RenderPass::setFilter(SkImageFilter* filter) { 107 void RenderPass::setFilter(SkImageFilter* filter) {
108 SkRefCnt_SafeAssign(m_filter, filter); 108 SkRefCnt_SafeAssign(m_filter, filter);
109 } 109 }
110 110
111 } // namespace cc 111 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host.cc ('k') | cc/render_surface_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698