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

Side by Side Diff: cc/quad_culler.cc

Issue 11418108: cc: Make the ScopedPtrVector and ScopedPtrDeque containers act like STL vector and deque. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android!! Created 7 years, 11 months 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_tiling_set.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 13 matching lines...) Expand all
24 , m_occlusionTracker(occlusionTracker) 24 , m_occlusionTracker(occlusionTracker)
25 , m_showCullingWithDebugBorderQuads(showCullingWithDebugBorderQuads) 25 , m_showCullingWithDebugBorderQuads(showCullingWithDebugBorderQuads)
26 , m_forSurface(forSurface) 26 , m_forSurface(forSurface)
27 { 27 {
28 } 28 }
29 29
30 SharedQuadState* QuadCuller::useSharedQuadState(scoped_ptr<SharedQuadState> shar edQuadState) 30 SharedQuadState* QuadCuller::useSharedQuadState(scoped_ptr<SharedQuadState> shar edQuadState)
31 { 31 {
32 // FIXME: If all quads are culled for the sharedQuadState, we can drop it fr om the list. 32 // FIXME: If all quads are culled for the sharedQuadState, we can drop it fr om the list.
33 m_currentSharedQuadState = sharedQuadState.get(); 33 m_currentSharedQuadState = sharedQuadState.get();
34 m_sharedQuadStateList.append(sharedQuadState.Pass()); 34 m_sharedQuadStateList.push_back(sharedQuadState.Pass());
35 return m_currentSharedQuadState; 35 return m_currentSharedQuadState;
36 } 36 }
37 37
38 static inline bool appendQuadInternal(scoped_ptr<DrawQuad> drawQuad, const gfx:: Rect& culledRect, QuadList& quadList, const OcclusionTrackerImpl& occlusionTrack er, const LayerImpl* layer, bool createDebugBorderQuads) 38 static inline bool appendQuadInternal(scoped_ptr<DrawQuad> drawQuad, const gfx:: Rect& culledRect, QuadList& quadList, const OcclusionTrackerImpl& occlusionTrack er, const LayerImpl* layer, bool createDebugBorderQuads)
39 { 39 {
40 bool keepQuad = !culledRect.IsEmpty(); 40 bool keepQuad = !culledRect.IsEmpty();
41 if (keepQuad) 41 if (keepQuad)
42 drawQuad->visible_rect = culledRect; 42 drawQuad->visible_rect = culledRect;
43 43
44 occlusionTracker.overdrawMetrics().didCullForDrawing(drawQuad->quadTransform (), drawQuad->rect, culledRect); 44 occlusionTracker.overdrawMetrics().didCullForDrawing(drawQuad->quadTransform (), drawQuad->rect, culledRect);
45 gfx::Rect opaqueDrawRect = drawQuad->opacity() == 1.0f ? drawQuad->opaque_re ct : gfx::Rect(); 45 gfx::Rect opaqueDrawRect = drawQuad->opacity() == 1.0f ? drawQuad->opaque_re ct : gfx::Rect();
46 occlusionTracker.overdrawMetrics().didDraw(drawQuad->quadTransform(), culled Rect, opaqueDrawRect); 46 occlusionTracker.overdrawMetrics().didDraw(drawQuad->quadTransform(), culled Rect, opaqueDrawRect);
47 47
48 if (keepQuad) { 48 if (keepQuad) {
49 if (createDebugBorderQuads && !drawQuad->IsDebugQuad() && drawQuad->visi ble_rect != drawQuad->rect) { 49 if (createDebugBorderQuads && !drawQuad->IsDebugQuad() && drawQuad->visi ble_rect != drawQuad->rect) {
50 SkColor color = DebugColors::CulledTileBorderColor(); 50 SkColor color = DebugColors::CulledTileBorderColor();
51 float width = DebugColors::CulledTileBorderWidth(layer ? layer->laye rTreeImpl() : NULL); 51 float width = DebugColors::CulledTileBorderWidth(layer ? layer->laye rTreeImpl() : NULL);
52 scoped_ptr<DebugBorderDrawQuad> debugBorderQuad = DebugBorderDrawQua d::Create(); 52 scoped_ptr<DebugBorderDrawQuad> debugBorderQuad = DebugBorderDrawQua d::Create();
53 debugBorderQuad->SetNew(drawQuad->shared_quad_state, drawQuad->visib le_rect, color, width); 53 debugBorderQuad->SetNew(drawQuad->shared_quad_state, drawQuad->visib le_rect, color, width);
54 quadList.append(debugBorderQuad.PassAs<DrawQuad>()); 54 quadList.push_back(debugBorderQuad.PassAs<DrawQuad>());
55 } 55 }
56 56
57 // Pass the quad after we're done using it. 57 // Pass the quad after we're done using it.
58 quadList.append(drawQuad.Pass()); 58 quadList.push_back(drawQuad.Pass());
59 } 59 }
60 return keepQuad; 60 return keepQuad;
61 } 61 }
62 62
63 bool QuadCuller::append(scoped_ptr<DrawQuad> drawQuad, AppendQuadsData& appendQu adsData) 63 bool QuadCuller::append(scoped_ptr<DrawQuad> drawQuad, AppendQuadsData& appendQu adsData)
64 { 64 {
65 DCHECK(drawQuad->shared_quad_state == m_currentSharedQuadState); 65 DCHECK(drawQuad->shared_quad_state == m_currentSharedQuadState);
66 DCHECK(!m_sharedQuadStateList.isEmpty()); 66 DCHECK(!m_sharedQuadStateList.empty());
67 DCHECK(m_sharedQuadStateList.last() == m_currentSharedQuadState); 67 DCHECK(m_sharedQuadStateList.back() == m_currentSharedQuadState);
68 68
69 gfx::Rect culledRect; 69 gfx::Rect culledRect;
70 bool hasOcclusionFromOutsideTargetSurface; 70 bool hasOcclusionFromOutsideTargetSurface;
71 bool implDrawTransformIsUnknown = false; 71 bool implDrawTransformIsUnknown = false;
72 72
73 if (m_forSurface) 73 if (m_forSurface)
74 culledRect = m_occlusionTracker.unoccludedContributingSurfaceContentRect (m_layer, false, drawQuad->rect, &hasOcclusionFromOutsideTargetSurface); 74 culledRect = m_occlusionTracker.unoccludedContributingSurfaceContentRect (m_layer, false, drawQuad->rect, &hasOcclusionFromOutsideTargetSurface);
75 else 75 else
76 culledRect = m_occlusionTracker.unoccludedContentRect(m_layer->renderTar get(), drawQuad->rect, drawQuad->quadTransform(), implDrawTransformIsUnknown, dr awQuad->clippedRectInTarget(), &hasOcclusionFromOutsideTargetSurface); 76 culledRect = m_occlusionTracker.unoccludedContentRect(m_layer->renderTar get(), drawQuad->rect, drawQuad->quadTransform(), implDrawTransformIsUnknown, dr awQuad->clippedRectInTarget(), &hasOcclusionFromOutsideTargetSurface);
77 77
78 appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOuts ideTargetSurface; 78 appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOuts ideTargetSurface;
79 79
80 return appendQuadInternal(drawQuad.Pass(), culledRect, m_quadList, m_occlusi onTracker, m_layer, m_showCullingWithDebugBorderQuads); 80 return appendQuadInternal(drawQuad.Pass(), culledRect, m_quadList, m_occlusi onTracker, m_layer, m_showCullingWithDebugBorderQuads);
81 } 81 }
82 82
83 } // namespace cc 83 } // namespace cc
OLDNEW
« no previous file with comments | « cc/picture_layer_tiling_set.cc ('k') | cc/render_pass.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698