OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 #include "CCRenderPass.h" | 7 #include "CCRenderPass.h" |
8 | 8 |
9 #include "CCLayerImpl.h" | 9 #include "CCLayerImpl.h" |
10 #include "CCMathUtil.h" | 10 #include "CCMathUtil.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 CCRenderPass::CCRenderPass(int id, IntRect outputRect, const WebKit::WebTransfor
mationMatrix& transformToRootTarget) | 25 CCRenderPass::CCRenderPass(int id, IntRect outputRect, const WebKit::WebTransfor
mationMatrix& transformToRootTarget) |
26 : m_id(id) | 26 : m_id(id) |
27 , m_transformToRootTarget(transformToRootTarget) | 27 , m_transformToRootTarget(transformToRootTarget) |
28 , m_outputRect(outputRect) | 28 , m_outputRect(outputRect) |
29 , m_hasTransparentBackground(true) | 29 , m_hasTransparentBackground(true) |
30 , m_hasOcclusionFromOutsideTargetSurface(false) | 30 , m_hasOcclusionFromOutsideTargetSurface(false) |
31 { | 31 { |
32 ASSERT(id > 0); | 32 ASSERT(id > 0); |
33 } | 33 } |
34 | 34 |
35 void CCRenderPass::appendQuadsForLayer(CCLayerImpl* layer, CCOcclusionTrackerImp
l* occlusionTracker, bool& hadMissingTiles) | 35 void CCRenderPass::appendQuadsForLayer(CCLayerImpl* layer, CCOcclusionTrackerImp
l* occlusionTracker, CCAppendQuadsData& appendQuadsData) |
36 { | 36 { |
37 const bool forSurface = false; | 37 const bool forSurface = false; |
38 CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionT
racker, layer->hasDebugBorders(), forSurface); | 38 CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionT
racker, layer->hasDebugBorders(), forSurface); |
39 | 39 |
40 layer->appendQuads(quadCuller, hadMissingTiles); | 40 layer->appendQuads(quadCuller, appendQuadsData); |
41 | |
42 m_hasOcclusionFromOutsideTargetSurface |= quadCuller.hasOcclusionFromOutside
TargetSurface(); | |
43 } | 41 } |
44 | 42 |
45 void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer, const CC
RenderPass* contributingRenderPass, CCOcclusionTrackerImpl* occlusionTracker) | 43 void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer, const CC
RenderPass* contributingRenderPass, CCOcclusionTrackerImpl* occlusionTracker, CC
AppendQuadsData& appendQuadsData) |
46 { | 44 { |
47 const bool forSurface = true; | 45 const bool forSurface = true; |
48 CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionT
racker, layer->hasDebugBorders(), forSurface); | 46 CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionT
racker, layer->hasDebugBorders(), forSurface); |
49 | 47 |
50 bool isReplica = false; | 48 bool isReplica = false; |
51 layer->renderSurface()->appendQuads(quadCuller, isReplica, contributingRende
rPass->id()); | 49 layer->renderSurface()->appendQuads(quadCuller, appendQuadsData, isReplica,
contributingRenderPass->id()); |
52 | 50 |
53 // Add replica after the surface so that it appears below the surface. | 51 // Add replica after the surface so that it appears below the surface. |
54 if (layer->hasReplica()) { | 52 if (layer->hasReplica()) { |
55 isReplica = true; | 53 isReplica = true; |
56 layer->renderSurface()->appendQuads(quadCuller, isReplica, contributingR
enderPass->id()); | 54 layer->renderSurface()->appendQuads(quadCuller, appendQuadsData, isRepli
ca, contributingRenderPass->id()); |
57 } | 55 } |
58 | |
59 m_hasOcclusionFromOutsideTargetSurface |= quadCuller.hasOcclusionFromOutside
TargetSurface(); | |
60 } | 56 } |
61 | 57 |
62 void CCRenderPass::appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor scree
nBackgroundColor, const CCOcclusionTrackerImpl& occlusionTracker) | 58 void CCRenderPass::appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor scree
nBackgroundColor, const CCOcclusionTrackerImpl& occlusionTracker) |
63 { | 59 { |
64 if (!rootLayer || !screenBackgroundColor) | 60 if (!rootLayer || !screenBackgroundColor) |
65 return; | 61 return; |
66 | 62 |
67 Region fillRegion = occlusionTracker.computeVisibleRegionInScreen(); | 63 Region fillRegion = occlusionTracker.computeVisibleRegionInScreen(); |
68 if (fillRegion.isEmpty()) | 64 if (fillRegion.isEmpty()) |
69 return; | 65 return; |
(...skipping 13 matching lines...) Expand all Loading... |
83 Vector<IntRect> fillRects = fillRegion.rects(); | 79 Vector<IntRect> fillRects = fillRegion.rects(); |
84 for (size_t i = 0; i < fillRects.size(); ++i) { | 80 for (size_t i = 0; i < fillRects.size(); ++i) { |
85 // The root layer transform is composed of translations and scales only,
no perspective, so mapping is sufficient. | 81 // The root layer transform is composed of translations and scales only,
no perspective, so mapping is sufficient. |
86 IntRect layerRect = CCMathUtil::mapClippedRect(transformToLayerSpace, fi
llRects[i]); | 82 IntRect layerRect = CCMathUtil::mapClippedRect(transformToLayerSpace, fi
llRects[i]); |
87 // Skip the quad culler and just append the quads directly to avoid occl
usion checks. | 83 // Skip the quad culler and just append the quads directly to avoid occl
usion checks. |
88 m_quadList.append(CCSolidColorDrawQuad::create(sharedQuadState, layerRec
t, screenBackgroundColor)); | 84 m_quadList.append(CCSolidColorDrawQuad::create(sharedQuadState, layerRec
t, screenBackgroundColor)); |
89 } | 85 } |
90 } | 86 } |
91 | 87 |
92 } | 88 } |
OLD | NEW |