OLD | NEW |
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 |
| 11 #include "CCAppendQuadsData.h" |
11 #include "CCDebugBorderDrawQuad.h" | 12 #include "CCDebugBorderDrawQuad.h" |
12 #include "CCLayerImpl.h" | 13 #include "CCLayerImpl.h" |
13 #include "CCOcclusionTracker.h" | 14 #include "CCOcclusionTracker.h" |
14 #include "CCOverdrawMetrics.h" | 15 #include "CCOverdrawMetrics.h" |
15 #include "CCRenderPass.h" | 16 #include "CCRenderPass.h" |
16 #include "Region.h" | 17 #include "Region.h" |
17 #include "SkColor.h" | 18 #include "SkColor.h" |
18 #include <public/WebTransformationMatrix.h> | 19 #include <public/WebTransformationMatrix.h> |
19 | 20 |
20 using namespace std; | 21 using namespace std; |
21 | 22 |
22 namespace WebCore { | 23 namespace WebCore { |
23 | 24 |
24 static const int debugTileBorderWidth = 1; | 25 static const int debugTileBorderWidth = 1; |
25 static const int debugTileBorderAlpha = 120; | 26 static const int debugTileBorderAlpha = 120; |
26 static const int debugTileBorderColorRed = 160; | 27 static const int debugTileBorderColorRed = 160; |
27 static const int debugTileBorderColorGreen = 100; | 28 static const int debugTileBorderColorGreen = 100; |
28 static const int debugTileBorderColorBlue = 0; | 29 static const int debugTileBorderColorBlue = 0; |
29 | 30 |
30 CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCSharedQuadStateList& sharedQu
adStateList, CCLayerImpl* layer, const CCOcclusionTrackerImpl* occlusionTracker,
bool showCullingWithDebugBorderQuads, bool forSurface) | 31 CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCSharedQuadStateList& sharedQu
adStateList, CCLayerImpl* layer, const CCOcclusionTrackerImpl* occlusionTracker,
bool showCullingWithDebugBorderQuads, bool forSurface) |
31 : m_quadList(quadList) | 32 : m_quadList(quadList) |
32 , m_sharedQuadStateList(sharedQuadStateList) | 33 , m_sharedQuadStateList(sharedQuadStateList) |
33 , m_currentSharedQuadState(0) | 34 , m_currentSharedQuadState(0) |
34 , m_layer(layer) | 35 , m_layer(layer) |
35 , m_occlusionTracker(occlusionTracker) | 36 , m_occlusionTracker(occlusionTracker) |
36 , m_showCullingWithDebugBorderQuads(showCullingWithDebugBorderQuads) | 37 , m_showCullingWithDebugBorderQuads(showCullingWithDebugBorderQuads) |
37 , m_forSurface(forSurface) | 38 , m_forSurface(forSurface) |
38 , m_hasOcclusionFromOutsideTargetSurface(false) | |
39 { | 39 { |
40 } | 40 } |
41 | 41 |
42 CCSharedQuadState* CCQuadCuller::useSharedQuadState(PassOwnPtr<CCSharedQuadState
> passSharedQuadState) | 42 CCSharedQuadState* CCQuadCuller::useSharedQuadState(PassOwnPtr<CCSharedQuadState
> passSharedQuadState) |
43 { | 43 { |
44 OwnPtr<CCSharedQuadState> sharedQuadState(passSharedQuadState); | 44 OwnPtr<CCSharedQuadState> sharedQuadState(passSharedQuadState); |
45 sharedQuadState->id = m_sharedQuadStateList.size(); | 45 sharedQuadState->id = m_sharedQuadStateList.size(); |
46 | 46 |
47 // FIXME: If all quads are culled for the sharedQuadState, we can drop it fr
om the list. | 47 // FIXME: If all quads are culled for the sharedQuadState, we can drop it fr
om the list. |
48 m_currentSharedQuadState = sharedQuadState.get(); | 48 m_currentSharedQuadState = sharedQuadState.get(); |
(...skipping 16 matching lines...) Expand all Loading... |
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) | 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().get() == m_currentSharedQuadState); | 80 ASSERT(m_sharedQuadStateList.last().get() == 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, passDrawQuad->quadRect(), &hasOcclusionFromOutsideTargetSurfac
e); |
87 else | 87 else |
88 culledRect = m_occlusionTracker->unoccludedContentRect(m_layer, passDraw
Quad->quadRect(), &hasOcclusionFromOutsideTargetSurface); | 88 culledRect = m_occlusionTracker->unoccludedContentRect(m_layer, passDraw
Quad->quadRect(), &hasOcclusionFromOutsideTargetSurface); |
89 m_hasOcclusionFromOutsideTargetSurface |= hasOcclusionFromOutsideTargetSurfa
ce; | 89 |
| 90 appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOuts
ideTargetSurface; |
90 | 91 |
91 return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusion
Tracker, m_showCullingWithDebugBorderQuads); | 92 return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusion
Tracker, m_showCullingWithDebugBorderQuads); |
92 } | 93 } |
93 | 94 |
94 } // namespace WebCore | 95 } // namespace WebCore |
95 #endif // USE(ACCELERATED_COMPOSITING) | 96 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |