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

Side by Side Diff: cc/CCQuadCuller.cpp

Issue 10984053: cc: Use ui/gfx geometry types for the CCRenderPass and CCDrawQuad classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return m_currentSharedQuadState; 50 return m_currentSharedQuadState;
51 } 51 }
52 52
53 static inline bool appendQuadInternal(PassOwnPtr<CCDrawQuad> passDrawQuad, const IntRect& culledRect, CCQuadList& quadList, const CCOcclusionTrackerImpl& occlus ionTracker, bool createDebugBorderQuads) 53 static inline bool appendQuadInternal(PassOwnPtr<CCDrawQuad> passDrawQuad, const IntRect& culledRect, CCQuadList& quadList, const CCOcclusionTrackerImpl& occlus ionTracker, bool createDebugBorderQuads)
54 { 54 {
55 OwnPtr<CCDrawQuad> drawQuad(passDrawQuad); 55 OwnPtr<CCDrawQuad> drawQuad(passDrawQuad);
56 bool keepQuad = !culledRect.isEmpty(); 56 bool keepQuad = !culledRect.isEmpty();
57 if (keepQuad) 57 if (keepQuad)
58 drawQuad->setQuadVisibleRect(culledRect); 58 drawQuad->setQuadVisibleRect(culledRect);
59 59
60 occlusionTracker.overdrawMetrics().didCullForDrawing(drawQuad->quadTransform (), drawQuad->quadRect(), culledRect); 60 occlusionTracker.overdrawMetrics().didCullForDrawing(drawQuad->quadTransform (), cc::IntRect(drawQuad->quadRect()), culledRect);
61 occlusionTracker.overdrawMetrics().didDraw(drawQuad->quadTransform(), culled Rect, drawQuad->opaqueRect()); 61 occlusionTracker.overdrawMetrics().didDraw(drawQuad->quadTransform(), culled Rect, cc::IntRect(drawQuad->opaqueRect()));
62 62
63 if (keepQuad) { 63 if (keepQuad) {
64 if (createDebugBorderQuads && !drawQuad->isDebugQuad() && drawQuad->quad VisibleRect() != drawQuad->quadRect()) { 64 if (createDebugBorderQuads && !drawQuad->isDebugQuad() && drawQuad->quad VisibleRect() != drawQuad->quadRect()) {
65 SkColor borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTile BorderColorRed, debugTileBorderColorGreen, debugTileBorderColorBlue); 65 SkColor borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTile BorderColorRed, debugTileBorderColorGreen, debugTileBorderColorBlue);
66 quadList.append(CCDebugBorderDrawQuad::create(drawQuad->sharedQuadSt ate(), drawQuad->quadVisibleRect(), borderColor, debugTileBorderWidth)); 66 quadList.append(CCDebugBorderDrawQuad::create(drawQuad->sharedQuadSt ate(), drawQuad->quadVisibleRect(), borderColor, debugTileBorderWidth));
67 } 67 }
68 68
69 // Release the quad after we're done using it. 69 // Release the quad after we're done using it.
70 quadList.append(drawQuad.release()); 70 quadList.append(drawQuad.release());
71 } 71 }
72 return keepQuad; 72 return keepQuad;
73 } 73 }
74 74
75 bool CCQuadCuller::append(PassOwnPtr<CCDrawQuad> passDrawQuad, CCAppendQuadsData & appendQuadsData) 75 bool CCQuadCuller::append(PassOwnPtr<CCDrawQuad> passDrawQuad, CCAppendQuadsData & appendQuadsData)
76 { 76 {
77 ASSERT(passDrawQuad->sharedQuadState() == m_currentSharedQuadState); 77 ASSERT(passDrawQuad->sharedQuadState() == m_currentSharedQuadState);
78 ASSERT(passDrawQuad->sharedQuadStateId() == m_currentSharedQuadState->id); 78 ASSERT(passDrawQuad->sharedQuadStateId() == m_currentSharedQuadState->id);
79 ASSERT(!m_sharedQuadStateList.isEmpty()); 79 ASSERT(!m_sharedQuadStateList.isEmpty());
80 ASSERT(m_sharedQuadStateList.last() == m_currentSharedQuadState); 80 ASSERT(m_sharedQuadStateList.last() == m_currentSharedQuadState);
81 81
82 IntRect culledRect; 82 IntRect culledRect;
83 bool hasOcclusionFromOutsideTargetSurface; 83 bool hasOcclusionFromOutsideTargetSurface;
84 84
85 if (m_forSurface) 85 if (m_forSurface)
86 culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRec t(m_layer, false, passDrawQuad->quadRect(), &hasOcclusionFromOutsideTargetSurfac e); 86 culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRec t(m_layer, false, cc::IntRect(passDrawQuad->quadRect()), &hasOcclusionFromOutsid eTargetSurface);
87 else 87 else
88 culledRect = m_occlusionTracker->unoccludedContentRect(m_layer, passDraw Quad->quadRect(), &hasOcclusionFromOutsideTargetSurface); 88 culledRect = m_occlusionTracker->unoccludedContentRect(m_layer, cc::IntR ect(passDrawQuad->quadRect()), &hasOcclusionFromOutsideTargetSurface);
89 89
90 appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOuts ideTargetSurface; 90 appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOuts ideTargetSurface;
91 91
92 return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusion Tracker, m_showCullingWithDebugBorderQuads); 92 return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusion Tracker, m_showCullingWithDebugBorderQuads);
93 } 93 }
94 94
95 } // namespace cc 95 } // namespace cc
96 #endif // USE(ACCELERATED_COMPOSITING) 96 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « cc/CCLayerTreeHostImplTest.cpp ('k') | cc/CCQuadCullerTest.cpp » ('j') | cc/math/clamp.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698