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

Side by Side Diff: cc/quad_culler.cc

Issue 11411050: cc: Make the DrawQuad subclasses into struct-like classes. (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/picture_layer_impl.cc ('k') | cc/render_pass.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/quad_culler.h" 5 #include "cc/quad_culler.h"
6 6
7 #include "cc/append_quads_data.h" 7 #include "cc/append_quads_data.h"
8 #include "cc/debug_border_draw_quad.h" 8 #include "cc/debug_border_draw_quad.h"
9 #include "cc/debug_colors.h" 9 #include "cc/debug_colors.h"
10 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 drawQuad->visible_rect = culledRect; 46 drawQuad->visible_rect = culledRect;
47 47
48 occlusionTracker.overdrawMetrics().didCullForDrawing(drawQuad->quadTransform (), drawQuad->rect, culledRect); 48 occlusionTracker.overdrawMetrics().didCullForDrawing(drawQuad->quadTransform (), drawQuad->rect, culledRect);
49 gfx::Rect opaqueDrawRect = drawQuad->opacity() == 1.0f ? drawQuad->opaque_re ct : gfx::Rect(); 49 gfx::Rect opaqueDrawRect = drawQuad->opacity() == 1.0f ? drawQuad->opaque_re ct : gfx::Rect();
50 occlusionTracker.overdrawMetrics().didDraw(drawQuad->quadTransform(), culled Rect, opaqueDrawRect); 50 occlusionTracker.overdrawMetrics().didDraw(drawQuad->quadTransform(), culled Rect, opaqueDrawRect);
51 51
52 if (keepQuad) { 52 if (keepQuad) {
53 if (createDebugBorderQuads && !drawQuad->IsDebugQuad() && drawQuad->visi ble_rect != drawQuad->rect) { 53 if (createDebugBorderQuads && !drawQuad->IsDebugQuad() && drawQuad->visi ble_rect != drawQuad->rect) {
54 SkColor color = DebugColors::CulledTileBorderColor(); 54 SkColor color = DebugColors::CulledTileBorderColor();
55 float width = DebugColors::CulledTileBorderWidth(layer ? layer->laye rTreeHostImpl() : NULL); 55 float width = DebugColors::CulledTileBorderWidth(layer ? layer->laye rTreeHostImpl() : NULL);
56 quadList.append(DebugBorderDrawQuad::create(drawQuad->shared_quad_st ate, drawQuad->visible_rect, color, width).PassAs<DrawQuad>()); 56 scoped_ptr<DebugBorderDrawQuad> debugBorderQuad = DebugBorderDrawQua d::Create();
57 debugBorderQuad->SetNew(drawQuad->shared_quad_state, drawQuad->visib le_rect, color, width);
58 quadList.append(debugBorderQuad.PassAs<DrawQuad>());
57 } 59 }
58 60
59 // Pass the quad after we're done using it. 61 // Pass the quad after we're done using it.
60 quadList.append(drawQuad.Pass()); 62 quadList.append(drawQuad.Pass());
61 } 63 }
62 return keepQuad; 64 return keepQuad;
63 } 65 }
64 66
65 bool QuadCuller::append(scoped_ptr<DrawQuad> drawQuad, AppendQuadsData& appendQu adsData) 67 bool QuadCuller::append(scoped_ptr<DrawQuad> drawQuad, AppendQuadsData& appendQu adsData)
66 { 68 {
67 DCHECK(drawQuad->shared_quad_state == m_currentSharedQuadState); 69 DCHECK(drawQuad->shared_quad_state == m_currentSharedQuadState);
68 DCHECK(!m_sharedQuadStateList.isEmpty()); 70 DCHECK(!m_sharedQuadStateList.isEmpty());
69 DCHECK(m_sharedQuadStateList.last() == m_currentSharedQuadState); 71 DCHECK(m_sharedQuadStateList.last() == m_currentSharedQuadState);
70 72
71 gfx::Rect culledRect; 73 gfx::Rect culledRect;
72 bool hasOcclusionFromOutsideTargetSurface; 74 bool hasOcclusionFromOutsideTargetSurface;
73 bool implDrawTransformIsUnknown = false; 75 bool implDrawTransformIsUnknown = false;
74 76
75 if (m_forSurface) 77 if (m_forSurface)
76 culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRec t(m_layer, false, drawQuad->rect, &hasOcclusionFromOutsideTargetSurface); 78 culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRec t(m_layer, false, drawQuad->rect, &hasOcclusionFromOutsideTargetSurface);
77 else 79 else
78 culledRect = m_occlusionTracker->unoccludedContentRect(m_layer->renderTa rget(), drawQuad->rect, drawQuad->quadTransform(), implDrawTransformIsUnknown, d rawQuad->clippedRectInTarget(), &hasOcclusionFromOutsideTargetSurface); 80 culledRect = m_occlusionTracker->unoccludedContentRect(m_layer->renderTa rget(), drawQuad->rect, drawQuad->quadTransform(), implDrawTransformIsUnknown, d rawQuad->clippedRectInTarget(), &hasOcclusionFromOutsideTargetSurface);
79 81
80 appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOuts ideTargetSurface; 82 appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOuts ideTargetSurface;
81 83
82 return appendQuadInternal(drawQuad.Pass(), culledRect, m_quadList, *m_occlus ionTracker, m_layer, m_showCullingWithDebugBorderQuads); 84 return appendQuadInternal(drawQuad.Pass(), culledRect, m_quadList, *m_occlus ionTracker, m_layer, m_showCullingWithDebugBorderQuads);
83 } 85 }
84 86
85 } // namespace cc 87 } // namespace cc
OLDNEW
« no previous file with comments | « cc/picture_layer_impl.cc ('k') | cc/render_pass.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698