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 #include "cc/occlusion_tracker.h" | 7 #include "cc/occlusion_tracker.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 { | 104 { |
105 // Make sure we know about the target surface. | 105 // Make sure we know about the target surface. |
106 enterRenderTarget(finishedTarget); | 106 enterRenderTarget(finishedTarget); |
107 | 107 |
108 RenderSurfaceType* surface = finishedTarget->renderSurface(); | 108 RenderSurfaceType* surface = finishedTarget->renderSurface(); |
109 | 109 |
110 // If the occlusion within the surface can not be applied to things outside
of the surface's subtree, then clear the occlusion here so it won't be used. | 110 // If the occlusion within the surface can not be applied to things outside
of the surface's subtree, then clear the occlusion here so it won't be used. |
111 // TODO(senorblanco): Make this smarter for SkImageFilter case: once | 111 // TODO(senorblanco): Make this smarter for SkImageFilter case: once |
112 // SkImageFilters can report affectsOpacity(), call that. | 112 // SkImageFilters can report affectsOpacity(), call that. |
113 if (finishedTarget->maskLayer() || !surfaceOpacityKnown(surface) || surface-
>drawOpacity() < 1 || finishedTarget->filters().hasFilterThatAffectsOpacity() ||
finishedTarget->filter()) { | 113 if (finishedTarget->maskLayer() || !surfaceOpacityKnown(surface) || surface-
>drawOpacity() < 1 || finishedTarget->filters().hasFilterThatAffectsOpacity() ||
finishedTarget->filter()) { |
114 m_stack.back().occlusionInScreen = Region(); | 114 m_stack.back().occlusionInScreen.Clear(); |
115 m_stack.back().occlusionInTarget = Region(); | 115 m_stack.back().occlusionInTarget.Clear(); |
116 } else { | 116 } else { |
117 if (!surfaceTransformsToTargetKnown(surface)) | 117 if (!surfaceTransformsToTargetKnown(surface)) |
118 m_stack.back().occlusionInTarget = Region(); | 118 m_stack.back().occlusionInTarget.Clear(); |
119 if (!surfaceTransformsToScreenKnown(surface)) | 119 if (!surfaceTransformsToScreenKnown(surface)) |
120 m_stack.back().occlusionInScreen = Region(); | 120 m_stack.back().occlusionInScreen.Clear(); |
121 } | 121 } |
122 } | 122 } |
123 | 123 |
124 template<typename RenderSurfaceType> | 124 template<typename RenderSurfaceType> |
125 static inline Region transformSurfaceOpaqueRegion(const RenderSurfaceType* surfa
ce, const Region& region, const WebTransformationMatrix& transform) | 125 static inline Region transformSurfaceOpaqueRegion(const RenderSurfaceType* surfa
ce, const Region& region, const WebTransformationMatrix& transform) |
126 { | 126 { |
127 // Verify that rects within the |surface| will remain rects in its target su
rface after applying |transform|. If this is true, then | 127 // Verify that rects within the |surface| will remain rects in its target su
rface after applying |transform|. If this is true, then |
128 // apply |transform| to each rect within |region| in order to transform the
entire Region. | 128 // apply |transform| to each rect within |region| in order to transform the
entire Region. |
129 | 129 |
130 bool clipped; | 130 bool clipped; |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 // FIXME: we could remove this helper function, but unit tests currently ove
rride this | 458 // FIXME: we could remove this helper function, but unit tests currently ove
rride this |
459 // function, and they need to be verified/adjusted before this can be
removed. | 459 // function, and they need to be verified/adjusted before this can be
removed. |
460 return layer->drawableContentRect(); | 460 return layer->drawableContentRect(); |
461 } | 461 } |
462 | 462 |
463 // Instantiate (and export) templates here for the linker. | 463 // Instantiate (and export) templates here for the linker. |
464 template class OcclusionTrackerBase<Layer, RenderSurface>; | 464 template class OcclusionTrackerBase<Layer, RenderSurface>; |
465 template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; | 465 template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; |
466 | 466 |
467 } // namespace cc | 467 } // namespace cc |
OLD | NEW |