| 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 "cc/render_pass.h" | 5 #include "cc/render_pass.h" |
| 6 | 6 |
| 7 #include "cc/layer_impl.h" | 7 #include "cc/layer_impl.h" |
| 8 #include "cc/math_util.h" | 8 #include "cc/math_util.h" |
| 9 #include "cc/occlusion_tracker.h" | 9 #include "cc/occlusion_tracker.h" |
| 10 #include "cc/quad_culler.h" | 10 #include "cc/quad_culler.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 Region fillRegion = occlusionTracker.computeVisibleRegionInScreen(); | 83 Region fillRegion = occlusionTracker.computeVisibleRegionInScreen(); |
| 84 if (fillRegion.IsEmpty()) | 84 if (fillRegion.IsEmpty()) |
| 85 return; | 85 return; |
| 86 | 86 |
| 87 bool forSurface = false; | 87 bool forSurface = false; |
| 88 QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, rootLayer, &occlusi
onTracker, rootLayer->showDebugBorders(), forSurface); | 88 QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, rootLayer, &occlusi
onTracker, rootLayer->showDebugBorders(), forSurface); |
| 89 | 89 |
| 90 // Manually create the quad state for the gutter quads, as the root layer | 90 // Manually create the quad state for the gutter quads, as the root layer |
| 91 // doesn't have any bounds and so can't generate this itself. | 91 // doesn't have any bounds and so can't generate this itself. |
| 92 // FIXME: Make the gutter quads generated by the solid color layer (make it
smarter about generating quads to fill unoccluded areas). | 92 // FIXME: Make the gutter quads generated by the solid color layer (make it
smarter about generating quads to fill unoccluded areas). |
| 93 |
| 94 DCHECK(rootLayer->screenSpaceTransform().isInvertible()); |
| 95 |
| 93 gfx::Rect rootTargetRect = rootLayer->renderSurface()->contentRect(); | 96 gfx::Rect rootTargetRect = rootLayer->renderSurface()->contentRect(); |
| 94 float opacity = 1; | 97 float opacity = 1; |
| 95 SharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(SharedQuadS
tate::create(rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity
)); | 98 SharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(SharedQuadS
tate::Create()); |
| 96 DCHECK(rootLayer->screenSpaceTransform().isInvertible()); | 99 sharedQuadState->SetAll(rootLayer->drawTransform(), rootTargetRect, rootTarg
etRect, opacity); |
| 100 |
| 97 WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransf
orm().inverse(); | 101 WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransf
orm().inverse(); |
| 98 for (Region::Iterator fillRects(fillRegion); fillRects.has_rect(); fillRects
.next()) { | 102 for (Region::Iterator fillRects(fillRegion); fillRects.has_rect(); fillRects
.next()) { |
| 99 // The root layer transform is composed of translations and scales only,
no perspective, so mapping is sufficient. | 103 // The root layer transform is composed of translations and scales only,
no perspective, so mapping is sufficient. |
| 100 gfx::Rect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, fi
llRects.rect()); | 104 gfx::Rect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, fi
llRects.rect()); |
| 101 // Skip the quad culler and just append the quads directly to avoid occl
usion checks. | 105 // Skip the quad culler and just append the quads directly to avoid occl
usion checks. |
| 102 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); | 106 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); |
| 103 quad->SetNew(sharedQuadState, layerRect, screenBackgroundColor); | 107 quad->SetNew(sharedQuadState, layerRect, screenBackgroundColor); |
| 104 m_quadList.append(quad.PassAs<DrawQuad>()); | 108 m_quadList.append(quad.PassAs<DrawQuad>()); |
| 105 } | 109 } |
| 106 } | 110 } |
| 107 | 111 |
| 108 void RenderPass::setFilter(SkImageFilter* filter) { | 112 void RenderPass::setFilter(SkImageFilter* filter) { |
| 109 SkRefCnt_SafeAssign(m_filter, filter); | 113 SkRefCnt_SafeAssign(m_filter, filter); |
| 110 } | 114 } |
| 111 | 115 |
| 112 } // namespace cc | 116 } // namespace cc |
| OLD | NEW |