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

Side by Side Diff: cc/quad_culler.cc

Issue 11418047: cc: Turn DrawQuad into a struct-like class with public data members. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no virtual for SetAll() 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/nine_patch_layer_impl_unittest.cc ('k') | cc/quad_culler_unittest.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 25 matching lines...) Expand all
36 // FIXME: If all quads are culled for the sharedQuadState, we can drop it fr om the list. 36 // FIXME: If all quads are culled for the sharedQuadState, we can drop it fr om the list.
37 m_currentSharedQuadState = sharedQuadState.get(); 37 m_currentSharedQuadState = sharedQuadState.get();
38 m_sharedQuadStateList.append(sharedQuadState.Pass()); 38 m_sharedQuadStateList.append(sharedQuadState.Pass());
39 return m_currentSharedQuadState; 39 return m_currentSharedQuadState;
40 } 40 }
41 41
42 static inline bool appendQuadInternal(scoped_ptr<DrawQuad> drawQuad, const gfx:: Rect& culledRect, QuadList& quadList, const OcclusionTrackerImpl& occlusionTrack er, LayerImpl* layer, bool createDebugBorderQuads) 42 static inline bool appendQuadInternal(scoped_ptr<DrawQuad> drawQuad, const gfx:: Rect& culledRect, QuadList& quadList, const OcclusionTrackerImpl& occlusionTrack er, LayerImpl* layer, bool createDebugBorderQuads)
43 { 43 {
44 bool keepQuad = !culledRect.IsEmpty(); 44 bool keepQuad = !culledRect.IsEmpty();
45 if (keepQuad) 45 if (keepQuad)
46 drawQuad->set_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 quadList.append(DebugBorderDrawQuad::create(drawQuad->shared_quad_st ate, drawQuad->visible_rect, color, width).PassAs<DrawQuad>());
57 } 57 }
58 58
59 // Pass the quad after we're done using it. 59 // Pass the quad after we're done using it.
60 quadList.append(drawQuad.Pass()); 60 quadList.append(drawQuad.Pass());
61 } 61 }
62 return keepQuad; 62 return keepQuad;
63 } 63 }
64 64
65 bool QuadCuller::append(scoped_ptr<DrawQuad> drawQuad, AppendQuadsData& appendQu adsData) 65 bool QuadCuller::append(scoped_ptr<DrawQuad> drawQuad, AppendQuadsData& appendQu adsData)
66 { 66 {
67 DCHECK(drawQuad->shared_quad_state() == m_currentSharedQuadState); 67 DCHECK(drawQuad->shared_quad_state == m_currentSharedQuadState);
68 DCHECK(!m_sharedQuadStateList.isEmpty()); 68 DCHECK(!m_sharedQuadStateList.isEmpty());
69 DCHECK(m_sharedQuadStateList.last() == m_currentSharedQuadState); 69 DCHECK(m_sharedQuadStateList.last() == m_currentSharedQuadState);
70 70
71 gfx::Rect culledRect; 71 gfx::Rect culledRect;
72 bool hasOcclusionFromOutsideTargetSurface; 72 bool hasOcclusionFromOutsideTargetSurface;
73 bool implDrawTransformIsUnknown = false; 73 bool implDrawTransformIsUnknown = false;
74 74
75 if (m_forSurface) 75 if (m_forSurface)
76 culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRec t(m_layer, false, drawQuad->rect(), &hasOcclusionFromOutsideTargetSurface); 76 culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRec t(m_layer, false, drawQuad->rect, &hasOcclusionFromOutsideTargetSurface);
77 else 77 else
78 culledRect = m_occlusionTracker->unoccludedContentRect(m_layer->renderTa rget(), drawQuad->rect(), drawQuad->quadTransform(), implDrawTransformIsUnknown, drawQuad->clippedRectInTarget(), &hasOcclusionFromOutsideTargetSurface); 78 culledRect = m_occlusionTracker->unoccludedContentRect(m_layer->renderTa rget(), drawQuad->rect, drawQuad->quadTransform(), implDrawTransformIsUnknown, d rawQuad->clippedRectInTarget(), &hasOcclusionFromOutsideTargetSurface);
79 79
80 appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOuts ideTargetSurface; 80 appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOuts ideTargetSurface;
81 81
82 return appendQuadInternal(drawQuad.Pass(), culledRect, m_quadList, *m_occlus ionTracker, m_layer, m_showCullingWithDebugBorderQuads); 82 return appendQuadInternal(drawQuad.Pass(), culledRect, m_quadList, *m_occlus ionTracker, m_layer, m_showCullingWithDebugBorderQuads);
83 } 83 }
84 84
85 } // namespace cc 85 } // namespace cc
OLDNEW
« no previous file with comments | « cc/nine_patch_layer_impl_unittest.cc ('k') | cc/quad_culler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698