| 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/layers/render_surface_impl.h" | 5 #include "cc/layers/render_surface_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 RenderSurfaceImpl::RenderSurfaceImpl(LayerImpl* owning_layer) | 28 RenderSurfaceImpl::RenderSurfaceImpl(LayerImpl* owning_layer) |
| 29 : owning_layer_(owning_layer), | 29 : owning_layer_(owning_layer), |
| 30 surface_property_changed_(false), | 30 surface_property_changed_(false), |
| 31 draw_opacity_is_animating_(false), | 31 draw_opacity_is_animating_(false), |
| 32 target_surface_transforms_are_animating_(false), | 32 target_surface_transforms_are_animating_(false), |
| 33 screen_space_transforms_are_animating_(false), | 33 screen_space_transforms_are_animating_(false), |
| 34 is_clipped_(false), | 34 is_clipped_(false), |
| 35 contributes_to_drawn_surface_(false), | 35 contributes_to_drawn_surface_(false), |
| 36 draw_opacity_(1), | 36 draw_opacity_(1), |
| 37 nearest_occlusion_immune_ancestor_(NULL), | 37 nearest_occlusion_immune_ancestor_(nullptr), |
| 38 target_render_surface_layer_index_history_(0), | 38 target_render_surface_layer_index_history_(0), |
| 39 current_layer_index_history_(0) { | 39 current_layer_index_history_(0) { |
| 40 damage_tracker_ = DamageTracker::Create(); | 40 damage_tracker_ = DamageTracker::Create(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 RenderSurfaceImpl::~RenderSurfaceImpl() {} | 43 RenderSurfaceImpl::~RenderSurfaceImpl() {} |
| 44 | 44 |
| 45 gfx::RectF RenderSurfaceImpl::DrawableContentRect() const { | 45 gfx::RectF RenderSurfaceImpl::DrawableContentRect() const { |
| 46 gfx::RectF drawable_content_rect = | 46 gfx::RectF drawable_content_rect = |
| 47 MathUtil::MapClippedRect(draw_transform_, content_rect_); | 47 MathUtil::MapClippedRect(draw_transform_, content_rect_); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // TODO(shawnsingh): By using the same RenderSurfaceImpl for both the content | 177 // TODO(shawnsingh): By using the same RenderSurfaceImpl for both the content |
| 178 // and its reflection, it's currently not possible to apply a separate mask to | 178 // and its reflection, it's currently not possible to apply a separate mask to |
| 179 // the reflection layer or correctly handle opacity in reflections (opacity | 179 // the reflection layer or correctly handle opacity in reflections (opacity |
| 180 // must be applied after drawing both the layer and its reflection). The | 180 // must be applied after drawing both the layer and its reflection). The |
| 181 // solution is to introduce yet another RenderSurfaceImpl to draw the layer | 181 // solution is to introduce yet another RenderSurfaceImpl to draw the layer |
| 182 // and its reflection in. For now we only apply a separate reflection mask if | 182 // and its reflection in. For now we only apply a separate reflection mask if |
| 183 // the contents don't have a mask of their own. | 183 // the contents don't have a mask of their own. |
| 184 LayerImpl* mask_layer = owning_layer_->mask_layer(); | 184 LayerImpl* mask_layer = owning_layer_->mask_layer(); |
| 185 if (mask_layer && | 185 if (mask_layer && |
| 186 (!mask_layer->DrawsContent() || mask_layer->bounds().IsEmpty())) | 186 (!mask_layer->DrawsContent() || mask_layer->bounds().IsEmpty())) |
| 187 mask_layer = NULL; | 187 mask_layer = nullptr; |
| 188 | 188 |
| 189 if (!mask_layer && for_replica) { | 189 if (!mask_layer && for_replica) { |
| 190 mask_layer = owning_layer_->replica_layer()->mask_layer(); | 190 mask_layer = owning_layer_->replica_layer()->mask_layer(); |
| 191 if (mask_layer && | 191 if (mask_layer && |
| 192 (!mask_layer->DrawsContent() || mask_layer->bounds().IsEmpty())) | 192 (!mask_layer->DrawsContent() || mask_layer->bounds().IsEmpty())) |
| 193 mask_layer = NULL; | 193 mask_layer = nullptr; |
| 194 } | 194 } |
| 195 | 195 |
| 196 gfx::RectF mask_uv_rect(0.f, 0.f, 1.f, 1.f); | 196 gfx::RectF mask_uv_rect(0.f, 0.f, 1.f, 1.f); |
| 197 if (mask_layer) { | 197 if (mask_layer) { |
| 198 gfx::Vector2dF owning_layer_draw_scale = | 198 gfx::Vector2dF owning_layer_draw_scale = |
| 199 MathUtil::ComputeTransform2dScaleComponents( | 199 MathUtil::ComputeTransform2dScaleComponents( |
| 200 owning_layer_->draw_transform(), 1.f); | 200 owning_layer_->draw_transform(), 1.f); |
| 201 gfx::SizeF unclipped_mask_target_size = gfx::ScaleSize( | 201 gfx::SizeF unclipped_mask_target_size = gfx::ScaleSize( |
| 202 owning_layer_->content_bounds(), | 202 owning_layer_->content_bounds(), |
| 203 owning_layer_draw_scale.x(), | 203 owning_layer_draw_scale.x(), |
| (...skipping 27 matching lines...) Expand all Loading... |
| 231 visible_content_rect, | 231 visible_content_rect, |
| 232 render_pass_id, | 232 render_pass_id, |
| 233 mask_resource_id, | 233 mask_resource_id, |
| 234 mask_uv_rect, | 234 mask_uv_rect, |
| 235 owning_layer_->filters(), | 235 owning_layer_->filters(), |
| 236 owning_layer_to_target_scale, | 236 owning_layer_to_target_scale, |
| 237 owning_layer_->background_filters()); | 237 owning_layer_->background_filters()); |
| 238 } | 238 } |
| 239 | 239 |
| 240 } // namespace cc | 240 } // namespace cc |
| OLD | NEW |