| 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 "cc/render_pass.h" | 7 #include "cc/render_pass.h" |
| 8 | 8 |
| 9 #include "cc/layer_impl.h" | 9 #include "cc/layer_impl.h" |
| 10 #include "cc/math_util.h" | 10 #include "cc/math_util.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 layer->renderSurface()->appendQuads(quadCuller, appendQuadsData, isRepli
ca, contributingRenderPass->id()); | 76 layer->renderSurface()->appendQuads(quadCuller, appendQuadsData, isRepli
ca, contributingRenderPass->id()); |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 void RenderPass::appendQuadsToFillScreen(LayerImpl* rootLayer, SkColor screenBac
kgroundColor, const OcclusionTrackerImpl& occlusionTracker) | 80 void RenderPass::appendQuadsToFillScreen(LayerImpl* rootLayer, SkColor screenBac
kgroundColor, const OcclusionTrackerImpl& occlusionTracker) |
| 81 { | 81 { |
| 82 if (!rootLayer || !screenBackgroundColor) | 82 if (!rootLayer || !screenBackgroundColor) |
| 83 return; | 83 return; |
| 84 | 84 |
| 85 Region fillRegion = occlusionTracker.computeVisibleRegionInScreen(); | 85 Region fillRegion = occlusionTracker.computeVisibleRegionInScreen(); |
| 86 if (fillRegion.isEmpty()) | 86 if (fillRegion.IsEmpty()) |
| 87 return; | 87 return; |
| 88 | 88 |
| 89 bool forSurface = false; | 89 bool forSurface = false; |
| 90 QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, rootLayer, &occlusi
onTracker, rootLayer->hasDebugBorders(), forSurface); | 90 QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, rootLayer, &occlusi
onTracker, rootLayer->hasDebugBorders(), forSurface); |
| 91 | 91 |
| 92 // Manually create the quad state for the gutter quads, as the root layer | 92 // Manually create the quad state for the gutter quads, as the root layer |
| 93 // doesn't have any bounds and so can't generate this itself. | 93 // doesn't have any bounds and so can't generate this itself. |
| 94 // FIXME: Make the gutter quads generated by the solid color layer (make it
smarter about generating quads to fill unoccluded areas). | 94 // FIXME: Make the gutter quads generated by the solid color layer (make it
smarter about generating quads to fill unoccluded areas). |
| 95 gfx::Rect rootTargetRect = rootLayer->renderSurface()->contentRect(); | 95 gfx::Rect rootTargetRect = rootLayer->renderSurface()->contentRect(); |
| 96 float opacity = 1; | 96 float opacity = 1; |
| 97 bool opaque = true; | 97 bool opaque = true; |
| 98 SharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(SharedQuadS
tate::create(rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity
, opaque)); | 98 SharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(SharedQuadS
tate::create(rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity
, opaque)); |
| 99 DCHECK(rootLayer->screenSpaceTransform().isInvertible()); | 99 DCHECK(rootLayer->screenSpaceTransform().isInvertible()); |
| 100 WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransf
orm().inverse(); | 100 WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransf
orm().inverse(); |
| 101 Vector<WebCore::IntRect> fillRects = fillRegion.rects(); | 101 Vector<WebCore::IntRect> fillRects = fillRegion.rects(); |
| 102 for (size_t i = 0; i < fillRects.size(); ++i) { | 102 for (size_t i = 0; i < fillRects.size(); ++i) { |
| 103 // 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. |
| 104 gfx::Rect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, cc
::IntRect(fillRects[i])); | 104 gfx::Rect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, cc
::IntRect(fillRects[i])); |
| 105 // 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. |
| 106 m_quadList.append(SolidColorDrawQuad::create(sharedQuadState, layerRect,
screenBackgroundColor).PassAs<DrawQuad>()); | 106 m_quadList.append(SolidColorDrawQuad::create(sharedQuadState, layerRect,
screenBackgroundColor).PassAs<DrawQuad>()); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 void RenderPass::setFilter(SkImageFilter* filter) { | 110 void RenderPass::setFilter(SkImageFilter* filter) { |
| 111 SkRefCnt_SafeAssign(m_filter, filter); | 111 SkRefCnt_SafeAssign(m_filter, filter); |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace cc | 114 } // namespace cc |
| OLD | NEW |