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

Side by Side Diff: cc/CCQuadCuller.cpp

Issue 10989024: cc: Remove OwnPtr usage from CCRenderPass and CCDrawQuad class hierarchy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 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/CCQuadCuller.h ('k') | cc/CCQuadSink.h » ('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 "config.h" 5 #include "config.h"
6 6
7 #if USE(ACCELERATED_COMPOSITING) 7 #if USE(ACCELERATED_COMPOSITING)
8 8
9 #include "CCQuadCuller.h" 9 #include "CCQuadCuller.h"
10 10
(...skipping 21 matching lines...) Expand all
32 : m_quadList(quadList) 32 : m_quadList(quadList)
33 , m_sharedQuadStateList(sharedQuadStateList) 33 , m_sharedQuadStateList(sharedQuadStateList)
34 , m_currentSharedQuadState(0) 34 , m_currentSharedQuadState(0)
35 , m_layer(layer) 35 , m_layer(layer)
36 , m_occlusionTracker(occlusionTracker) 36 , m_occlusionTracker(occlusionTracker)
37 , m_showCullingWithDebugBorderQuads(showCullingWithDebugBorderQuads) 37 , m_showCullingWithDebugBorderQuads(showCullingWithDebugBorderQuads)
38 , m_forSurface(forSurface) 38 , m_forSurface(forSurface)
39 { 39 {
40 } 40 }
41 41
42 CCSharedQuadState* CCQuadCuller::useSharedQuadState(PassOwnPtr<CCSharedQuadState > passSharedQuadState) 42 CCSharedQuadState* CCQuadCuller::useSharedQuadState(scoped_ptr<CCSharedQuadState > sharedQuadState)
43 { 43 {
44 OwnPtr<CCSharedQuadState> sharedQuadState(passSharedQuadState);
45 sharedQuadState->id = m_sharedQuadStateList.size(); 44 sharedQuadState->id = m_sharedQuadStateList.size();
46 45
47 // FIXME: If all quads are culled for the sharedQuadState, we can drop it fr om the list. 46 // FIXME: If all quads are culled for the sharedQuadState, we can drop it fr om the list.
48 m_currentSharedQuadState = sharedQuadState.get(); 47 m_currentSharedQuadState = sharedQuadState.get();
49 m_sharedQuadStateList.append(sharedQuadState.release()); 48 m_sharedQuadStateList.append(sharedQuadState.Pass());
50 return m_currentSharedQuadState; 49 return m_currentSharedQuadState;
51 } 50 }
52 51
53 static inline bool appendQuadInternal(PassOwnPtr<CCDrawQuad> passDrawQuad, const IntRect& culledRect, CCQuadList& quadList, const CCOcclusionTrackerImpl& occlus ionTracker, bool createDebugBorderQuads) 52 static inline bool appendQuadInternal(scoped_ptr<CCDrawQuad> drawQuad, const Int Rect& culledRect, CCQuadList& quadList, const CCOcclusionTrackerImpl& occlusionT racker, bool createDebugBorderQuads)
54 { 53 {
55 OwnPtr<CCDrawQuad> drawQuad(passDrawQuad);
56 bool keepQuad = !culledRect.isEmpty(); 54 bool keepQuad = !culledRect.isEmpty();
57 if (keepQuad) 55 if (keepQuad)
58 drawQuad->setQuadVisibleRect(culledRect); 56 drawQuad->setQuadVisibleRect(culledRect);
59 57
60 occlusionTracker.overdrawMetrics().didCullForDrawing(drawQuad->quadTransform (), drawQuad->quadRect(), culledRect); 58 occlusionTracker.overdrawMetrics().didCullForDrawing(drawQuad->quadTransform (), drawQuad->quadRect(), culledRect);
61 occlusionTracker.overdrawMetrics().didDraw(drawQuad->quadTransform(), culled Rect, drawQuad->opaqueRect()); 59 occlusionTracker.overdrawMetrics().didDraw(drawQuad->quadTransform(), culled Rect, drawQuad->opaqueRect());
62 60
63 if (keepQuad) { 61 if (keepQuad) {
64 if (createDebugBorderQuads && !drawQuad->isDebugQuad() && drawQuad->quad VisibleRect() != drawQuad->quadRect()) { 62 if (createDebugBorderQuads && !drawQuad->isDebugQuad() && drawQuad->quad VisibleRect() != drawQuad->quadRect()) {
65 SkColor borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTile BorderColorRed, debugTileBorderColorGreen, debugTileBorderColorBlue); 63 SkColor borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTile BorderColorRed, debugTileBorderColorGreen, debugTileBorderColorBlue);
66 quadList.append(CCDebugBorderDrawQuad::create(drawQuad->sharedQuadSt ate(), drawQuad->quadVisibleRect(), borderColor, debugTileBorderWidth)); 64 quadList.append(CCDebugBorderDrawQuad::create(drawQuad->sharedQuadSt ate(), drawQuad->quadVisibleRect(), borderColor, debugTileBorderWidth).PassAs<CC DrawQuad>());
67 } 65 }
68 66
69 // Release the quad after we're done using it. 67 // Pass the quad after we're done using it.
70 quadList.append(drawQuad.release()); 68 quadList.append(drawQuad.Pass());
71 } 69 }
72 return keepQuad; 70 return keepQuad;
73 } 71 }
74 72
75 bool CCQuadCuller::append(PassOwnPtr<CCDrawQuad> passDrawQuad, CCAppendQuadsData & appendQuadsData) 73 bool CCQuadCuller::append(scoped_ptr<CCDrawQuad> drawQuad, CCAppendQuadsData& ap pendQuadsData)
76 { 74 {
77 ASSERT(passDrawQuad->sharedQuadState() == m_currentSharedQuadState); 75 ASSERT(drawQuad->sharedQuadState() == m_currentSharedQuadState);
78 ASSERT(passDrawQuad->sharedQuadStateId() == m_currentSharedQuadState->id); 76 ASSERT(drawQuad->sharedQuadStateId() == m_currentSharedQuadState->id);
79 ASSERT(!m_sharedQuadStateList.isEmpty()); 77 ASSERT(!m_sharedQuadStateList.isEmpty());
80 ASSERT(m_sharedQuadStateList.last() == m_currentSharedQuadState); 78 ASSERT(m_sharedQuadStateList.last() == m_currentSharedQuadState);
81 79
82 IntRect culledRect; 80 IntRect culledRect;
83 bool hasOcclusionFromOutsideTargetSurface; 81 bool hasOcclusionFromOutsideTargetSurface;
84 82
85 if (m_forSurface) 83 if (m_forSurface)
86 culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRec t(m_layer, false, passDrawQuad->quadRect(), &hasOcclusionFromOutsideTargetSurfac e); 84 culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRec t(m_layer, false, drawQuad->quadRect(), &hasOcclusionFromOutsideTargetSurface);
87 else 85 else
88 culledRect = m_occlusionTracker->unoccludedContentRect(m_layer, passDraw Quad->quadRect(), &hasOcclusionFromOutsideTargetSurface); 86 culledRect = m_occlusionTracker->unoccludedContentRect(m_layer, drawQuad ->quadRect(), &hasOcclusionFromOutsideTargetSurface);
89 87
90 appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOuts ideTargetSurface; 88 appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOuts ideTargetSurface;
91 89
92 return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusion Tracker, m_showCullingWithDebugBorderQuads); 90 return appendQuadInternal(drawQuad.Pass(), culledRect, m_quadList, *m_occlus ionTracker, m_showCullingWithDebugBorderQuads);
93 } 91 }
94 92
95 } // namespace cc 93 } // namespace cc
96 #endif // USE(ACCELERATED_COMPOSITING) 94 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « cc/CCQuadCuller.h ('k') | cc/CCQuadSink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698