diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-27 07:40:40 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-27 07:40:40 +0000 |
commit | d002dd073e451b18c424d562ff39b0b9b85120bb (patch) | |
tree | 74b90397c6fb87d633901d26fc6806fa3bbd2d9c /cc | |
parent | c0964de86a35e27961686007eded67672bcf5306 (diff) | |
download | chromium_src-d002dd073e451b18c424d562ff39b0b9b85120bb.zip chromium_src-d002dd073e451b18c424d562ff39b0b9b85120bb.tar.gz chromium_src-d002dd073e451b18c424d562ff39b0b9b85120bb.tar.bz2 |
cc: Convert non-const reference arguments to pointers.
Style-only change. This is forbidden by the style guide.
R=jamesr
Review URL: https://chromiumcodereview.appspot.com/12912010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190851 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
33 files changed, 704 insertions, 579 deletions
diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc index 6ab3528..a213ba7 100644 --- a/cc/animation/layer_animation_controller.cc +++ b/cc/animation/layer_animation_controller.cc @@ -54,7 +54,7 @@ struct HasAnimationId { void LayerAnimationController::RemoveAnimation(int animation_id) { ScopedPtrVector<Animation>& animations = active_animations_; - animations.erase(cc::remove_if(animations, + animations.erase(cc::remove_if(&animations, animations.begin(), animations.end(), HasAnimationId(animation_id)), @@ -79,7 +79,7 @@ void LayerAnimationController::RemoveAnimation( int animation_id, Animation::TargetProperty target_property) { ScopedPtrVector<Animation>& animations = active_animations_; - animations.erase(cc::remove_if(animations, + animations.erase(cc::remove_if(&animations, animations.begin(), animations.end(), HasAnimationIdAndProperty(animation_id, @@ -325,7 +325,7 @@ void LayerAnimationController::RemoveAnimationsCompletedOnMainThread( // guaranteeing progress towards loop termination. ScopedPtrVector<Animation>& animations = controller_impl->active_animations_; - animations.erase(cc::remove_if(animations, + animations.erase(cc::remove_if(&animations, animations.begin(), animations.end(), IsCompleted(*this)), @@ -514,7 +514,7 @@ static bool IsWaitingForDeletion(Animation* animation) { void LayerAnimationController::PurgeAnimationsMarkedForDeletion() { ScopedPtrVector<Animation>& animations = active_animations_; - animations.erase(cc::remove_if(animations, + animations.erase(cc::remove_if(&animations, animations.begin(), animations.end(), IsWaitingForDeletion), diff --git a/cc/animation/transform_operation.cc b/cc/animation/transform_operation.cc index b4e6917..5140722 100644 --- a/cc/animation/transform_operation.cc +++ b/cc/animation/transform_operation.cc @@ -24,24 +24,26 @@ static bool IsOperationIdentity(const TransformOperation* operation) { static bool ShareSameAxis(const TransformOperation* from, const TransformOperation* to, - double& axis_x, double& axis_y, double& axis_z, - double& angle_from) { + double* axis_x, + double* axis_y, + double* axis_z, + double* angle_from) { if (IsOperationIdentity(from) && IsOperationIdentity(to)) return false; if (IsOperationIdentity(from) && !IsOperationIdentity(to)) { - axis_x = to->rotate.axis.x; - axis_y = to->rotate.axis.y; - axis_z = to->rotate.axis.z; - angle_from = 0; + *axis_x = to->rotate.axis.x; + *axis_y = to->rotate.axis.y; + *axis_z = to->rotate.axis.z; + *angle_from = 0; return true; } if (!IsOperationIdentity(from) && IsOperationIdentity(to)) { - axis_x = from->rotate.axis.x; - axis_y = from->rotate.axis.y; - axis_z = from->rotate.axis.z; - angle_from = from->rotate.angle; + *axis_x = from->rotate.axis.x; + *axis_y = from->rotate.axis.y; + *axis_z = from->rotate.axis.z; + *angle_from = from->rotate.angle; return true; } @@ -61,12 +63,12 @@ static bool ShareSameAxis(const TransformOperation* from, double error = std::fabs(1.0 - (dot * dot) / (length_2 * other_length_2)); bool result = error < kAngleEpsilon; if (result) { - axis_x = to->rotate.axis.x; - axis_y = to->rotate.axis.y; - axis_z = to->rotate.axis.z; + *axis_x = to->rotate.axis.x; + *axis_y = to->rotate.axis.y; + *axis_z = to->rotate.axis.z; // If the axes are pointing in opposite directions, we need to reverse // the angle. - angle_from = dot > 0 ? from->rotate.angle : -from->rotate.angle; + *angle_from = dot > 0 ? from->rotate.angle : -from->rotate.angle; } return result; } @@ -85,7 +87,7 @@ bool TransformOperation::BlendTransformOperations( const TransformOperation* from, const TransformOperation* to, double progress, - gfx::Transform& result) { + gfx::Transform* result) { if (IsOperationIdentity(from) && IsOperationIdentity(to)) return true; @@ -104,9 +106,9 @@ bool TransformOperation::BlendTransformOperations( double to_x = IsOperationIdentity(to) ? 0 : to->translate.x; double to_y = IsOperationIdentity(to) ? 0 : to->translate.y; double to_z = IsOperationIdentity(to) ? 0 : to->translate.z; - result.Translate3d(BlendDoubles(from_x, to_x, progress), - BlendDoubles(from_y, to_y, progress), - BlendDoubles(from_z, to_z, progress)); + result->Translate3d(BlendDoubles(from_x, to_x, progress), + BlendDoubles(from_y, to_y, progress), + BlendDoubles(from_z, to_z, progress)); break; } case TransformOperation::TransformOperationRotate: { @@ -115,18 +117,18 @@ bool TransformOperation::BlendTransformOperations( double axis_z = 1; double from_angle = 0; double to_angle = IsOperationIdentity(to) ? 0 : to->rotate.angle; - if (ShareSameAxis(from, to, axis_x, axis_y, axis_z, from_angle)) { - result.RotateAbout(gfx::Vector3dF(axis_x, axis_y, axis_z), - BlendDoubles(from_angle, to_angle, progress)); - } else { + if (ShareSameAxis(from, to, &axis_x, &axis_y, &axis_z, &from_angle)) + result->RotateAbout(gfx::Vector3dF(axis_x, axis_y, axis_z), + BlendDoubles(from_angle, to_angle, progress)); + else { gfx::Transform to_matrix; if (!IsOperationIdentity(to)) to_matrix = to->matrix; gfx::Transform from_matrix; if (!IsOperationIdentity(from)) from_matrix = from->matrix; - result = to_matrix; - if (!result.Blend(from_matrix, progress)) + *result = to_matrix; + if (!result->Blend(from_matrix, progress)) return false; } break; @@ -138,9 +140,9 @@ bool TransformOperation::BlendTransformOperations( double to_x = IsOperationIdentity(to) ? 1 : to->scale.x; double to_y = IsOperationIdentity(to) ? 1 : to->scale.y; double to_z = IsOperationIdentity(to) ? 1 : to->scale.z; - result.Scale3d(BlendDoubles(from_x, to_x, progress), - BlendDoubles(from_y, to_y, progress), - BlendDoubles(from_z, to_z, progress)); + result->Scale3d(BlendDoubles(from_x, to_x, progress), + BlendDoubles(from_y, to_y, progress), + BlendDoubles(from_z, to_z, progress)); break; } case TransformOperation::TransformOperationSkew: { @@ -148,8 +150,8 @@ bool TransformOperation::BlendTransformOperations( double from_y = IsOperationIdentity(from) ? 0 : from->skew.y; double to_x = IsOperationIdentity(to) ? 0 : to->skew.x; double to_y = IsOperationIdentity(to) ? 0 : to->skew.y; - result.SkewX(BlendDoubles(from_x, to_x, progress)); - result.SkewY(BlendDoubles(from_y, to_y, progress)); + result->SkewX(BlendDoubles(from_x, to_x, progress)); + result->SkewY(BlendDoubles(from_y, to_y, progress)); break; } case TransformOperation::TransformOperationPerspective: { @@ -157,7 +159,7 @@ bool TransformOperation::BlendTransformOperations( std::numeric_limits<double>::max() : from->perspective_depth; double to_perspective_depth = IsOperationIdentity(to) ? std::numeric_limits<double>::max() : to->perspective_depth; - result.ApplyPerspectiveDepth( + result->ApplyPerspectiveDepth( BlendDoubles(from_perspective_depth, to_perspective_depth, progress)); break; } @@ -168,8 +170,8 @@ bool TransformOperation::BlendTransformOperations( gfx::Transform from_matrix; if (!IsOperationIdentity(from)) from_matrix = from->matrix; - result = to_matrix; - if (!result.Blend(from_matrix, progress)) + *result = to_matrix; + if (!result->Blend(from_matrix, progress)) return false; break; } diff --git a/cc/animation/transform_operation.h b/cc/animation/transform_operation.h index 0581862..74673ab 100644 --- a/cc/animation/transform_operation.h +++ b/cc/animation/transform_operation.h @@ -55,7 +55,7 @@ struct TransformOperation { static bool BlendTransformOperations(const TransformOperation* from, const TransformOperation* to, double progress, - gfx::Transform& result); + gfx::Transform* result); }; } // namespace cc diff --git a/cc/animation/transform_operations.cc b/cc/animation/transform_operations.cc index bc7a0c3..8826d29 100644 --- a/cc/animation/transform_operations.cc +++ b/cc/animation/transform_operations.cc @@ -157,7 +157,7 @@ bool TransformOperations::BlendInternal(const TransformOperations& from, from_identity ? 0 : &from.operations_[i], to_identity ? 0 : &operations_[i], progress, - blended)) + &blended)) return false; result->PreconcatTransform(blended); } diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc index 623ff7b..9dacdb9 100644 --- a/cc/base/math_util.cc +++ b/cc/base/math_util.cc @@ -135,9 +135,9 @@ static inline void ExpandBoundsToIncludePoint(float* xmin, static inline void AddVertexToClippedQuad(gfx::PointF new_vertex, gfx::PointF clipped_quad[8], - int& num_vertices_in_clipped_quad) { - clipped_quad[num_vertices_in_clipped_quad] = new_vertex; - num_vertices_in_clipped_quad++; + int* num_vertices_in_clipped_quad) { + clipped_quad[*num_vertices_in_clipped_quad] = new_vertex; + (*num_vertices_in_clipped_quad)++; } gfx::Rect MathUtil::MapClippedRect(const gfx::Transform& transform, @@ -197,7 +197,7 @@ gfx::RectF MathUtil::ProjectClippedRect(const gfx::Transform& transform, void MathUtil::MapClippedQuad(const gfx::Transform& transform, const gfx::QuadF& src_quad, gfx::PointF clipped_quad[8], - int& num_vertices_in_clipped_quad) { + int* num_vertices_in_clipped_quad) { HomogeneousCoordinate h1 = MapHomogeneousPoint(transform, gfx::Point3F(src_quad.p1())); HomogeneousCoordinate h2 = @@ -210,7 +210,7 @@ void MathUtil::MapClippedQuad(const gfx::Transform& transform, // The order of adding the vertices to the array is chosen so that // clockwise / counter-clockwise orientation is retained. - num_vertices_in_clipped_quad = 0; + *num_vertices_in_clipped_quad = 0; if (!h1.ShouldBeClipped()) { AddVertexToClippedQuad( @@ -260,7 +260,7 @@ void MathUtil::MapClippedQuad(const gfx::Transform& transform, num_vertices_in_clipped_quad); } - DCHECK_LE(num_vertices_in_clipped_quad, 8); + DCHECK_LE(*num_vertices_in_clipped_quad, 8); } gfx::RectF MathUtil::ComputeEnclosingRectOfVertices(gfx::PointF vertices[], diff --git a/cc/base/math_util.h b/cc/base/math_util.h index 1736444..9f4577a 100644 --- a/cc/base/math_util.h +++ b/cc/base/math_util.h @@ -102,7 +102,7 @@ class CC_EXPORT MathUtil { static void MapClippedQuad(const gfx::Transform& transform, const gfx::QuadF& src_quad, gfx::PointF clipped_quad[8], - int& num_vertices_in_clipped_quad); + int* num_vertices_in_clipped_quad); static gfx::RectF ComputeEnclosingRectOfVertices(gfx::PointF vertices[], int num_vertices); diff --git a/cc/base/region.cc b/cc/base/region.cc index 4b286ef..7d63345 100644 --- a/cc/base/region.cc +++ b/cc/base/region.cc @@ -30,8 +30,8 @@ const Region& Region::operator=(const Region& region) { return *this; } -void Region::Swap(Region& region) { - region.skregion_.swap(skregion_); +void Region::Swap(Region* region) { + region->skregion_.swap(skregion_); } void Region::Clear() { diff --git a/cc/base/region.h b/cc/base/region.h index 70b7ed0..c71d880 100644 --- a/cc/base/region.h +++ b/cc/base/region.h @@ -25,7 +25,7 @@ class CC_EXPORT Region { const Region& operator=(gfx::Rect rect); const Region& operator=(const Region& region); - void Swap(Region& region); + void Swap(Region* region); void Clear(); bool IsEmpty() const; diff --git a/cc/base/region_unittest.cc b/cc/base/region_unittest.cc index 20379ba..c9a218d 100644 --- a/cc/base/region_unittest.cc +++ b/cc/base/region_unittest.cc @@ -437,7 +437,7 @@ TEST(RegionSwap, Swap) { Region r1, r2, r3; r1 = gfx::Rect(0, 0, 50, 50); - r1.Swap(r2); + r1.Swap(&r2); EXPECT_TRUE(r1.IsEmpty()); EXPECT_EQ(r2.ToString(), Region(gfx::Rect(0, 0, 50, 50)).ToString()); @@ -445,7 +445,7 @@ TEST(RegionSwap, Swap) { r1.Union(gfx::Rect(100, 0, 50, 50)); r1.Union(gfx::Rect(0, 0, 500, 500)); r3 = r1; - r1.Swap(r2); + r1.Swap(&r2); EXPECT_EQ(r1.ToString(), Region(gfx::Rect(0, 0, 50, 50)).ToString()); EXPECT_EQ(r2.ToString(), r3.ToString()); } diff --git a/cc/base/scoped_ptr_algorithm.h b/cc/base/scoped_ptr_algorithm.h index ad2f918..79f4eee 100644 --- a/cc/base/scoped_ptr_algorithm.h +++ b/cc/base/scoped_ptr_algorithm.h @@ -11,14 +11,14 @@ namespace cc { // assignment to their iterators. template <class ForwardIterator, class Predicate, class ScopedContainer> ForwardIterator remove_if( - ScopedContainer& container, + ScopedContainer* container, ForwardIterator first, ForwardIterator last, Predicate predicate) { ForwardIterator result = first; for (; first != last; ++first) { if (!predicate(*first)) { - container.swap(first, result); + container->swap(first, result); ++result; } } diff --git a/cc/debug/overdraw_metrics.cc b/cc/debug/overdraw_metrics.cc index b8a382c..c9b496b 100644 --- a/cc/debug/overdraw_metrics.cc +++ b/cc/debug/overdraw_metrics.cc @@ -51,7 +51,7 @@ static inline float AreaOfMappedQuad(const gfx::Transform& transform, MathUtil::MapClippedQuad(transform, quad, clipped_quad, - num_vertices_in_clipped_quad); + &num_vertices_in_clipped_quad); return PolygonArea(clipped_quad, num_vertices_in_clipped_quad); } diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc index c6f341a..b758f6d 100644 --- a/cc/layers/picture_layer.cc +++ b/cc/layers/picture_layer.cc @@ -40,7 +40,7 @@ void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { layer_impl->SetIsMask(is_mask_); layer_impl->CreateTilingSet(); layer_impl->invalidation_.Clear(); - layer_impl->invalidation_.Swap(pile_invalidation_); + layer_impl->invalidation_.Swap(&pile_invalidation_); layer_impl->pile_ = PicturePileImpl::CreateFromOther(pile_, layer_impl->is_using_lcd_text_); layer_impl->SyncFromActiveLayer(); @@ -77,7 +77,7 @@ void PictureLayer::Update(ResourceUpdateQueue*, // Calling paint in WebKit can sometimes cause invalidations, so save // off the invalidation prior to calling update. - pile_invalidation_.Swap(pending_invalidation_); + pile_invalidation_.Swap(&pending_invalidation_); pending_invalidation_.Clear(); gfx::Rect visible_layer_rect = gfx::ToEnclosingRect( diff --git a/cc/output/delegating_renderer.cc b/cc/output/delegating_renderer.cc index d6d24c2..997b699 100644 --- a/cc/output/delegating_renderer.cc +++ b/cc/output/delegating_renderer.cc @@ -139,7 +139,7 @@ static ResourceProvider::ResourceId AppendToArray( } void DelegatingRenderer::DrawFrame( - RenderPassList& render_passes_in_draw_order) { + RenderPassList* render_passes_in_draw_order) { TRACE_EVENT0("cc", "DelegatingRenderer::DrawFrame"); CompositorFrame out_frame; @@ -151,15 +151,15 @@ void DelegatingRenderer::DrawFrame( ResourceProvider::ResourceIdArray resources; DrawQuad::ResourceIteratorCallback append_to_array = base::Bind(&AppendToArray, &resources); - for (size_t i = 0; i < render_passes_in_draw_order.size(); ++i) { - RenderPass* render_pass = render_passes_in_draw_order[i]; + for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) { + RenderPass* render_pass = render_passes_in_draw_order->at(i); for (size_t j = 0; j < render_pass->quad_list.size(); ++j) render_pass->quad_list[j]->IterateResources(append_to_array); } // Move the render passes and resources into the |out_frame|. DelegatedFrameData& out_data = *out_frame.delegated_frame_data; - out_data.render_pass_list.swap(render_passes_in_draw_order); + out_data.render_pass_list.swap(*render_passes_in_draw_order); resource_provider_->PrepareSendToParent(resources, &out_data.resource_list); output_surface_->SendFrameToParentCompositor(&out_frame); diff --git a/cc/output/delegating_renderer.h b/cc/output/delegating_renderer.h index 590cf4f..6ce94fb3 100644 --- a/cc/output/delegating_renderer.h +++ b/cc/output/delegating_renderer.h @@ -28,7 +28,7 @@ class CC_EXPORT DelegatingRenderer : virtual const RendererCapabilities& Capabilities() const OVERRIDE; - virtual void DrawFrame(RenderPassList& render_passes_in_draw_order) OVERRIDE; + virtual void DrawFrame(RenderPassList* render_passes_in_draw_order) OVERRIDE; virtual void Finish() OVERRIDE {} diff --git a/cc/output/delegating_renderer_unittest.cc b/cc/output/delegating_renderer_unittest.cc index 988ab3c..e964c04 100644 --- a/cc/output/delegating_renderer_unittest.cc +++ b/cc/output/delegating_renderer_unittest.cc @@ -48,7 +48,7 @@ class DelegatingRendererTestDraw : public DelegatingRendererTest { OVERRIDE { EXPECT_EQ(0u, output_surface_->num_sent_frames()); - CompositorFrame& last_frame = output_surface_->last_sent_frame(); + const CompositorFrame& last_frame = output_surface_->last_sent_frame(); EXPECT_FALSE(last_frame.delegated_frame_data); EXPECT_FALSE(last_frame.gl_frame_data); EXPECT_EQ(0.f, last_frame.metadata.min_page_scale_factor); @@ -59,7 +59,7 @@ class DelegatingRendererTestDraw : public DelegatingRendererTest { virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { EXPECT_EQ(1u, output_surface_->num_sent_frames()); - CompositorFrame& last_frame = output_surface_->last_sent_frame(); + const CompositorFrame& last_frame = output_surface_->last_sent_frame(); DelegatedFrameData* last_frame_data = last_frame.delegated_frame_data.get(); ASSERT_TRUE(last_frame.delegated_frame_data); EXPECT_FALSE(last_frame.gl_frame_data); @@ -116,7 +116,7 @@ class DelegatingRendererTestResources : public DelegatingRendererTest { virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { EXPECT_EQ(1u, output_surface_->num_sent_frames()); - CompositorFrame& last_frame = output_surface_->last_sent_frame(); + const CompositorFrame& last_frame = output_surface_->last_sent_frame(); ASSERT_TRUE(last_frame.delegated_frame_data); EXPECT_EQ(2u, last_frame.delegated_frame_data->render_pass_list.size()); diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc index b251c9c..f32c7ef 100644 --- a/cc/output/direct_renderer.cc +++ b/cc/output/direct_renderer.cc @@ -77,36 +77,36 @@ void DirectRenderer::QuadRectTransform(gfx::Transform* quad_rect_transform, } // static -void DirectRenderer::InitializeMatrices(DrawingFrame& frame, +void DirectRenderer::InitializeMatrices(DrawingFrame* frame, gfx::Rect draw_rect, bool flip_y) { if (flip_y) { - frame.projection_matrix = OrthoProjectionMatrix(draw_rect.x(), - draw_rect.right(), - draw_rect.bottom(), - draw_rect.y()); + frame->projection_matrix = OrthoProjectionMatrix(draw_rect.x(), + draw_rect.right(), + draw_rect.bottom(), + draw_rect.y()); } else { - frame.projection_matrix = OrthoProjectionMatrix(draw_rect.x(), - draw_rect.right(), - draw_rect.y(), - draw_rect.bottom()); + frame->projection_matrix = OrthoProjectionMatrix(draw_rect.x(), + draw_rect.right(), + draw_rect.y(), + draw_rect.bottom()); } - frame.window_matrix = + frame->window_matrix = window_matrix(0, 0, draw_rect.width(), draw_rect.height()); - frame.flipped_y = flip_y; + frame->flipped_y = flip_y; } // static gfx::Rect DirectRenderer::MoveScissorToWindowSpace( - const DrawingFrame& frame, const gfx::RectF& scissor_rect) { + const DrawingFrame* frame, const gfx::RectF& scissor_rect) { gfx::Rect scissor_rect_in_canvas_space = gfx::ToEnclosingRect(scissor_rect); // The scissor coordinates must be supplied in viewport space so we need to // offset by the relative position of the top left corner of the current // render pass. - gfx::Rect framebuffer_output_rect = frame.current_render_pass->output_rect; + gfx::Rect framebuffer_output_rect = frame->current_render_pass->output_rect; scissor_rect_in_canvas_space.set_x( scissor_rect_in_canvas_space.x() - framebuffer_output_rect.x()); - if (frame.flipped_y && !frame.current_texture) { + if (frame->flipped_y && !frame->current_texture) { scissor_rect_in_canvas_space.set_y( framebuffer_output_rect.height() - (scissor_rect_in_canvas_space.bottom() - framebuffer_output_rect.y())); @@ -176,12 +176,12 @@ void DirectRenderer::DecideRenderPassAllocationsForFrame( } } -void DirectRenderer::DrawFrame(RenderPassList& render_passes_in_draw_order) { +void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order) { TRACE_EVENT0("cc", "DirectRenderer::DrawFrame"); UMA_HISTOGRAM_COUNTS("Renderer4.renderPassCount", - render_passes_in_draw_order.size()); + render_passes_in_draw_order->size()); - const RenderPass* root_render_pass = render_passes_in_draw_order.back(); + const RenderPass* root_render_pass = render_passes_in_draw_order->back(); DCHECK(root_render_pass); DrawingFrame frame; @@ -191,34 +191,35 @@ void DirectRenderer::DrawFrame(RenderPassList& render_passes_in_draw_order) { root_render_pass->damage_rect : root_render_pass->output_rect; frame.root_damage_rect.Intersect(gfx::Rect(ViewportSize())); - BeginDrawingFrame(frame); - for (size_t i = 0; i < render_passes_in_draw_order.size(); ++i) - DrawRenderPass(frame, render_passes_in_draw_order[i]); - FinishDrawingFrame(frame); + BeginDrawingFrame(&frame); + for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) + DrawRenderPass(&frame, render_passes_in_draw_order->at(i)); + FinishDrawingFrame(&frame); - render_passes_in_draw_order.clear(); + render_passes_in_draw_order->clear(); } gfx::RectF DirectRenderer::ComputeScissorRectForRenderPass( - const DrawingFrame& frame) { - gfx::RectF render_pass_scissor = frame.current_render_pass->output_rect; + const DrawingFrame* frame) { + gfx::RectF render_pass_scissor = frame->current_render_pass->output_rect; - if (frame.root_damage_rect == frame.root_render_pass->output_rect) + if (frame->root_damage_rect == frame->root_render_pass->output_rect) return render_pass_scissor; gfx::Transform inverse_transform(gfx::Transform::kSkipInitialization); - if (frame.current_render_pass->transform_to_root_target.GetInverse( + if (frame->current_render_pass->transform_to_root_target.GetInverse( &inverse_transform)) { // Only intersect inverse-projected damage if the transform is invertible. gfx::RectF damage_rect_in_render_pass_space = - MathUtil::ProjectClippedRect(inverse_transform, frame.root_damage_rect); + MathUtil::ProjectClippedRect(inverse_transform, + frame->root_damage_rect); render_pass_scissor.Intersect(damage_rect_in_render_pass_space); } return render_pass_scissor; } -void DirectRenderer::SetScissorStateForQuad(const DrawingFrame& frame, +void DirectRenderer::SetScissorStateForQuad(const DrawingFrame* frame, const DrawQuad& quad) { if (quad.isClipped()) { gfx::RectF quad_scissor_rect = quad.clipRect(); @@ -229,7 +230,7 @@ void DirectRenderer::SetScissorStateForQuad(const DrawingFrame& frame, } void DirectRenderer::SetScissorStateForQuadWithRenderPassScissor( - const DrawingFrame& frame, + const DrawingFrame* frame, const DrawQuad& quad, const gfx::RectF& render_pass_scissor, bool* should_skip_quad) { @@ -249,7 +250,7 @@ void DirectRenderer::SetScissorStateForQuadWithRenderPassScissor( void DirectRenderer::FinishDrawingQuadList() {} -void DirectRenderer::DrawRenderPass(DrawingFrame& frame, +void DirectRenderer::DrawRenderPass(DrawingFrame* frame, const RenderPass* render_pass) { TRACE_EVENT0("cc", "DirectRenderer::DrawRenderPass"); if (!UseRenderPass(frame, render_pass)) @@ -263,7 +264,7 @@ void DirectRenderer::DrawRenderPass(DrawingFrame& frame, SetScissorTestRect(MoveScissorToWindowSpace(frame, render_pass_scissor)); } - if (frame.current_render_pass != frame.root_render_pass || + if (frame->current_render_pass != frame->root_render_pass || client_->ShouldClearRootRenderPass()) { if (!using_scissor_as_optimization) EnsureScissorTestDisabled(); @@ -296,12 +297,12 @@ void DirectRenderer::DrawRenderPass(DrawingFrame& frame, } } -bool DirectRenderer::UseRenderPass(DrawingFrame& frame, +bool DirectRenderer::UseRenderPass(DrawingFrame* frame, const RenderPass* render_pass) { - frame.current_render_pass = render_pass; - frame.current_texture = NULL; + frame->current_render_pass = render_pass; + frame->current_texture = NULL; - if (render_pass == frame.root_render_pass) { + if (render_pass == frame->root_render_pass) { BindFramebufferToOutputSurface(frame); InitializeMatrices(frame, render_pass->output_rect, FlippedFramebuffer()); SetDrawViewportSize(render_pass->output_rect.size()); diff --git a/cc/output/direct_renderer.h b/cc/output/direct_renderer.h index 6797fc8..bb3095a 100644 --- a/cc/output/direct_renderer.h +++ b/cc/output/direct_renderer.h @@ -28,7 +28,7 @@ class CC_EXPORT DirectRenderer : public Renderer { const RenderPassList& render_passes_in_draw_order) OVERRIDE; virtual bool HaveCachedResourcesForRenderPassId(RenderPass::Id id) const OVERRIDE; - virtual void DrawFrame(RenderPassList& render_passes_in_draw_order) OVERRIDE; + virtual void DrawFrame(RenderPassList* render_passes_in_draw_order) OVERRIDE; struct CC_EXPORT DrawingFrame { DrawingFrame(); @@ -76,15 +76,15 @@ class CC_EXPORT DirectRenderer : public Renderer { static void QuadRectTransform(gfx::Transform* quad_rect_transform, const gfx::Transform& quad_transform, const gfx::RectF& quad_rect); - static void InitializeMatrices(DrawingFrame& frame, + static void InitializeMatrices(DrawingFrame* frame, gfx::Rect draw_rect, bool flip_y); - static gfx::Rect MoveScissorToWindowSpace(const DrawingFrame& frame, + static gfx::Rect MoveScissorToWindowSpace(const DrawingFrame* frame, const gfx::RectF& scissor_rect); - static gfx::RectF ComputeScissorRectForRenderPass(const DrawingFrame& frame); - void SetScissorStateForQuad(const DrawingFrame& frame, const DrawQuad& quad); + static gfx::RectF ComputeScissorRectForRenderPass(const DrawingFrame* frame); + void SetScissorStateForQuad(const DrawingFrame* frame, const DrawQuad& quad); void SetScissorStateForQuadWithRenderPassScissor( - const DrawingFrame& frame, + const DrawingFrame* frame, const DrawQuad& quad, const gfx::RectF& render_pass_scissor, bool* should_skip_quad); @@ -92,19 +92,19 @@ class CC_EXPORT DirectRenderer : public Renderer { static gfx::Size RenderPassTextureSize(const RenderPass* render_pass); static GLenum RenderPassTextureFormat(const RenderPass* render_pass); - void DrawRenderPass(DrawingFrame& frame, const RenderPass* render_pass); - bool UseRenderPass(DrawingFrame& frame, const RenderPass* render_pass); + void DrawRenderPass(DrawingFrame* frame, const RenderPass* render_pass); + bool UseRenderPass(DrawingFrame* frame, const RenderPass* render_pass); - virtual void BindFramebufferToOutputSurface(DrawingFrame& frame) = 0; - virtual bool BindFramebufferToTexture(DrawingFrame& frame, + virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; + virtual bool BindFramebufferToTexture(DrawingFrame* frame, const ScopedResource* resource, gfx::Rect framebuffer_rect) = 0; virtual void SetDrawViewportSize(gfx::Size viewport_size) = 0; virtual void SetScissorTestRect(gfx::Rect scissor_rect) = 0; - virtual void ClearFramebuffer(DrawingFrame& frame) = 0; - virtual void DoDrawQuad(DrawingFrame& frame, const DrawQuad* quad) = 0; - virtual void BeginDrawingFrame(DrawingFrame& frame) = 0; - virtual void FinishDrawingFrame(DrawingFrame& frame) = 0; + virtual void ClearFramebuffer(DrawingFrame* frame) = 0; + virtual void DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) = 0; + virtual void BeginDrawingFrame(DrawingFrame* frame) = 0; + virtual void FinishDrawingFrame(DrawingFrame* frame) = 0; virtual void FinishDrawingQuadList(); virtual bool FlippedFramebuffer() const = 0; virtual void EnsureScissorTestEnabled() = 0; diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 4d630a1..c842227 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -235,21 +235,21 @@ void GLRenderer::ReleaseRenderPassTextures() { render_pass_textures_.clear(); } void GLRenderer::ViewportChanged() { is_viewport_changed_ = true; } -void GLRenderer::ClearFramebuffer(DrawingFrame& frame) { +void GLRenderer::ClearFramebuffer(DrawingFrame* frame) { // On DEBUG builds, opaque render passes are cleared to blue to easily see // regions that were not drawn on the screen. - if (frame.current_render_pass->has_transparent_background) + if (frame->current_render_pass->has_transparent_background) GLC(context_, context_->clearColor(0, 0, 0, 0)); else GLC(context_, context_->clearColor(0, 0, 1, 1)); #ifdef NDEBUG - if (frame.current_render_pass->has_transparent_background) + if (frame->current_render_pass->has_transparent_background) #endif context_->clear(GL_COLOR_BUFFER_BIT); } -void GLRenderer::BeginDrawingFrame(DrawingFrame& frame) { +void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) { // FIXME: Remove this once backbuffer is automatically recreated on first use EnsureBackbuffer(); @@ -284,7 +284,7 @@ void GLRenderer::DoNoOp() { GLC(context_, context_->flush()); } -void GLRenderer::DoDrawQuad(DrawingFrame& frame, const DrawQuad* quad) { +void GLRenderer::DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) { DCHECK(quad->rect.Contains(quad->visible_rect)); if (quad->material != DrawQuad::TEXTURE_CONTENT) { FlushTextureQuadCache(); @@ -324,7 +324,7 @@ void GLRenderer::DoDrawQuad(DrawingFrame& frame, const DrawQuad* quad) { } } -void GLRenderer::DrawCheckerboardQuad(const DrawingFrame& frame, +void GLRenderer::DrawCheckerboardQuad(const DrawingFrame* frame, const CheckerboardDrawQuad* quad) { SetBlendEnabled(quad->ShouldDrawWithBlending()); @@ -367,7 +367,7 @@ void GLRenderer::DrawCheckerboardQuad(const DrawingFrame& frame, program->vertex_shader().matrix_location()); } -void GLRenderer::DrawDebugBorderQuad(const DrawingFrame& frame, +void GLRenderer::DrawDebugBorderQuad(const DrawingFrame* frame, const DebugBorderDrawQuad* quad) { SetBlendEnabled(quad->ShouldDrawWithBlending()); @@ -384,7 +384,7 @@ void GLRenderer::DrawDebugBorderQuad(const DrawingFrame& frame, 0.5f * layer_rect.height() + layer_rect.y()); render_matrix.Scale(layer_rect.width(), layer_rect.height()); GLRenderer::ToGLMatrix(&gl_matrix[0], - frame.projection_matrix * render_matrix); + frame->projection_matrix * render_matrix); GLC(Context(), Context()->uniformMatrix4fv( program->vertex_shader().matrix_location(), 1, false, &gl_matrix[0])); @@ -529,7 +529,7 @@ static SkBitmap ApplyImageFilter(GLRenderer* renderer, } scoped_ptr<ScopedResource> GLRenderer::DrawBackgroundFilters( - DrawingFrame& frame, + DrawingFrame* frame, const RenderPassDrawQuad* quad, const gfx::Transform& contents_device_transform, const gfx::Transform& contents_device_transform_inverse) { @@ -563,9 +563,9 @@ scoped_ptr<ScopedResource> GLRenderer::DrawBackgroundFilters( // FIXME: We only allow background filters on an opaque render surface because // other surfaces may contain translucent pixels, and the contents behind // those translucent pixels wouldn't have the filter applied. - if (frame.current_render_pass->has_transparent_background) + if (frame->current_render_pass->has_transparent_background) return scoped_ptr<ScopedResource>(); - DCHECK(!frame.current_texture); + DCHECK(!frame->current_texture); // FIXME: Do a single readback for both the surface and replica and cache the // filtered results (once filter textures are not reused). @@ -576,7 +576,7 @@ scoped_ptr<ScopedResource> GLRenderer::DrawBackgroundFilters( filters.getOutsets(top, right, bottom, left); device_rect.Inset(-left, -top, -right, -bottom); - device_rect.Intersect(frame.current_render_pass->output_rect); + device_rect.Intersect(frame->current_render_pass->output_rect); scoped_ptr<ScopedResource> device_background_texture = ScopedResource::create(resource_provider_); @@ -599,7 +599,7 @@ scoped_ptr<ScopedResource> GLRenderer::DrawBackgroundFilters( ResourceProvider::TextureUsageFramebuffer)) return scoped_ptr<ScopedResource>(); - const RenderPass* target_render_pass = frame.current_render_pass; + const RenderPass* target_render_pass = frame->current_render_pass; bool using_background_texture = UseScopedTexture(frame, background_texture.get(), quad->rect); @@ -633,7 +633,7 @@ scoped_ptr<ScopedResource> GLRenderer::DrawBackgroundFilters( return background_texture.Pass(); } -void GLRenderer::DrawRenderPassQuad(DrawingFrame& frame, +void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, const RenderPassDrawQuad* quad) { SetBlendEnabled(quad->ShouldDrawWithBlending()); @@ -645,7 +645,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame& frame, gfx::Transform quad_rect_matrix; QuadRectTransform(&quad_rect_matrix, quad->quadTransform(), quad->rect); gfx::Transform contents_device_transform = - frame.window_matrix * frame.projection_matrix * quad_rect_matrix; + frame->window_matrix * frame->projection_matrix * quad_rect_matrix; contents_device_transform.FlattenTo2d(); // Can only draw surface if device matrix is invertible. @@ -953,13 +953,13 @@ bool GLRenderer::SetupQuadForAntialiasing( return true; } -void GLRenderer::DrawSolidColorQuad(const DrawingFrame& frame, +void GLRenderer::DrawSolidColorQuad(const DrawingFrame* frame, const SolidColorDrawQuad* quad) { SetBlendEnabled(quad->ShouldDrawWithBlending()); gfx::Rect tile_rect = quad->visible_rect; gfx::Transform device_transform = - frame.window_matrix * frame.projection_matrix * quad->quadTransform(); + frame->window_matrix * frame->projection_matrix * quad->quadTransform(); device_transform.FlattenTo2d(); if (!device_transform.IsInvertible()) return; @@ -1036,7 +1036,7 @@ static void TileUniformLocation(T program, TileProgramUniforms* uniforms) { uniforms->edge_location = program->fragment_shader().edge_location(); } -void GLRenderer::DrawTileQuad(const DrawingFrame& frame, +void GLRenderer::DrawTileQuad(const DrawingFrame* frame, const TileDrawQuad* quad) { gfx::Rect tile_rect = quad->visible_rect; @@ -1088,7 +1088,7 @@ void GLRenderer::DrawTileQuad(const DrawingFrame& frame, float fragment_tex_scale_y = clamp_tex_rect.height() / texture_size.height(); gfx::Transform device_transform = - frame.window_matrix * frame.projection_matrix * quad->quadTransform(); + frame->window_matrix * frame->projection_matrix * quad->quadTransform(); device_transform.FlattenTo2d(); if (!device_transform.IsInvertible()) return; @@ -1184,7 +1184,7 @@ void GLRenderer::DrawTileQuad(const DrawingFrame& frame, frame, quad->quadTransform(), centered_rect, uniforms.matrix_location); } -void GLRenderer::DrawYUVVideoQuad(const DrawingFrame& frame, +void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame, const YUVVideoDrawQuad* quad) { SetBlendEnabled(quad->ShouldDrawWithBlending()); @@ -1252,7 +1252,7 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame& frame, GLC(Context(), Context()->activeTexture(GL_TEXTURE0)); } -void GLRenderer::DrawStreamVideoQuad(const DrawingFrame& frame, +void GLRenderer::DrawStreamVideoQuad(const DrawingFrame* frame, const StreamVideoDrawQuad* quad) { SetBlendEnabled(quad->ShouldDrawWithBlending()); @@ -1386,7 +1386,7 @@ void GLRenderer::FlushTextureQuadCache() { draw_cache_.matrix_data.resize(0); } -void GLRenderer::EnqueueTextureQuad(const DrawingFrame& frame, +void GLRenderer::EnqueueTextureQuad(const DrawingFrame* frame, const TextureDrawQuad* quad) { // Choose the correct texture program binding TexTransformTextureProgramBinding binding; @@ -1430,14 +1430,14 @@ void GLRenderer::EnqueueTextureQuad(const DrawingFrame& frame, // Generate the transform matrix gfx::Transform quad_rect_matrix; QuadRectTransform(&quad_rect_matrix, quad->quadTransform(), quad->rect); - quad_rect_matrix = frame.projection_matrix * quad_rect_matrix; + quad_rect_matrix = frame->projection_matrix * quad_rect_matrix; Float16 m; quad_rect_matrix.matrix().asColMajorf(m.data); draw_cache_.matrix_data.push_back(m); } -void GLRenderer::DrawTextureQuad(const DrawingFrame& frame, +void GLRenderer::DrawTextureQuad(const DrawingFrame* frame, const TextureDrawQuad* quad) { TexTransformTextureProgramBinding binding; if (quad->flipped) @@ -1485,7 +1485,7 @@ void GLRenderer::DrawTextureQuad(const DrawingFrame& frame, GLC(context_, context_->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); } -void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame& frame, +void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame* frame, const IOSurfaceDrawQuad* quad) { SetBlendEnabled(quad->ShouldDrawWithBlending()); @@ -1526,9 +1526,9 @@ void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame& frame, GLC(Context(), Context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, 0)); } -void GLRenderer::FinishDrawingFrame(DrawingFrame& frame) { +void GLRenderer::FinishDrawingFrame(DrawingFrame* frame) { current_framebuffer_lock_.reset(); - swap_buffer_rect_.Union(gfx::ToEnclosingRect(frame.root_damage_rect)); + swap_buffer_rect_.Union(gfx::ToEnclosingRect(frame->root_damage_rect)); GLC(context_, context_->disable(GL_BLEND)); blend_shadow_ = false; @@ -1605,21 +1605,21 @@ void GLRenderer::SetUseProgram(unsigned program) { program_shadow_ = program; } -void GLRenderer::DrawQuadGeometry(const DrawingFrame& frame, +void GLRenderer::DrawQuadGeometry(const DrawingFrame* frame, const gfx::Transform& draw_transform, const gfx::RectF& quad_rect, int matrix_location) { gfx::Transform quad_rect_matrix; QuadRectTransform(&quad_rect_matrix, draw_transform, quad_rect); static float gl_matrix[16]; - ToGLMatrix(&gl_matrix[0], frame.projection_matrix * quad_rect_matrix); + ToGLMatrix(&gl_matrix[0], frame->projection_matrix * quad_rect_matrix); GLC(context_, context_->uniformMatrix4fv(matrix_location, 1, false, &gl_matrix[0])); GLC(context_, context_->drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0)); } -void GLRenderer::CopyTextureToFramebuffer(const DrawingFrame& frame, +void GLRenderer::CopyTextureToFramebuffer(const DrawingFrame* frame, int texture_id, gfx::Rect rect, const gfx::Transform& draw_matrix) { @@ -1887,22 +1887,22 @@ bool GLRenderer::GetFramebufferTexture(ScopedResource* texture, return true; } -bool GLRenderer::UseScopedTexture(DrawingFrame& frame, +bool GLRenderer::UseScopedTexture(DrawingFrame* frame, const ScopedResource* texture, gfx::Rect viewport_rect) { DCHECK(texture->id()); - frame.current_render_pass = 0; - frame.current_texture = texture; + frame->current_render_pass = NULL; + frame->current_texture = texture; return BindFramebufferToTexture(frame, texture, viewport_rect); } -void GLRenderer::BindFramebufferToOutputSurface(DrawingFrame& frame) { +void GLRenderer::BindFramebufferToOutputSurface(DrawingFrame* frame) { current_framebuffer_lock_.reset(); output_surface_->BindFramebuffer(); } -bool GLRenderer::BindFramebufferToTexture(DrawingFrame& frame, +bool GLRenderer::BindFramebufferToTexture(DrawingFrame* frame, const ScopedResource* texture, gfx::Rect framebuffer_rect) { DCHECK(texture->id()); diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h index 8dd2c64..c30fa06 100644 --- a/cc/output/gl_renderer.h +++ b/cc/output/gl_renderer.h @@ -95,16 +95,16 @@ class CC_EXPORT GLRenderer : bool GetFramebufferTexture(ScopedResource* resource, gfx::Rect device_rect); void ReleaseRenderPassTextures(); - virtual void BindFramebufferToOutputSurface(DrawingFrame& frame) OVERRIDE; - virtual bool BindFramebufferToTexture(DrawingFrame& frame, + virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) OVERRIDE; + virtual bool BindFramebufferToTexture(DrawingFrame* frame, const ScopedResource* resource, gfx::Rect framebuffer_rect) OVERRIDE; virtual void SetDrawViewportSize(gfx::Size viewport_size) OVERRIDE; virtual void SetScissorTestRect(gfx::Rect scissor_rect) OVERRIDE; - virtual void ClearFramebuffer(DrawingFrame& frame) OVERRIDE; - virtual void DoDrawQuad(DrawingFrame& frame, const class DrawQuad*) OVERRIDE; - virtual void BeginDrawingFrame(DrawingFrame& frame) OVERRIDE; - virtual void FinishDrawingFrame(DrawingFrame& frame) OVERRIDE; + virtual void ClearFramebuffer(DrawingFrame* frame) OVERRIDE; + virtual void DoDrawQuad(DrawingFrame* frame, const class DrawQuad*) OVERRIDE; + virtual void BeginDrawingFrame(DrawingFrame* frame) OVERRIDE; + virtual void FinishDrawingFrame(DrawingFrame* frame) OVERRIDE; virtual bool FlippedFramebuffer() const OVERRIDE; virtual void EnsureScissorTestEnabled() OVERRIDE; virtual void EnsureScissorTestDisabled() OVERRIDE; @@ -117,40 +117,40 @@ class CC_EXPORT GLRenderer : static ManagedMemoryPolicy::PriorityCutoff PriorityCutoff( WebKit::WebGraphicsMemoryAllocation::PriorityCutoff priority_cutoff); - void DrawCheckerboardQuad(const DrawingFrame& frame, + void DrawCheckerboardQuad(const DrawingFrame* frame, const CheckerboardDrawQuad* quad); - void DrawDebugBorderQuad(const DrawingFrame& frame, + void DrawDebugBorderQuad(const DrawingFrame* frame, const DebugBorderDrawQuad* quad); scoped_ptr<ScopedResource> DrawBackgroundFilters( - DrawingFrame& frame, + DrawingFrame* frame, const RenderPassDrawQuad* quad, const gfx::Transform& contents_device_transform, const gfx::Transform& contents_device_transformInverse); - void DrawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQuad* quad); - void DrawSolidColorQuad(const DrawingFrame& frame, + void DrawRenderPassQuad(DrawingFrame* frame, const RenderPassDrawQuad* quad); + void DrawSolidColorQuad(const DrawingFrame* frame, const SolidColorDrawQuad* quad); - void DrawStreamVideoQuad(const DrawingFrame& frame, + void DrawStreamVideoQuad(const DrawingFrame* frame, const StreamVideoDrawQuad* quad); - void DrawTextureQuad(const DrawingFrame& frame, const TextureDrawQuad* quad); - void EnqueueTextureQuad(const DrawingFrame& frame, + void DrawTextureQuad(const DrawingFrame* frame, const TextureDrawQuad* quad); + void EnqueueTextureQuad(const DrawingFrame* frame, const TextureDrawQuad* quad); void FlushTextureQuadCache(); - void DrawIOSurfaceQuad(const DrawingFrame& frame, + void DrawIOSurfaceQuad(const DrawingFrame* frame, const IOSurfaceDrawQuad* quad); - void DrawTileQuad(const DrawingFrame& frame, const TileDrawQuad* quad); - void DrawYUVVideoQuad(const DrawingFrame& frame, + void DrawTileQuad(const DrawingFrame* frame, const TileDrawQuad* quad); + void DrawYUVVideoQuad(const DrawingFrame* frame, const YUVVideoDrawQuad* quad); void SetShaderOpacity(float opacity, int alpha_location); void SetShaderQuadF(const gfx::QuadF& quad, int quad_location); - void DrawQuadGeometry(const DrawingFrame& frame, + void DrawQuadGeometry(const DrawingFrame* frame, const gfx::Transform& draw_transform, const gfx::RectF& quad_rect, int matrix_location); void SetBlendEnabled(bool enabled); void SetUseProgram(unsigned program); - void CopyTextureToFramebuffer(const DrawingFrame& frame, + void CopyTextureToFramebuffer(const DrawingFrame* frame, int texture_id, gfx::Rect rect, const gfx::Transform& draw_matrix); @@ -166,7 +166,7 @@ class CC_EXPORT GLRenderer : gfx::QuadF* local_quad, float edge[24]) const; - bool UseScopedTexture(DrawingFrame& frame, + bool UseScopedTexture(DrawingFrame* frame, const ScopedResource* resource, gfx::Rect viewport_rect); diff --git a/cc/output/gl_renderer_pixeltest.cc b/cc/output/gl_renderer_pixeltest.cc index fbccce1..fde0f6d 100644 --- a/cc/output/gl_renderer_pixeltest.cc +++ b/cc/output/gl_renderer_pixeltest.cc @@ -87,7 +87,7 @@ TEST_F(GLRendererPixelTest, SimpleGreenRect) { RenderPassList pass_list; pass_list.push_back(pass.Pass()); - renderer_->DrawFrame(pass_list); + renderer_->DrawFrame(&pass_list); EXPECT_TRUE(PixelsMatchReference( base::FilePath(FILE_PATH_LITERAL("green.png")))); @@ -141,7 +141,7 @@ TEST_F(GLRendererPixelTest, RenderPassChangesSize) { renderer_->SetEnlargePassTextureAmountForTesting(gfx::Vector2d(50, 75)); renderer_->DecideRenderPassAllocationsForFrame(pass_list); - renderer_->DrawFrame(pass_list); + renderer_->DrawFrame(&pass_list); EXPECT_TRUE(PixelsMatchReference( base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")))); @@ -254,7 +254,7 @@ class GLRendererPixelTestWithBackgroundFilter : public GLRendererPixelTest { pass_list.push_back(root_pass.Pass()); renderer_->DecideRenderPassAllocationsForFrame(pass_list); - renderer_->DrawFrame(pass_list); + renderer_->DrawFrame(&pass_list); } WebKit::WebFilterOperations background_filters_; @@ -314,7 +314,7 @@ TEST_F(GLRendererPixelTest, AntiAliasing) { RenderPassList pass_list; pass_list.push_back(pass.Pass()); - renderer_->DrawFrame(pass_list); + renderer_->DrawFrame(&pass_list); EXPECT_TRUE(PixelsMatchReference( base::FilePath(FILE_PATH_LITERAL("anti_aliasing.png")))); diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc index 21a00d0..9a2ec24 100644 --- a/cc/output/gl_renderer_unittest.cc +++ b/cc/output/gl_renderer_unittest.cc @@ -161,7 +161,8 @@ class FakeRendererClient : public RendererClient { int set_full_root_layer_damage_count() const { return set_full_root_layer_damage_count_; } - void set_last_call_was_set_visibility_pointer(bool* last_call_was_set_visibility) { + void set_last_call_was_set_visibility_pointer( + bool* last_call_was_set_visibility) { last_call_was_set_visibility_ = last_call_was_set_visibility; } @@ -290,7 +291,7 @@ TEST_F(GLRendererTest, DiscardedBackbufferIsRecreatedForScopeDuration) { EXPECT_EQ(1, mock_client_.set_full_root_layer_damage_count()); renderer_.SetVisible(true); - renderer_.DrawFrame(*mock_client_.render_passes_in_draw_order()); + renderer_.DrawFrame(mock_client_.render_passes_in_draw_order()); EXPECT_FALSE(renderer_.IsBackbufferDiscarded()); SwapBuffers(); @@ -304,7 +305,7 @@ TEST_F(GLRendererTest, FramebufferDiscardedAfterReadbackWhenNotVisible) { EXPECT_EQ(1, mock_client_.set_full_root_layer_damage_count()); char pixels[4]; - renderer_.DrawFrame(*mock_client_.render_passes_in_draw_order()); + renderer_.DrawFrame(mock_client_.render_passes_in_draw_order()); EXPECT_FALSE(renderer_.IsBackbufferDiscarded()); renderer_.GetFramebufferPixels(pixels, gfx::Rect(0, 0, 1, 1)); @@ -316,11 +317,15 @@ class ForbidSynchronousCallContext : public TestWebGraphicsContext3D { public: ForbidSynchronousCallContext() {} - virtual bool getActiveAttrib(WebGLId program, WGC3Duint index, ActiveInfo& info) { + virtual bool getActiveAttrib(WebGLId program, + WGC3Duint index, + ActiveInfo& info) { ADD_FAILURE(); return false; } - virtual bool getActiveUniform(WebGLId program, WGC3Duint index, ActiveInfo& info) { + virtual bool getActiveUniform(WebGLId program, + WGC3Duint index, + ActiveInfo& info) { ADD_FAILURE(); return false; } @@ -527,9 +532,8 @@ class ContextThatDoesNotSupportMemoryManagmentExtensions : virtual WebString getString(WebKit::WGC3Denum name) { return WebString(); } }; -TEST( - GLRendererTest2, - InitializationWithoutGpuMemoryManagerExtensionSupportShouldDefaultToNonZeroAllocation) { +TEST(GLRendererTest2, + InitializationWithoutGpuMemoryManagerExtensionSupportShouldDefaultToNonZeroAllocation) { FakeRendererClient mock_client; scoped_ptr<OutputSurface> output_surface( FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( @@ -571,7 +575,7 @@ TEST(GLRendererTest2, OpaqueBackground) { EXPECT_TRUE(renderer.Initialize()); - renderer.DrawFrame(*mock_client.render_passes_in_draw_order()); + renderer.DrawFrame(mock_client.render_passes_in_draw_order()); // On DEBUG builds, render passes with opaque background clear to blue to // easily see regions that were not drawn on the screen. @@ -597,7 +601,7 @@ TEST(GLRendererTest2, TransparentBackground) { EXPECT_TRUE(renderer.Initialize()); - renderer.DrawFrame(*mock_client.render_passes_in_draw_order()); + renderer.DrawFrame(mock_client.render_passes_in_draw_order()); EXPECT_EQ(1, context->clear_count()); } @@ -642,7 +646,8 @@ class VisibilityChangeIsLastCallTrackingContext : } // Methods added for test. - void set_last_call_was_set_visibility_pointer(bool* last_call_was_set_visibility) { + void set_last_call_was_set_visibility_pointer( + bool* last_call_was_set_visibility) { last_call_was_set_visibility_ = last_call_was_set_visibility; } @@ -671,10 +676,12 @@ TEST(GLRendererTest2, VisibilityChangeIsLastCall) { // EnforceManagedMemoryPolicy is called. Plumb this tracking between both the // RenderClient and the Context by giving them both a pointer to a variable on // the stack. - context->set_last_call_was_set_visibility_pointer(&last_call_was_set_visiblity); - mock_client.set_last_call_was_set_visibility_pointer(&last_call_was_set_visiblity); + context->set_last_call_was_set_visibility_pointer( + &last_call_was_set_visiblity); + mock_client.set_last_call_was_set_visibility_pointer( + &last_call_was_set_visiblity); renderer.SetVisible(true); - renderer.DrawFrame(*mock_client.render_passes_in_draw_order()); + renderer.DrawFrame(mock_client.render_passes_in_draw_order()); renderer.SetVisible(false); EXPECT_TRUE(last_call_was_set_visiblity); } @@ -763,14 +770,14 @@ TEST(GLRendererTest2, ActiveTextureState) { } cc::DirectRenderer::DrawingFrame drawing_frame; - renderer.BeginDrawingFrame(drawing_frame); + renderer.BeginDrawingFrame(&drawing_frame); EXPECT_EQ(context->active_texture(), GL_TEXTURE0); for (cc::QuadList::BackToFrontIterator it = pass->quad_list.BackToFrontBegin(); it != pass->quad_list.BackToFrontEnd(); ++it) { - renderer.DoDrawQuad(drawing_frame, *it); + renderer.DoDrawQuad(&drawing_frame, *it); } renderer.FinishDrawingQuadList(); EXPECT_EQ(context->active_texture(), GL_TEXTURE0); @@ -838,7 +845,7 @@ TEST(GLRendererTest2, ShouldClearRootRenderPass) { renderer.DecideRenderPassAllocationsForFrame( *mock_client.render_passes_in_draw_order()); - renderer.DrawFrame(*mock_client.render_passes_in_draw_order()); + renderer.DrawFrame(mock_client.render_passes_in_draw_order()); // In multiple render passes all but the root pass should clear the // framebuffer. @@ -885,18 +892,18 @@ TEST(GLRendererTest2, ScissorTestWhenClearing) { gfx::Rect grand_child_rect(25, 25); RenderPass::Id grand_child_pass_id(3, 0); TestRenderPass* grand_child_pass = AddRenderPass( - & render_passes, grand_child_pass_id, grand_child_rect, gfx::Transform()); + &render_passes, grand_child_pass_id, grand_child_rect, gfx::Transform()); AddClippedQuad(grand_child_pass, grand_child_rect, SK_ColorYELLOW); gfx::Rect child_rect(50, 50); RenderPass::Id child_pass_id(2, 0); - TestRenderPass* child_pass = - AddRenderPass(&render_passes, child_pass_id, child_rect, gfx::Transform()); + TestRenderPass* child_pass = AddRenderPass( + &render_passes, child_pass_id, child_rect, gfx::Transform()); AddQuad(child_pass, child_rect, SK_ColorBLUE); RenderPass::Id root_pass_id(1, 0); TestRenderPass* root_pass = AddRenderPass( - & render_passes, root_pass_id, viewport_rect, gfx::Transform()); + &render_passes, root_pass_id, viewport_rect, gfx::Transform()); AddQuad(root_pass, viewport_rect, SK_ColorGREEN); AddRenderPassQuad(root_pass, child_pass); @@ -904,7 +911,7 @@ TEST(GLRendererTest2, ScissorTestWhenClearing) { renderer.DecideRenderPassAllocationsForFrame( *mock_client.render_passes_in_draw_order()); - renderer.DrawFrame(*mock_client.render_passes_in_draw_order()); + renderer.DrawFrame(mock_client.render_passes_in_draw_order()); } class OutputSurfaceMockContext : public TestWebGraphicsContext3D { @@ -976,8 +983,9 @@ class MockOutputSurfaceTest : public testing::Test, public FakeRendererClient { EXPECT_CALL(*context(), drawElements(_, _, _, _)).Times(1); - renderer_.DecideRenderPassAllocationsForFrame(*render_passes_in_draw_order()); - renderer_.DrawFrame(*render_passes_in_draw_order()); + renderer_.DecideRenderPassAllocationsForFrame( + *render_passes_in_draw_order()); + renderer_.DrawFrame(render_passes_in_draw_order()); } OutputSurfaceMockContext* context() { diff --git a/cc/output/renderer.h b/cc/output/renderer.h index 4a6dea2..c4dcf3f 100644 --- a/cc/output/renderer.h +++ b/cc/output/renderer.h @@ -56,7 +56,7 @@ class CC_EXPORT Renderer { // This passes ownership of the render passes to the renderer. It should // consume them, and empty the list. - virtual void DrawFrame(RenderPassList& render_passes_in_draw_order) = 0; + virtual void DrawFrame(RenderPassList* render_passes_in_draw_order) = 0; // Waits for rendering to finish. virtual void Finish() = 0; diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc index 3b97ea0..33dfacf 100644 --- a/cc/output/software_renderer.cc +++ b/cc/output/software_renderer.cc @@ -95,13 +95,13 @@ void SoftwareRenderer::ViewportChanged() { output_device_->Resize(ViewportSize()); } -void SoftwareRenderer::BeginDrawingFrame(DrawingFrame& frame) { +void SoftwareRenderer::BeginDrawingFrame(DrawingFrame* frame) { TRACE_EVENT0("cc", "SoftwareRenderer::BeginDrawingFrame"); root_canvas_ = output_device_->BeginPaint( - gfx::ToEnclosingRect(frame.root_damage_rect)); + gfx::ToEnclosingRect(frame->root_damage_rect)); } -void SoftwareRenderer::FinishDrawingFrame(DrawingFrame& frame) { +void SoftwareRenderer::FinishDrawingFrame(DrawingFrame* frame) { TRACE_EVENT0("cc", "SoftwareRenderer::FinishDrawingFrame"); current_framebuffer_lock_.reset(); current_canvas_ = NULL; @@ -148,13 +148,13 @@ void SoftwareRenderer::EnsureScissorTestDisabled() { void SoftwareRenderer::Finish() {} -void SoftwareRenderer::BindFramebufferToOutputSurface(DrawingFrame& frame) { +void SoftwareRenderer::BindFramebufferToOutputSurface(DrawingFrame* frame) { current_framebuffer_lock_.reset(); current_canvas_ = root_canvas_; } bool SoftwareRenderer::BindFramebufferToTexture( - DrawingFrame& frame, + DrawingFrame* frame, const ScopedResource* texture, gfx::Rect framebuffer_rect) { current_framebuffer_lock_ = make_scoped_ptr( @@ -190,8 +190,8 @@ void SoftwareRenderer::ClearCanvas(SkColor color) { current_canvas_->clear(color); } -void SoftwareRenderer::ClearFramebuffer(DrawingFrame& frame) { - if (frame.current_render_pass->has_transparent_background) { +void SoftwareRenderer::ClearFramebuffer(DrawingFrame* frame) { + if (frame->current_render_pass->has_transparent_background) { ClearCanvas(SkColorSetARGB(0, 0, 0, 0)); } else { #ifndef NDEBUG @@ -217,12 +217,12 @@ bool SoftwareRenderer::IsSoftwareResource( return false; } -void SoftwareRenderer::DoDrawQuad(DrawingFrame& frame, const DrawQuad* quad) { +void SoftwareRenderer::DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) { TRACE_EVENT0("cc", "SoftwareRenderer::DoDrawQuad"); gfx::Transform quad_rect_matrix; QuadRectTransform(&quad_rect_matrix, quad->quadTransform(), quad->rect); gfx::Transform contents_device_transform = - frame.window_matrix * frame.projection_matrix * quad_rect_matrix; + frame->window_matrix * frame->projection_matrix * quad_rect_matrix; contents_device_transform.FlattenTo2d(); SkMatrix sk_device_matrix; ToSkMatrix(&sk_device_matrix, contents_device_transform); @@ -265,7 +265,7 @@ void SoftwareRenderer::DoDrawQuad(DrawingFrame& frame, const DrawQuad* quad) { current_canvas_->resetMatrix(); } -void SoftwareRenderer::DrawDebugBorderQuad(const DrawingFrame& frame, +void SoftwareRenderer::DrawDebugBorderQuad(const DrawingFrame* frame, const DebugBorderDrawQuad* quad) { // We need to apply the matrix manually to have pixel-sized stroke width. SkPoint vertices[4]; @@ -284,7 +284,7 @@ void SoftwareRenderer::DrawDebugBorderQuad(const DrawingFrame& frame, 4, transformed_vertices, current_paint_); } -void SoftwareRenderer::DrawSolidColorQuad(const DrawingFrame& frame, +void SoftwareRenderer::DrawSolidColorQuad(const DrawingFrame* frame, const SolidColorDrawQuad* quad) { current_paint_.setColor(quad->color); current_paint_.setAlpha(quad->opacity() * SkColorGetA(quad->color)); @@ -292,7 +292,7 @@ void SoftwareRenderer::DrawSolidColorQuad(const DrawingFrame& frame, current_paint_); } -void SoftwareRenderer::DrawTextureQuad(const DrawingFrame& frame, +void SoftwareRenderer::DrawTextureQuad(const DrawingFrame* frame, const TextureDrawQuad* quad) { if (!IsSoftwareResource(quad->resource_id)) { DrawUnsupportedQuad(frame, quad); @@ -315,7 +315,7 @@ void SoftwareRenderer::DrawTextureQuad(const DrawingFrame& frame, ¤t_paint_); } -void SoftwareRenderer::DrawTileQuad(const DrawingFrame& frame, +void SoftwareRenderer::DrawTileQuad(const DrawingFrame* frame, const TileDrawQuad* quad) { DCHECK(IsSoftwareResource(quad->resource_id)); ResourceProvider::ScopedReadLockSoftware lock(resource_provider_, @@ -328,7 +328,7 @@ void SoftwareRenderer::DrawTileQuad(const DrawingFrame& frame, ¤t_paint_); } -void SoftwareRenderer::DrawRenderPassQuad(const DrawingFrame& frame, +void SoftwareRenderer::DrawRenderPassQuad(const DrawingFrame* frame, const RenderPassDrawQuad* quad) { CachedResource* content_texture = render_pass_textures_.get(quad->render_pass_id); @@ -394,7 +394,7 @@ void SoftwareRenderer::DrawRenderPassQuad(const DrawingFrame& frame, } } -void SoftwareRenderer::DrawUnsupportedQuad(const DrawingFrame& frame, +void SoftwareRenderer::DrawUnsupportedQuad(const DrawingFrame* frame, const DrawQuad* quad) { #ifndef NDEBUG current_paint_.setColor(SK_ColorWHITE); diff --git a/cc/output/software_renderer.h b/cc/output/software_renderer.h index 5e2c4c1..64d4378 100644 --- a/cc/output/software_renderer.h +++ b/cc/output/software_renderer.h @@ -44,17 +44,17 @@ class CC_EXPORT SoftwareRenderer : public DirectRenderer { const CompositorFrameAck& ack) OVERRIDE; protected: - virtual void BindFramebufferToOutputSurface(DrawingFrame& frame) OVERRIDE; + virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) OVERRIDE; virtual bool BindFramebufferToTexture( - DrawingFrame& frame, + DrawingFrame* frame, const ScopedResource* texture, gfx::Rect framebuffer_rect) OVERRIDE; virtual void SetDrawViewportSize(gfx::Size viewport_size) OVERRIDE; virtual void SetScissorTestRect(gfx::Rect scissor_rect) OVERRIDE; - virtual void ClearFramebuffer(DrawingFrame& frame) OVERRIDE; - virtual void DoDrawQuad(DrawingFrame& frame, const DrawQuad* quad) OVERRIDE; - virtual void BeginDrawingFrame(DrawingFrame& frame) OVERRIDE; - virtual void FinishDrawingFrame(DrawingFrame& frame) OVERRIDE; + virtual void ClearFramebuffer(DrawingFrame* frame) OVERRIDE; + virtual void DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) OVERRIDE; + virtual void BeginDrawingFrame(DrawingFrame* frame) OVERRIDE; + virtual void FinishDrawingFrame(DrawingFrame* frame) OVERRIDE; virtual bool FlippedFramebuffer() const OVERRIDE; virtual void EnsureScissorTestEnabled() OVERRIDE; virtual void EnsureScissorTestDisabled() OVERRIDE; @@ -69,17 +69,17 @@ class CC_EXPORT SoftwareRenderer : public DirectRenderer { void SetClipRect(gfx::Rect rect); bool IsSoftwareResource(ResourceProvider::ResourceId resource_id) const; - void DrawDebugBorderQuad(const DrawingFrame& frame, + void DrawDebugBorderQuad(const DrawingFrame* frame, const DebugBorderDrawQuad* quad); - void DrawSolidColorQuad(const DrawingFrame& frame, + void DrawSolidColorQuad(const DrawingFrame* frame, const SolidColorDrawQuad* quad); - void DrawTextureQuad(const DrawingFrame& frame, + void DrawTextureQuad(const DrawingFrame* frame, const TextureDrawQuad* quad); - void DrawTileQuad(const DrawingFrame& frame, + void DrawTileQuad(const DrawingFrame* frame, const TileDrawQuad* quad); - void DrawRenderPassQuad(const DrawingFrame& frame, + void DrawRenderPassQuad(const DrawingFrame* frame, const RenderPassDrawQuad* quad); - void DrawUnsupportedQuad(const DrawingFrame& frame, + void DrawUnsupportedQuad(const DrawingFrame* frame, const DrawQuad* quad); RendererCapabilities capabilities_; diff --git a/cc/output/software_renderer_unittest.cc b/cc/output/software_renderer_unittest.cc index ae524dc..e324fe9 100644 --- a/cc/output/software_renderer_unittest.cc +++ b/cc/output/software_renderer_unittest.cc @@ -107,7 +107,7 @@ TEST_F(SoftwareRendererTest, SolidColorQuad) { RenderPassList list; list.push_back(root_render_pass.PassAs<RenderPass>()); - renderer()->DrawFrame(list); + renderer()->DrawFrame(&list); scoped_array<SkColor> pixels(new SkColor[DeviceViewportSize().width() * DeviceViewportSize().height()]); @@ -193,7 +193,7 @@ TEST_F(SoftwareRendererTest, TileQuad) { RenderPassList list; list.push_back(root_render_pass.PassAs<RenderPass>()); - renderer()->DrawFrame(list); + renderer()->DrawFrame(&list); scoped_array<SkColor> pixels(new SkColor[DeviceViewportSize().width() * DeviceViewportSize().height()]); @@ -217,12 +217,12 @@ TEST_F(SoftwareRendererTest, ShouldClearRootRenderPass) { // Draw a fullscreen green quad in a first frame. RenderPass::Id root_clear_pass_id(1, 0); - TestRenderPass* root_clear_pass = - AddRenderPass(&list, root_clear_pass_id, viewport_rect, gfx::Transform()); + TestRenderPass* root_clear_pass = AddRenderPass( + &list, root_clear_pass_id, viewport_rect, gfx::Transform()); AddQuad(root_clear_pass, viewport_rect, SK_ColorGREEN); renderer()->DecideRenderPassAllocationsForFrame(list); - renderer()->DrawFrame(list); + renderer()->DrawFrame(&list); renderer()->GetFramebufferPixels(pixels.get(), viewport_rect); EXPECT_EQ(SK_ColorGREEN, pixels[0]); @@ -240,7 +240,7 @@ TEST_F(SoftwareRendererTest, ShouldClearRootRenderPass) { AddQuad(root_smaller_pass, smaller_rect, SK_ColorMAGENTA); renderer()->DecideRenderPassAllocationsForFrame(list); - renderer()->DrawFrame(list); + renderer()->DrawFrame(&list); renderer()->GetFramebufferPixels(pixels.get(), viewport_rect); // If we didn't clear, the borders should still be green. diff --git a/cc/resources/picture_layer_tiling_set.cc b/cc/resources/picture_layer_tiling_set.cc index f4a21a7..67173ba 100644 --- a/cc/resources/picture_layer_tiling_set.cc +++ b/cc/resources/picture_layer_tiling_set.cc @@ -223,7 +223,7 @@ PictureLayerTilingSet::Iterator& PictureLayerTilingSet::Iterator::operator++() { // This will also happen the first time through the loop. if (!region_iter_.has_rect()) { current_tiling_ = NextTiling(); - current_region_.Swap(missing_region_); + current_region_.Swap(&missing_region_); missing_region_.Clear(); region_iter_ = Region::Iterator(current_region_); diff --git a/cc/resources/tile_priority.cc b/cc/resources/tile_priority.cc index d1c3fbf..932434f 100644 --- a/cc/resources/tile_priority.cc +++ b/cc/resources/tile_priority.cc @@ -30,8 +30,11 @@ bool Range::IsEmpty() { return start_ >= end_; } -inline void IntersectNegativeHalfplane(Range* out, float previous, - float current, float target, float time_delta) { +inline void IntersectNegativeHalfplane(Range* out, + float previous, + float current, + float target, + float time_delta) { float time_per_dist = time_delta / (current - previous); float t = (target - current) * time_per_dist; if (time_per_dist > 0.0f) @@ -40,8 +43,11 @@ inline void IntersectNegativeHalfplane(Range* out, float previous, out->end_ = std::min(out->end_, t); } -inline void IntersectPositiveHalfplane(Range* out, float previous, - float current, float target, float time_delta) { +inline void IntersectPositiveHalfplane(Range* out, + float previous, + float current, + float target, + float time_delta) { float time_per_dist = time_delta / (current - previous); float t = (target - current) * time_per_dist; if (time_per_dist < 0.0f) diff --git a/cc/trees/layer_sorter.cc b/cc/trees/layer_sorter.cc index 235397b..232f29f 100644 --- a/cc/trees/layer_sorter.cc +++ b/cc/trees/layer_sorter.cc @@ -193,7 +193,7 @@ LayerShape::LayerShape(float width, MathUtil::MapClippedQuad(draw_transform, layer_quad, clipped_quad, - num_vertices_in_clipped_quad); + &num_vertices_in_clipped_quad); if (num_vertices_in_clipped_quad < 3) { projected_bounds = gfx::RectF(); diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc index ddad541..d4ff04e 100644 --- a/cc/trees/layer_tree_host_common.cc +++ b/cc/trees/layer_tree_host_common.cc @@ -558,7 +558,7 @@ static inline void UpdateLayerContentsScale( template <typename LayerType, typename LayerList> static inline void RemoveSurfaceForEarlyExit( LayerType* layer_to_remove, - LayerList& render_surface_layer_list) { + LayerList* render_surface_layer_list) { DCHECK(layer_to_remove->render_surface()); // Technically, we know that the layer we want to remove should be // at the back of the render_surface_layer_list. However, we have had diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index aaf0ada..24b84ead 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -1000,7 +1000,7 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame, if (active_tree_->hud_layer()) active_tree_->hud_layer()->UpdateHudTexture(resource_provider_.get()); - renderer_->DrawFrame(frame->render_passes); + renderer_->DrawFrame(&frame->render_passes); // The render passes should be consumed by the renderer. DCHECK(frame->render_passes.empty()); frame->render_passes_by_id.clear(); diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index aeca5de..b20f0e0 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -4282,18 +4282,18 @@ class TestRenderer : public GLRenderer, public RendererClient { }; static void ConfigureRenderPassTestData(const char* test_script, - RenderPassRemovalTestData& test_data, + RenderPassRemovalTestData* test_data, TestRenderer* renderer) { renderer->ClearCachedTextures(); // One shared state for all quads - we don't need the correct details - test_data.shared_quad_state = SharedQuadState::Create(); - test_data.shared_quad_state->SetAll(gfx::Transform(), - gfx::Size(), - gfx::Rect(), - gfx::Rect(), - false, - 1.f); + test_data->shared_quad_state = SharedQuadState::Create(); + test_data->shared_quad_state->SetAll(gfx::Transform(), + gfx::Size(), + gfx::Rect(), + gfx::Rect(), + false, + 1.f); const char* current_char = test_script; @@ -4302,7 +4302,7 @@ static void ConfigureRenderPassTestData(const char* test_script, RenderPass::Id(test_script[0], test_script[1]); scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); pass->SetNew(root_render_pass_id, gfx::Rect(), gfx::Rect(), gfx::Transform()); - test_data.render_pass_cache.add(root_render_pass_id, pass.Pass()); + test_data->render_pass_cache.add(root_render_pass_id, pass.Pass()); while (*current_char) { int layer_id = *current_char; current_char++; @@ -4313,18 +4313,18 @@ static void ConfigureRenderPassTestData(const char* test_script, RenderPass::Id render_pass_id = RenderPass::Id(layer_id, index); bool is_replica = false; - if (!test_data.render_pass_cache.contains(render_pass_id)) + if (!test_data->render_pass_cache.contains(render_pass_id)) is_replica = true; scoped_ptr<TestRenderPass> render_pass = - test_data.render_pass_cache.take(render_pass_id); + test_data->render_pass_cache.take(render_pass_id); // Cycle through quad data and create all quads. while (*current_char && *current_char != '\n') { if (*current_char == 's') { // Solid color draw quad. scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); - quad->SetNew(test_data.shared_quad_state.get(), + quad->SetNew(test_data->shared_quad_state.get(), gfx::Rect(0, 0, 10, 10), SK_ColorWHITE); @@ -4359,8 +4359,8 @@ static void ConfigureRenderPassTestData(const char* test_script, current_char++; } - if (test_data.render_pass_cache.find(new_render_pass_id) == - test_data.render_pass_cache.end()) { + if (test_data->render_pass_cache.find(new_render_pass_id) == + test_data->render_pass_cache.end()) { if (has_texture) renderer->SetHaveCachedResourcesForRenderPassId(new_render_pass_id); @@ -4369,14 +4369,14 @@ static void ConfigureRenderPassTestData(const char* test_script, gfx::Rect(), gfx::Rect(), gfx::Transform()); - test_data.render_pass_cache.add(new_render_pass_id, pass.Pass()); + test_data->render_pass_cache.add(new_render_pass_id, pass.Pass()); } gfx::Rect quad_rect = gfx::Rect(0, 0, 1, 1); gfx::Rect contents_changed_rect = contents_changed ? quad_rect : gfx::Rect(); scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create(); - quad->SetNew(test_data.shared_quad_state.get(), + quad->SetNew(test_data->shared_quad_state.get(), quad_rect, new_render_pass_id, is_replica, @@ -4389,9 +4389,9 @@ static void ConfigureRenderPassTestData(const char* test_script, render_pass->AppendQuad(quad.PassAs<DrawQuad>()); } } - test_data.render_passes_by_id[render_pass_id] = render_pass.get(); - test_data.render_passes.insert(test_data.render_passes.begin(), - render_pass.PassAs<RenderPass>()); + test_data->render_passes_by_id[render_pass_id] = render_pass.get(); + test_data->render_passes.insert(test_data->render_passes.begin(), + render_pass.PassAs<RenderPass>()); if (*current_char) current_char++; } @@ -4607,7 +4607,7 @@ TEST_F(LayerTreeHostImplTest, TestRemoveRenderPasses) { RenderPassRemovalTestData test_data; ConfigureRenderPassTestData( remove_render_passes_cases[test_case_index].init_script, - test_data, + &test_data, renderer.get()); LayerTreeHostImpl::RemoveRenderPasses( LayerTreeHostImpl::CullRenderPassesWithCachedTextures(renderer.get()), diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc index d683097..ad0e74a 100644 --- a/cc/trees/occlusion_tracker_unittest.cc +++ b/cc/trees/occlusion_tracker_unittest.cc @@ -346,50 +346,50 @@ template <typename Types> class OcclusionTrackerTest : public testing::Test { } void EnterLayer(typename Types::LayerType* layer, - typename Types::OcclusionTrackerType& occlusion) { + typename Types::OcclusionTrackerType* occlusion) { ASSERT_EQ(layer, *layer_iterator_); ASSERT_TRUE(layer_iterator_.represents_itself()); - occlusion.EnterLayer(layer_iterator_); + occlusion->EnterLayer(layer_iterator_); } void LeaveLayer(typename Types::LayerType* layer, - typename Types::OcclusionTrackerType& occlusion) { + typename Types::OcclusionTrackerType* occlusion) { ASSERT_EQ(layer, *layer_iterator_); ASSERT_TRUE(layer_iterator_.represents_itself()); - occlusion.LeaveLayer(layer_iterator_); + occlusion->LeaveLayer(layer_iterator_); ++layer_iterator_; } void VisitLayer(typename Types::LayerType* layer, - typename Types::OcclusionTrackerType& occlusion) { + typename Types::OcclusionTrackerType* occlusion) { EnterLayer(layer, occlusion); LeaveLayer(layer, occlusion); } void EnterContributingSurface( typename Types::LayerType* layer, - typename Types::OcclusionTrackerType& occlusion) { + typename Types::OcclusionTrackerType* occlusion) { ASSERT_EQ(layer, *layer_iterator_); ASSERT_TRUE(layer_iterator_.represents_target_render_surface()); - occlusion.EnterLayer(layer_iterator_); - occlusion.LeaveLayer(layer_iterator_); + occlusion->EnterLayer(layer_iterator_); + occlusion->LeaveLayer(layer_iterator_); ++layer_iterator_; ASSERT_TRUE(layer_iterator_.represents_contributing_render_surface()); - occlusion.EnterLayer(layer_iterator_); + occlusion->EnterLayer(layer_iterator_); } void LeaveContributingSurface( typename Types::LayerType* layer, - typename Types::OcclusionTrackerType& occlusion) { + typename Types::OcclusionTrackerType* occlusion) { ASSERT_EQ(layer, *layer_iterator_); ASSERT_TRUE(layer_iterator_.represents_contributing_render_surface()); - occlusion.LeaveLayer(layer_iterator_); + occlusion->LeaveLayer(layer_iterator_); ++layer_iterator_; } void VisitContributingSurface( typename Types::LayerType* layer, - typename Types::OcclusionTrackerType& occlusion) { + typename Types::OcclusionTrackerType* occlusion) { EnterContributingSurface(layer, occlusion); LeaveContributingSurface(layer, occlusion); } @@ -545,8 +545,8 @@ class OcclusionTrackerTestIdentityTransforms : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000), false); - this->VisitLayer(layer, occlusion); - this->EnterLayer(parent, occlusion); + this->VisitLayer(layer, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -612,8 +612,8 @@ class OcclusionTrackerTestQuadsMismatchLayer : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(layer2, occlusion); - this->EnterLayer(layer1, occlusion); + this->VisitLayer(layer2, &occlusion); + this->EnterLayer(layer1, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -700,8 +700,8 @@ class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest<Types> { typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(layer, occlusion); - this->EnterLayer(parent, occlusion); + this->VisitLayer(layer, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -771,8 +771,8 @@ class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest<Types> { typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(layer, occlusion); - this->EnterLayer(parent, occlusion); + this->VisitLayer(layer, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -843,16 +843,16 @@ class OcclusionTrackerTestChildInRotatedChild : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(layer, occlusion); - this->EnterContributingSurface(child, occlusion); + this->VisitLayer(layer, &occlusion); + this->EnterContributingSurface(child, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->LeaveContributingSurface(child, occlusion); - this->EnterLayer(parent, occlusion); + this->LeaveContributingSurface(child, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -950,8 +950,8 @@ class OcclusionTrackerTestScaledRenderSurface : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(occluder, occlusion); - this->EnterLayer(layer2, occlusion); + this->VisitLayer(occluder, &occlusion); + this->EnterLayer(layer2, &occlusion); EXPECT_EQ(gfx::Rect(100, 100, 100, 100).ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -1015,21 +1015,21 @@ class OcclusionTrackerTestVisitTargetTwoTimes : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(child2, occlusion); + this->VisitLayer(child2, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); EXPECT_EQ(gfx::Rect(30, 30, 60, 20).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->VisitLayer(layer, occlusion); + this->VisitLayer(layer, &occlusion); EXPECT_EQ(gfx::Rect(0, 440, 20, 60).ToString(), occlusion.occlusion_from_outside_target().ToString()); EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->EnterContributingSurface(child, occlusion); + this->EnterContributingSurface(child, &occlusion); EXPECT_EQ(gfx::Rect(0, 440, 20, 60).ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -1038,8 +1038,8 @@ class OcclusionTrackerTestVisitTargetTwoTimes : // Occlusion in |child2| should get merged with the |child| surface we are // leaving now. - this->LeaveContributingSurface(child, occlusion); - this->EnterLayer(parent, occlusion); + this->LeaveContributingSurface(child, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -1185,16 +1185,16 @@ class OcclusionTrackerTestSurfaceRotatedOffAxis : gfx::Rect clipped_layer_in_child = MathUtil::MapClippedRect( layer_transform, layer->visible_content_rect()); - this->VisitLayer(layer, occlusion); - this->EnterContributingSurface(child, occlusion); + this->VisitLayer(layer, &occlusion); + this->EnterContributingSurface(child, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); EXPECT_EQ(clipped_layer_in_child.ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->LeaveContributingSurface(child, occlusion); - this->EnterLayer(parent, occlusion); + this->LeaveContributingSurface(child, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -1252,10 +1252,10 @@ class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(layer2, occlusion); - this->VisitLayer(layer1, occlusion); - this->VisitLayer(child, occlusion); - this->EnterContributingSurface(child, occlusion); + this->VisitLayer(layer2, &occlusion); + this->VisitLayer(layer1, &occlusion); + this->VisitLayer(child, &occlusion); + this->EnterContributingSurface(child, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -1287,8 +1287,8 @@ class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : occlusion.UnoccludedLayerContentRect( child, gfx::Rect(10, 431, 60, 70))); - this->LeaveContributingSurface(child, occlusion); - this->EnterLayer(parent, occlusion); + this->LeaveContributingSurface(child, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -1380,8 +1380,8 @@ class OcclusionTrackerTestOverlappingSurfaceSiblings : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(layer2, occlusion); - this->EnterContributingSurface(child2, occlusion); + this->VisitLayer(layer2, &occlusion); + this->EnterContributingSurface(child2, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -1399,9 +1399,9 @@ class OcclusionTrackerTestOverlappingSurfaceSiblings : occlusion.UnoccludedContributingSurfaceContentRect( child2, false, gfx::Rect(-10, 420, 70, 80), NULL)); - this->LeaveContributingSurface(child2, occlusion); - this->VisitLayer(layer1, occlusion); - this->EnterContributingSurface(child1, occlusion); + this->LeaveContributingSurface(child2, &occlusion); + this->VisitLayer(layer1, &occlusion); + this->EnterContributingSurface(child1, &occlusion); EXPECT_EQ(gfx::Rect(0, 430, 70, 80).ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -1413,8 +1413,8 @@ class OcclusionTrackerTestOverlappingSurfaceSiblings : occlusion.UnoccludedContributingSurfaceContentRect( child1, false, gfx::Rect(-10, 430, 80, 70), NULL)); - this->LeaveContributingSurface(child1, occlusion); - this->EnterLayer(parent, occlusion); + this->LeaveContributingSurface(child1, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -1507,25 +1507,25 @@ class OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(layer2, occlusion); - this->EnterLayer(child2, occlusion); + this->VisitLayer(layer2, &occlusion); + this->EnterLayer(child2, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); EXPECT_EQ(gfx::Rect(-10, 420, 70, 80).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->LeaveLayer(child2, occlusion); - this->EnterContributingSurface(child2, occlusion); + this->LeaveLayer(child2, &occlusion); + this->EnterContributingSurface(child2, &occlusion); // There is nothing above child2's surface in the z-order. EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.UnoccludedContributingSurfaceContentRect( child2, false, gfx::Rect(-10, 420, 70, 80), NULL)); - this->LeaveContributingSurface(child2, occlusion); - this->VisitLayer(layer1, occlusion); - this->EnterContributingSurface(child1, occlusion); + this->LeaveContributingSurface(child2, &occlusion); + this->VisitLayer(layer1, &occlusion); + this->EnterContributingSurface(child1, &occlusion); EXPECT_EQ(gfx::Rect(420, -10, 70, 80).ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -1543,8 +1543,8 @@ class OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms : occlusion.UnoccludedContributingSurfaceContentRect( child1, false, gfx::Rect(420, -20, 70, 90), NULL)); - this->LeaveContributingSurface(child1, occlusion); - this->EnterLayer(parent, occlusion); + this->LeaveContributingSurface(child1, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -1632,46 +1632,46 @@ class OcclusionTrackerTestFilters : public OcclusionTrackerTest<Types> { gfx::Rect(0, 0, 1000, 1000)); // Opacity layer won't contribute to occlusion. - this->VisitLayer(opacity_layer, occlusion); - this->EnterContributingSurface(opacity_layer, occlusion); + this->VisitLayer(opacity_layer, &occlusion); + this->EnterContributingSurface(opacity_layer, &occlusion); EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); // And has nothing to contribute to its parent surface. - this->LeaveContributingSurface(opacity_layer, occlusion); + this->LeaveContributingSurface(opacity_layer, &occlusion); EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); // Opaque layer will contribute to occlusion. - this->VisitLayer(opaque_layer, occlusion); - this->EnterContributingSurface(opaque_layer, occlusion); + this->VisitLayer(opaque_layer, &occlusion); + this->EnterContributingSurface(opaque_layer, &occlusion); EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); EXPECT_EQ(gfx::Rect(0, 430, 70, 70).ToString(), occlusion.occlusion_from_inside_target().ToString()); // And it gets translated to the parent surface. - this->LeaveContributingSurface(opaque_layer, occlusion); + this->LeaveContributingSurface(opaque_layer, &occlusion); EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusion_from_inside_target().ToString()); // The blur layer needs to throw away any occlusion from outside its // subtree. - this->EnterLayer(blur_layer, occlusion); + this->EnterLayer(blur_layer, &occlusion); EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); // And it won't contribute to occlusion. - this->LeaveLayer(blur_layer, occlusion); - this->EnterContributingSurface(blur_layer, occlusion); + this->LeaveLayer(blur_layer, &occlusion); + this->EnterContributingSurface(blur_layer, &occlusion); EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); // But the opaque layer's occlusion is preserved on the parent. - this->LeaveContributingSurface(blur_layer, occlusion); - this->EnterLayer(parent, occlusion); + this->LeaveContributingSurface(blur_layer, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusion_from_inside_target().ToString()); @@ -1703,13 +1703,13 @@ class OcclusionTrackerTestReplicaDoesOcclude : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(surface, occlusion); + this->VisitLayer(surface, &occlusion); EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->VisitContributingSurface(surface, occlusion); - this->EnterLayer(parent, occlusion); + this->VisitContributingSurface(surface, &occlusion); + this->EnterLayer(parent, &occlusion); // The surface and replica should both be occluding the parent. EXPECT_EQ( @@ -1745,13 +1745,13 @@ class OcclusionTrackerTestReplicaWithClipping : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(surface, occlusion); + this->VisitLayer(surface, &occlusion); EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->VisitContributingSurface(surface, occlusion); - this->EnterLayer(parent, occlusion); + this->VisitContributingSurface(surface, &occlusion); + this->EnterLayer(parent, &occlusion); // The surface and replica should both be occluding the parent. EXPECT_EQ( @@ -1786,13 +1786,13 @@ class OcclusionTrackerTestReplicaWithMask : public OcclusionTrackerTest<Types> { typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(surface, occlusion); + this->VisitLayer(surface, &occlusion); EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->VisitContributingSurface(surface, occlusion); - this->EnterLayer(parent, occlusion); + this->VisitContributingSurface(surface, &occlusion); + this->EnterLayer(parent, &occlusion); // The replica should not be occluding the parent, since it has a mask // applied to it. @@ -1831,7 +1831,7 @@ class OcclusionTrackerTestLayerClipRectOutsideChild : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->EnterLayer(layer, occlusion); + this->EnterLayer(layer, &occlusion); EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); @@ -1839,8 +1839,8 @@ class OcclusionTrackerTestLayerClipRectOutsideChild : EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(200, 100, 100, 100))); - this->LeaveLayer(layer, occlusion); - this->EnterLayer(clip, occlusion); + this->LeaveLayer(layer, &occlusion); + this->EnterLayer(clip, &occlusion); EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(-100, 0, 100, 100))); EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(0, -100, 100, 100))); @@ -1877,7 +1877,7 @@ class OcclusionTrackerTestViewportRectOutsideChild : typename Types::RenderSurfaceType> occlusion( gfx::Rect(200, 100, 100, 100)); - this->EnterLayer(layer, occlusion); + this->EnterLayer(layer, &occlusion); EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); @@ -1885,9 +1885,9 @@ class OcclusionTrackerTestViewportRectOutsideChild : EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(200, 100, 100, 100))); - this->LeaveLayer(layer, occlusion); - this->VisitContributingSurface(layer, occlusion); - this->EnterLayer(parent, occlusion); + this->LeaveLayer(layer, &occlusion); + this->VisitContributingSurface(layer, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 0, 100, 100))); EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 100, 100, 100))); @@ -1936,20 +1936,20 @@ class OcclusionTrackerTestLayerClipRectOverChild : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->EnterLayer(layer, occlusion); + this->EnterLayer(layer, &occlusion); EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); - this->LeaveLayer(layer, occlusion); - this->VisitContributingSurface(layer, occlusion); + this->LeaveLayer(layer, &occlusion); + this->VisitContributingSurface(layer, &occlusion); EXPECT_EQ(gfx::Rect(100, 100, 100, 100).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->EnterLayer(clip, occlusion); + this->EnterLayer(clip, &occlusion); EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(0, 0, 100, 100))); EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(0, 100, 100, 100))); @@ -1989,16 +1989,16 @@ class OcclusionTrackerTestViewportRectOverChild : typename Types::RenderSurfaceType> occlusion( gfx::Rect(100, 100, 100, 100)); - this->EnterLayer(layer, occlusion); + this->EnterLayer(layer, &occlusion); EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); - this->LeaveLayer(layer, occlusion); - this->VisitContributingSurface(layer, occlusion); - this->EnterLayer(parent, occlusion); + this->LeaveLayer(layer, &occlusion); + this->VisitContributingSurface(layer, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 0, 100, 100))); EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 100, 100, 100))); @@ -2045,7 +2045,7 @@ class OcclusionTrackerTestLayerClipRectPartlyOverChild : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->EnterLayer(layer, occlusion); + this->EnterLayer(layer, &occlusion); EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); @@ -2057,9 +2057,9 @@ class OcclusionTrackerTestLayerClipRectPartlyOverChild : EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 50))); EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 50, 100))); - this->LeaveLayer(layer, occlusion); - this->VisitContributingSurface(layer, occlusion); - this->EnterLayer(clip, occlusion); + this->LeaveLayer(layer, &occlusion); + this->VisitContributingSurface(layer, &occlusion); + this->EnterLayer(clip, &occlusion); EXPECT_EQ(gfx::Rect(50, 50, 150, 150).ToString(), occlusion.occlusion_from_inside_target().ToString()); @@ -2089,16 +2089,16 @@ class OcclusionTrackerTestViewportRectPartlyOverChild : typename Types::RenderSurfaceType> occlusion( gfx::Rect(50, 50, 200, 200)); - this->EnterLayer(layer, occlusion); + this->EnterLayer(layer, &occlusion); EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); - this->LeaveLayer(layer, occlusion); - this->VisitContributingSurface(layer, occlusion); - this->EnterLayer(parent, occlusion); + this->LeaveLayer(layer, &occlusion); + this->VisitContributingSurface(layer, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 0, 100, 100))); EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 100, 100, 100))); @@ -2154,16 +2154,16 @@ class OcclusionTrackerTestViewportRectOverNothing : typename Types::RenderSurfaceType> occlusion( gfx::Rect(500, 500, 100, 100)); - this->EnterLayer(layer, occlusion); + this->EnterLayer(layer, &occlusion); EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); - this->LeaveLayer(layer, occlusion); - this->VisitContributingSurface(layer, occlusion); - this->EnterLayer(parent, occlusion); + this->LeaveLayer(layer, &occlusion); + this->VisitContributingSurface(layer, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 0, 100, 100))); EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 100, 100, 100))); @@ -2210,7 +2210,7 @@ class OcclusionTrackerTestLayerClipRectForLayerOffOrigin : TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->EnterLayer(layer, occlusion); + this->EnterLayer(layer, &occlusion); // This layer is translated when drawn into its target. So if the clip rect // given from the target surface is not in that target space, then after @@ -2245,7 +2245,7 @@ class OcclusionTrackerTestOpaqueContentsRegionEmpty : TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->EnterLayer(layer, occlusion); + this->EnterLayer(layer, &occlusion); EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); @@ -2255,9 +2255,9 @@ class OcclusionTrackerTestOpaqueContentsRegionEmpty : // Occluded since its outside the surface bounds. EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(200, 100, 100, 100))); - this->LeaveLayer(layer, occlusion); - this->VisitContributingSurface(layer, occlusion); - this->EnterLayer(parent, occlusion); + this->LeaveLayer(layer, &occlusion); + this->VisitContributingSurface(layer, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); } @@ -2288,8 +2288,8 @@ class OcclusionTrackerTestOpaqueContentsRegionNonEmpty : layer->SetOpaqueContentsRect(gfx::Rect(0, 0, 100, 100)); this->ResetLayerIterator(); - this->VisitLayer(layer, occlusion); - this->EnterLayer(parent, occlusion); + this->VisitLayer(layer, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_EQ(gfx::Rect(100, 100, 100, 100).ToString(), occlusion.occlusion_from_inside_target().ToString()); @@ -2308,8 +2308,8 @@ class OcclusionTrackerTestOpaqueContentsRegionNonEmpty : layer->SetOpaqueContentsRect(gfx::Rect(20, 20, 180, 180)); this->ResetLayerIterator(); - this->VisitLayer(layer, occlusion); - this->EnterLayer(parent, occlusion); + this->VisitLayer(layer, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_EQ(gfx::Rect(120, 120, 180, 180).ToString(), occlusion.occlusion_from_inside_target().ToString()); @@ -2328,8 +2328,8 @@ class OcclusionTrackerTestOpaqueContentsRegionNonEmpty : layer->SetOpaqueContentsRect(gfx::Rect(150, 150, 100, 100)); this->ResetLayerIterator(); - this->VisitLayer(layer, occlusion); - this->EnterLayer(parent, occlusion); + this->VisitLayer(layer, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_EQ(gfx::Rect(250, 250, 50, 50).ToString(), occlusion.occlusion_from_inside_target().ToString()); @@ -2370,7 +2370,7 @@ class OcclusionTrackerTest3dTransform : public OcclusionTrackerTest<Types> { TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->EnterLayer(layer, occlusion); + this->EnterLayer(layer, &occlusion); // The layer is rotated in 3d but without preserving 3d, so it only gets // resized. @@ -2418,11 +2418,11 @@ class OcclusionTrackerTestUnsorted3dLayers : TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(child2, occlusion); + this->VisitLayer(child2, &occlusion); EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); - this->VisitLayer(child1, occlusion); + this->VisitLayer(child1, &occlusion); EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); } @@ -2462,7 +2462,7 @@ class OcclusionTrackerTestPerspectiveTransform : TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->EnterLayer(layer, occlusion); + this->EnterLayer(layer, &occlusion); EXPECT_RECT_EQ( gfx::Rect(0, 0, 200, 200), @@ -2505,7 +2505,7 @@ class OcclusionTrackerTestPerspectiveTransformBehindCamera : TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->EnterLayer(layer, occlusion); + this->EnterLayer(layer, &occlusion); // The bottom 11 pixel rows of this layer remain visible inside the // container, after translation to the target surface. When translated back, @@ -2547,8 +2547,8 @@ class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude : gfx::Rect(0, 0, 1000, 1000)); // The |layer| is entirely behind the camera and should not occlude. - this->VisitLayer(layer, occlusion); - this->EnterLayer(parent, occlusion); + this->VisitLayer(layer, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); } @@ -2588,8 +2588,8 @@ class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : // This is very close to the camera, so pixels in its visible_content_rect() // will actually go outside of the layer's clip rect. Ensure that those // pixels don't occlude things outside the clip rect. - this->VisitLayer(layer, occlusion); - this->EnterLayer(parent, occlusion); + this->VisitLayer(layer, &occlusion); + this->EnterLayer(parent, &occlusion); EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), occlusion.occlusion_from_inside_target().ToString()); EXPECT_EQ(gfx::Rect().ToString(), @@ -2670,8 +2670,8 @@ class OcclusionTrackerTestAnimationOpacity1OnMainThread : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(topmost, occlusion); - this->EnterLayer(parent2, occlusion); + this->VisitLayer(topmost, &occlusion); + this->EnterLayer(parent2, &occlusion); // This occlusion will affect all surfaces. EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusion_from_inside_target().ToString()); @@ -2680,10 +2680,10 @@ class OcclusionTrackerTestAnimationOpacity1OnMainThread : EXPECT_EQ(gfx::Rect(0, 0, 250, 300).ToString(), occlusion.UnoccludedLayerContentRect( parent2, gfx::Rect(0, 0, 300, 300)).ToString()); - this->LeaveLayer(parent2, occlusion); + this->LeaveLayer(parent2, &occlusion); - this->VisitLayer(surface_child2, occlusion); - this->EnterLayer(surface_child, occlusion); + this->VisitLayer(surface_child2, &occlusion); + this->EnterLayer(surface_child, &occlusion); EXPECT_EQ(gfx::Rect(0, 0, 100, 300).ToString(), occlusion.occlusion_from_inside_target().ToString()); EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), @@ -2691,8 +2691,8 @@ class OcclusionTrackerTestAnimationOpacity1OnMainThread : EXPECT_RECT_EQ(gfx::Rect(100, 0, 100, 300), occlusion.UnoccludedLayerContentRect( surface_child, gfx::Rect(0, 0, 200, 300))); - this->LeaveLayer(surface_child, occlusion); - this->EnterLayer(surface, occlusion); + this->LeaveLayer(surface_child, &occlusion); + this->EnterLayer(surface, &occlusion); EXPECT_EQ(gfx::Rect(0, 0, 200, 300).ToString(), occlusion.occlusion_from_inside_target().ToString()); EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), @@ -2700,9 +2700,9 @@ class OcclusionTrackerTestAnimationOpacity1OnMainThread : EXPECT_RECT_EQ(gfx::Rect(200, 0, 50, 300), occlusion.UnoccludedLayerContentRect( surface, gfx::Rect(0, 0, 300, 300))); - this->LeaveLayer(surface, occlusion); + this->LeaveLayer(surface, &occlusion); - this->EnterContributingSurface(surface, occlusion); + this->EnterContributingSurface(surface, &occlusion); // Occlusion within the surface is lost when leaving the animating surface. EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_inside_target().ToString()); @@ -2711,7 +2711,7 @@ class OcclusionTrackerTestAnimationOpacity1OnMainThread : EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.UnoccludedContributingSurfaceContentRect( surface, false, gfx::Rect(0, 0, 300, 300), NULL)); - this->LeaveContributingSurface(surface, occlusion); + this->LeaveContributingSurface(surface, &occlusion); // Occlusion from outside the animating surface still exists. EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), @@ -2719,8 +2719,8 @@ class OcclusionTrackerTestAnimationOpacity1OnMainThread : EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); - this->VisitLayer(layer, occlusion); - this->EnterLayer(parent, occlusion); + this->VisitLayer(layer, &occlusion); + this->EnterLayer(parent, &occlusion); // Occlusion is not added for the animating |layer|. EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), @@ -2791,8 +2791,8 @@ class OcclusionTrackerTestAnimationOpacity0OnMainThread : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(topmost, occlusion); - this->EnterLayer(parent2, occlusion); + this->VisitLayer(topmost, &occlusion); + this->EnterLayer(parent2, &occlusion); // This occlusion will affect all surfaces. EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusion_from_inside_target().ToString()); @@ -2801,10 +2801,10 @@ class OcclusionTrackerTestAnimationOpacity0OnMainThread : EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.UnoccludedLayerContentRect( parent, gfx::Rect(0, 0, 300, 300))); - this->LeaveLayer(parent2, occlusion); + this->LeaveLayer(parent2, &occlusion); - this->VisitLayer(surface_child2, occlusion); - this->EnterLayer(surface_child, occlusion); + this->VisitLayer(surface_child2, &occlusion); + this->EnterLayer(surface_child, &occlusion); EXPECT_EQ(gfx::Rect(0, 0, 100, 300).ToString(), occlusion.occlusion_from_inside_target().ToString()); EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), @@ -2812,8 +2812,8 @@ class OcclusionTrackerTestAnimationOpacity0OnMainThread : EXPECT_RECT_EQ(gfx::Rect(100, 0, 100, 300), occlusion.UnoccludedLayerContentRect( surface_child, gfx::Rect(0, 0, 200, 300))); - this->LeaveLayer(surface_child, occlusion); - this->EnterLayer(surface, occlusion); + this->LeaveLayer(surface_child, &occlusion); + this->EnterLayer(surface, &occlusion); EXPECT_EQ(gfx::Rect(0, 0, 200, 300).ToString(), occlusion.occlusion_from_inside_target().ToString()); EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), @@ -2821,9 +2821,9 @@ class OcclusionTrackerTestAnimationOpacity0OnMainThread : EXPECT_RECT_EQ(gfx::Rect(200, 0, 50, 300), occlusion.UnoccludedLayerContentRect( surface, gfx::Rect(0, 0, 300, 300))); - this->LeaveLayer(surface, occlusion); + this->LeaveLayer(surface, &occlusion); - this->EnterContributingSurface(surface, occlusion); + this->EnterContributingSurface(surface, &occlusion); // Occlusion within the surface is lost when leaving the animating surface. EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_inside_target().ToString()); @@ -2832,7 +2832,7 @@ class OcclusionTrackerTestAnimationOpacity0OnMainThread : EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.UnoccludedContributingSurfaceContentRect( surface, false, gfx::Rect(0, 0, 300, 300), NULL)); - this->LeaveContributingSurface(surface, occlusion); + this->LeaveContributingSurface(surface, &occlusion); // Occlusion from outside the animating surface still exists. EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), @@ -2840,8 +2840,8 @@ class OcclusionTrackerTestAnimationOpacity0OnMainThread : EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); - this->VisitLayer(layer, occlusion); - this->EnterLayer(parent, occlusion); + this->VisitLayer(layer, &occlusion); + this->EnterLayer(parent, &occlusion); // Occlusion is not added for the animating |layer|. EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), @@ -2912,14 +2912,14 @@ class OcclusionTrackerTestAnimationTranslateOnMainThread : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(surface2, occlusion); - this->EnterContributingSurface(surface2, occlusion); + this->VisitLayer(surface2, &occlusion); + this->EnterContributingSurface(surface2, &occlusion); EXPECT_EQ(gfx::Rect(0, 0, 50, 300).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->LeaveContributingSurface(surface2, occlusion); - this->EnterLayer(surface_child2, occlusion); + this->LeaveContributingSurface(surface2, &occlusion); + this->EnterLayer(surface_child2, &occlusion); // surface_child2 is moving in screen space but not relative to its target, // so occlusion should happen in its target space only. It also means that @@ -2934,8 +2934,8 @@ class OcclusionTrackerTestAnimationTranslateOnMainThread : EXPECT_FALSE( occlusion.OccludedLayer(surface_child, gfx::Rect(0, 0, 50, 300))); - this->LeaveLayer(surface_child2, occlusion); - this->EnterLayer(surface_child, occlusion); + this->LeaveLayer(surface_child2, &occlusion); + this->EnterLayer(surface_child, &occlusion); EXPECT_FALSE( occlusion.OccludedLayer(surface_child, gfx::Rect(0, 0, 100, 300))); EXPECT_EQ(gfx::Rect().ToString(), @@ -2954,8 +2954,8 @@ class OcclusionTrackerTestAnimationTranslateOnMainThread : EXPECT_FALSE( occlusion.OccludedLayer(surface_child, gfx::Rect(0, 0, 50, 300))); - this->LeaveLayer(surface_child, occlusion); - this->EnterLayer(surface, occlusion); + this->LeaveLayer(surface_child, &occlusion); + this->EnterLayer(surface, &occlusion); // The surface_child is moving in screen space but not relative to its // target, so occlusion should happen from within the target only. EXPECT_EQ(gfx::Rect().ToString(), @@ -2966,7 +2966,7 @@ class OcclusionTrackerTestAnimationTranslateOnMainThread : occlusion.UnoccludedLayerContentRect( surface, gfx::Rect(0, 0, 300, 300))); - this->LeaveLayer(surface, occlusion); + this->LeaveLayer(surface, &occlusion); // The surface's owning layer is moving in screen space but not relative to // its target, so occlusion should happen within the target only. EXPECT_EQ(gfx::Rect().ToString(), @@ -2977,22 +2977,22 @@ class OcclusionTrackerTestAnimationTranslateOnMainThread : occlusion.UnoccludedLayerContentRect( surface, gfx::Rect(0, 0, 300, 300))); - this->EnterContributingSurface(surface, occlusion); + this->EnterContributingSurface(surface, &occlusion); // The contributing |surface| is animating so it can't be occluded. EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 300), occlusion.UnoccludedContributingSurfaceContentRect( surface, false, gfx::Rect(0, 0, 300, 300), NULL)); - this->LeaveContributingSurface(surface, occlusion); + this->LeaveContributingSurface(surface, &occlusion); - this->EnterLayer(layer, occlusion); + this->EnterLayer(layer, &occlusion); // The |surface| is moving in the screen and in its target, so all occlusion // within the surface is lost when leaving it. EXPECT_RECT_EQ(gfx::Rect(50, 0, 250, 300), occlusion.UnoccludedLayerContentRect( parent, gfx::Rect(0, 0, 300, 300))); - this->LeaveLayer(layer, occlusion); + this->LeaveLayer(layer, &occlusion); - this->EnterLayer(parent, occlusion); + this->EnterLayer(parent, &occlusion); // The |layer| is animating in the screen and in its target, so no occlusion // is added. EXPECT_RECT_EQ(gfx::Rect(50, 0, 250, 300), @@ -3033,8 +3033,8 @@ class OcclusionTrackerTestSurfaceOcclusionTranslatesToParent : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(surface2, occlusion); - this->VisitContributingSurface(surface2, occlusion); + this->VisitLayer(surface2, &occlusion); + this->VisitContributingSurface(surface2, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -3045,8 +3045,8 @@ class OcclusionTrackerTestSurfaceOcclusionTranslatesToParent : occlusion.set_occlusion_from_outside_target(Region()); occlusion.set_occlusion_from_inside_target(Region()); - this->VisitLayer(surface, occlusion); - this->VisitContributingSurface(surface, occlusion); + this->VisitLayer(surface, &occlusion); + this->VisitContributingSurface(surface, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -3081,8 +3081,8 @@ class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(surface, occlusion); - this->VisitContributingSurface(surface, occlusion); + this->VisitLayer(surface, &occlusion); + this->VisitContributingSurface(surface, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -3125,21 +3125,21 @@ class OcclusionTrackerTestReplicaOccluded : public OcclusionTrackerTest<Types> { gfx::Rect(0, 0, 1000, 1000)); // |topmost| occludes the replica, but not the surface itself. - this->VisitLayer(topmost, occlusion); + this->VisitLayer(topmost, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); EXPECT_EQ(gfx::Rect(0, 100, 100, 100).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->VisitLayer(surface, occlusion); + this->VisitLayer(surface, &occlusion); EXPECT_EQ(gfx::Rect(0, 100, 100, 100).ToString(), occlusion.occlusion_from_outside_target().ToString()); EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->EnterContributingSurface(surface, occlusion); + this->EnterContributingSurface(surface, &occlusion); // Surface is not occluded so it shouldn't think it is. EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), @@ -3182,21 +3182,21 @@ class OcclusionTrackerTestSurfaceWithReplicaUnoccluded : gfx::Rect(0, 0, 1000, 1000)); // |topmost| occludes the surface, but not the entire surface's replica. - this->VisitLayer(topmost, occlusion); + this->VisitLayer(topmost, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); EXPECT_EQ(gfx::Rect(0, 0, 100, 110).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->VisitLayer(surface, occlusion); + this->VisitLayer(surface, &occlusion); EXPECT_EQ(gfx::Rect(0, 0, 100, 110).ToString(), occlusion.occlusion_from_outside_target().ToString()); EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->EnterContributingSurface(surface, occlusion); + this->EnterContributingSurface(surface, &occlusion); // Surface is occluded, but only the top 10px of the replica. EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), @@ -3245,8 +3245,8 @@ class OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently : // These occlude the surface and replica differently, so we can test each // one. - this->VisitLayer(over_replica, occlusion); - this->VisitLayer(over_surface, occlusion); + this->VisitLayer(over_replica, &occlusion); + this->VisitLayer(over_surface, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -3254,7 +3254,7 @@ class OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently : .ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->VisitLayer(surface, occlusion); + this->VisitLayer(surface, &occlusion); EXPECT_EQ(UnionRegions(gfx::Rect(0, 0, 40, 100), gfx::Rect(0, 100, 50, 100)) .ToString(), @@ -3262,7 +3262,7 @@ class OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently : EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->EnterContributingSurface(surface, occlusion); + this->EnterContributingSurface(surface, &occlusion); // Surface and replica are occluded different amounts. EXPECT_RECT_EQ(gfx::Rect(40, 0, 60, 100), @@ -3311,14 +3311,14 @@ class OcclusionTrackerTestSurfaceChildOfSurface : // |topmost| occludes everything partially so we know occlusion is happening // at all. - this->VisitLayer(topmost, occlusion); + this->VisitLayer(topmost, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); EXPECT_EQ(gfx::Rect(0, 0, 100, 50).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->VisitLayer(surface_child, occlusion); + this->VisitLayer(surface_child, &occlusion); // surface_child increases the occlusion in the screen by a narrow sliver. EXPECT_EQ(gfx::Rect(0, -10, 100, 50).ToString(), @@ -3333,25 +3333,25 @@ class OcclusionTrackerTestSurfaceChildOfSurface : // |surface_child| exercises different code paths as its parent does not // have a clip rect. - this->EnterContributingSurface(surface_child, occlusion); + this->EnterContributingSurface(surface_child, &occlusion); // The surface_child's parent does not have a clip rect as it owns a render // surface. Make sure the unoccluded rect does not get clipped away // inappropriately. EXPECT_RECT_EQ(gfx::Rect(0, 40, 100, 10), occlusion.UnoccludedContributingSurfaceContentRect( surface_child, false, gfx::Rect(0, 0, 100, 50), NULL)); - this->LeaveContributingSurface(surface_child, occlusion); + this->LeaveContributingSurface(surface_child, &occlusion); // When the surface_child's occlusion is transformed up to its parent, make // sure it is not clipped away inappropriately also. - this->EnterLayer(surface, occlusion); + this->EnterLayer(surface, &occlusion); EXPECT_EQ(gfx::Rect(0, 0, 100, 50).ToString(), occlusion.occlusion_from_outside_target().ToString()); EXPECT_EQ(gfx::Rect(0, 10, 100, 50).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->LeaveLayer(surface, occlusion); + this->LeaveLayer(surface, &occlusion); - this->EnterContributingSurface(surface, occlusion); + this->EnterContributingSurface(surface, &occlusion); // The surface's parent does have a clip rect as it is the root layer. EXPECT_RECT_EQ(gfx::Rect(0, 50, 100, 50), occlusion.UnoccludedContributingSurfaceContentRect( @@ -3386,11 +3386,11 @@ class OcclusionTrackerTestTopmostSurfaceIsClippedToViewport : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(surface, occlusion); + this->VisitLayer(surface, &occlusion); // The root layer always has a clip rect. So the parent of |surface| has a // clip rect giving the surface itself a clip rect. - this->EnterContributingSurface(surface, occlusion); + this->EnterContributingSurface(surface, &occlusion); // Make sure the parent's clip rect clips the unoccluded region of the // child surface. EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 200), @@ -3404,11 +3404,11 @@ class OcclusionTrackerTestTopmostSurfaceIsClippedToViewport : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 100, 100)); - this->VisitLayer(surface, occlusion); + this->VisitLayer(surface, &occlusion); // The root layer always has a clip rect. So the parent of |surface| has a // clip rect giving the surface itself a clip rect. - this->EnterContributingSurface(surface, occlusion); + this->EnterContributingSurface(surface, &occlusion); // Make sure the viewport rect clips the unoccluded region of the child // surface. EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), @@ -3456,7 +3456,7 @@ class OcclusionTrackerTestSurfaceChildOfClippingSurface : // |topmost| occludes everything partially so we know occlusion is happening // at all. - this->VisitLayer(topmost, occlusion); + this->VisitLayer(topmost, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -3465,7 +3465,7 @@ class OcclusionTrackerTestSurfaceChildOfClippingSurface : // surface_child is not opaque and does not occlude, so we have a non-empty // unoccluded area on surface. - this->VisitLayer(surface_child, occlusion); + this->VisitLayer(surface_child, &occlusion); EXPECT_EQ(gfx::Rect(0, 0, 80, 50).ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -3478,17 +3478,17 @@ class OcclusionTrackerTestSurfaceChildOfClippingSurface : // |surface_child| exercises different code paths as its parent does not // have a clip rect. - this->EnterContributingSurface(surface_child, occlusion); + this->EnterContributingSurface(surface_child, &occlusion); // The surface_child's parent does not have a clip rect as it owns a render // surface. EXPECT_EQ( gfx::Rect(0, 50, 80, 50).ToString(), occlusion.UnoccludedContributingSurfaceContentRect( surface_child, false, gfx::Rect(0, 0, 100, 100), NULL).ToString()); - this->LeaveContributingSurface(surface_child, occlusion); + this->LeaveContributingSurface(surface_child, &occlusion); - this->VisitLayer(surface, occlusion); - this->EnterContributingSurface(surface, occlusion); + this->VisitLayer(surface, &occlusion); + this->EnterContributingSurface(surface, &occlusion); // The surface's parent does have a clip rect as it is the root layer. EXPECT_EQ(gfx::Rect(0, 50, 80, 50).ToString(), occlusion.UnoccludedContributingSurfaceContentRect( @@ -3571,11 +3571,11 @@ class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : // These layers occlude pixels directly beside the filtered_surface. Because // filtered surface blends pixels in a radius, it will need to see some of // the pixels (up to radius far) underneath the occluding layers. - this->VisitLayer(occluding_layer5, occlusion); - this->VisitLayer(occluding_layer4, occlusion); - this->VisitLayer(occluding_layer3, occlusion); - this->VisitLayer(occluding_layer2, occlusion); - this->VisitLayer(occluding_layer1, occlusion); + this->VisitLayer(occluding_layer5, &occlusion); + this->VisitLayer(occluding_layer4, &occlusion); + this->VisitLayer(occluding_layer3, &occlusion); + this->VisitLayer(occluding_layer2, &occlusion); + this->VisitLayer(occluding_layer1, &occlusion); Region expected_occlusion; expected_occlusion.Union(gfx::Rect(0, 0, 300, 50)); @@ -3589,7 +3589,7 @@ class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); - this->VisitLayer(filtered_surface, occlusion); + this->VisitLayer(filtered_surface, &occlusion); // The filtered layer/replica does not occlude. Region expected_occlusion_outside_surface; @@ -3608,9 +3608,9 @@ class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : // considered occluded in order to be drawn. So the pixels it needs should // be removed some the occluded area so that when we get to the parent they // are drawn. - this->VisitContributingSurface(filtered_surface, occlusion); + this->VisitContributingSurface(filtered_surface, &occlusion); - this->EnterLayer(parent, occlusion); + this->EnterLayer(parent, &occlusion); Region expected_blurred_occlusion; expected_blurred_occlusion.Union(gfx::Rect(0, 0, 300, 50 - outset_top)); @@ -3752,16 +3752,16 @@ class OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(occluding_layer_above, occlusion); + this->VisitLayer(occluding_layer_above, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); EXPECT_EQ(gfx::Rect(100 / 2, 100 / 2, 50 / 2, 50 / 2).ToString(), occlusion.occlusion_from_inside_target().ToString()); - this->VisitLayer(filtered_surface2, occlusion); - this->VisitContributingSurface(filtered_surface2, occlusion); - this->VisitLayer(filtered_surface1, occlusion); - this->VisitContributingSurface(filtered_surface1, occlusion); + this->VisitLayer(filtered_surface2, &occlusion); + this->VisitContributingSurface(filtered_surface2, &occlusion); + this->VisitLayer(filtered_surface1, &occlusion); + this->VisitContributingSurface(filtered_surface1, &occlusion); // Test expectations in the target. gfx::Rect expected_occlusion = @@ -3860,11 +3860,11 @@ class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : // These layers occlude pixels directly beside the filtered_surface. Because // filtered surface blends pixels in a radius, it will need to see some of // the pixels (up to radius far) underneath the occluding layers. - this->VisitLayer(occluding_layer5, occlusion); - this->VisitLayer(occluding_layer4, occlusion); - this->VisitLayer(occluding_layer3, occlusion); - this->VisitLayer(occluding_layer2, occlusion); - this->VisitLayer(occluding_layer1, occlusion); + this->VisitLayer(occluding_layer5, &occlusion); + this->VisitLayer(occluding_layer4, &occlusion); + this->VisitLayer(occluding_layer3, &occlusion); + this->VisitLayer(occluding_layer2, &occlusion); + this->VisitLayer(occluding_layer1, &occlusion); Region expected_occlusion; expected_occlusion.Union(gfx::Rect(0, 0, 300, 50)); @@ -3880,7 +3880,7 @@ class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : // Everything outside the surface/replica is occluded but the // surface/replica itself is not. - this->VisitLayer(filtered_surface, occlusion); + this->VisitLayer(filtered_surface, &occlusion); // The filtered layer/replica does not occlude. Region expected_occlusion_outside_surface; @@ -3899,10 +3899,10 @@ class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : // considered occluded in order to be drawn. So the pixels it needs should // be removed some the occluded area so that when we get to the parent they // are drawn. - this->VisitContributingSurface(filtered_surface, occlusion); + this->VisitContributingSurface(filtered_surface, &occlusion); - this->VisitLayer(clipping_surface, occlusion); - this->EnterContributingSurface(clipping_surface, occlusion); + this->VisitLayer(clipping_surface, &occlusion); + this->EnterContributingSurface(clipping_surface, &occlusion); Region expected_blurred_occlusion; expected_blurred_occlusion.Union(gfx::Rect(0, 0, 300, 50 - outset_top)); @@ -4065,11 +4065,11 @@ class OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter : // The surface has a background blur, so it blurs non-opaque pixels below // it. - this->VisitLayer(filtered_surface, occlusion); - this->VisitContributingSurface(filtered_surface, occlusion); + this->VisitLayer(filtered_surface, &occlusion); + this->VisitContributingSurface(filtered_surface, &occlusion); - this->VisitLayer(behind_replica_layer, occlusion); - this->VisitLayer(behind_surface_layer, occlusion); + this->VisitLayer(behind_replica_layer, &occlusion); + this->VisitLayer(behind_surface_layer, &occlusion); // The layers behind the surface are not blurred, and their occlusion does // not change, until we leave the surface. So it should not be modified by @@ -4142,10 +4142,10 @@ class OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(above_replica_layer, occlusion); - this->VisitLayer(above_surface_layer, occlusion); + this->VisitLayer(above_replica_layer, &occlusion); + this->VisitLayer(above_surface_layer, &occlusion); - this->VisitLayer(filtered_surface, occlusion); + this->VisitLayer(filtered_surface, &occlusion); { // The layers above the filtered surface occlude from outside. gfx::Rect occlusion_above_surface = gfx::Rect(0, 0, 50, 50); @@ -4161,7 +4161,7 @@ class OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : // The surface has a background blur, so it blurs non-opaque pixels below // it. - this->VisitContributingSurface(filtered_surface, occlusion); + this->VisitContributingSurface(filtered_surface, &occlusion); { // The filter is completely occluded, so it should not blur anything and // reduce any occlusion. @@ -4250,15 +4250,15 @@ class typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->VisitLayer(beside_replica_layer, occlusion); - this->VisitLayer(beside_surface_layer, occlusion); - this->VisitLayer(above_replica_layer, occlusion); - this->VisitLayer(above_surface_layer, occlusion); + this->VisitLayer(beside_replica_layer, &occlusion); + this->VisitLayer(beside_surface_layer, &occlusion); + this->VisitLayer(above_replica_layer, &occlusion); + this->VisitLayer(above_surface_layer, &occlusion); // The surface has a background blur, so it blurs non-opaque pixels below // it. - this->VisitLayer(filtered_surface, occlusion); - this->VisitContributingSurface(filtered_surface, occlusion); + this->VisitLayer(filtered_surface, &occlusion); + this->VisitContributingSurface(filtered_surface, &occlusion); // The filter in the surface and replica are partially unoccluded. Only the // unoccluded parts should reduce occlusion. This means it will push back @@ -4326,7 +4326,7 @@ class OcclusionTrackerTestMinimumTrackingSize : occlusion.set_minimum_tracking_size(tracking_size); // The small layer is not tracked because it is too small. - this->VisitLayer(small, occlusion); + this->VisitLayer(small, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -4334,7 +4334,7 @@ class OcclusionTrackerTestMinimumTrackingSize : occlusion.occlusion_from_inside_target().ToString()); // The large layer is tracked as it is large enough. - this->VisitLayer(large, occlusion); + this->VisitLayer(large, &occlusion); EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_target().ToString()); @@ -4373,7 +4373,7 @@ class OcclusionTrackerTestViewportClipIsExternalOcclusion : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 100, 100)); - this->EnterLayer(large, occlusion); + this->EnterLayer(large, &occlusion); bool has_occlusion_from_outside_target_surface = false; EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), @@ -4390,8 +4390,8 @@ class OcclusionTrackerTestViewportClipIsExternalOcclusion : &has_occlusion_from_outside_target_surface)); EXPECT_TRUE(has_occlusion_from_outside_target_surface); - this->LeaveLayer(large, occlusion); - this->VisitLayer(small, occlusion); + this->LeaveLayer(large, &occlusion); + this->VisitLayer(small, &occlusion); has_occlusion_from_outside_target_surface = false; EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), @@ -4408,7 +4408,7 @@ class OcclusionTrackerTestViewportClipIsExternalOcclusion : &has_occlusion_from_outside_target_surface)); EXPECT_TRUE(has_occlusion_from_outside_target_surface); - this->EnterContributingSurface(small, occlusion); + this->EnterContributingSurface(small, &occlusion); has_occlusion_from_outside_target_surface = false; EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), @@ -4460,7 +4460,7 @@ class OcclusionTrackerTestLayerClipIsExternalOcclusion : typename Types::RenderSurfaceType> occlusion( gfx::Rect(0, 0, 1000, 1000)); - this->EnterLayer(large, occlusion); + this->EnterLayer(large, &occlusion); // Clipping from the smaller layer is from outside the target surface. bool has_occlusion_from_outside_target_surface = false; @@ -4478,8 +4478,8 @@ class OcclusionTrackerTestLayerClipIsExternalOcclusion : &has_occlusion_from_outside_target_surface)); EXPECT_TRUE(has_occlusion_from_outside_target_surface); - this->LeaveLayer(large, occlusion); - this->VisitLayer(small, occlusion); + this->LeaveLayer(large, &occlusion); + this->VisitLayer(small, &occlusion); // Clipping from the smaller layer is from outside the target surface. has_occlusion_from_outside_target_surface = false; @@ -4497,7 +4497,7 @@ class OcclusionTrackerTestLayerClipIsExternalOcclusion : &has_occlusion_from_outside_target_surface)); EXPECT_TRUE(has_occlusion_from_outside_target_surface); - this->EnterContributingSurface(small, occlusion); + this->EnterContributingSurface(small, &occlusion); // The |small| surface is clipped from outside its target by |smallest|. has_occlusion_from_outside_target_surface = false; @@ -4509,9 +4509,9 @@ class OcclusionTrackerTestLayerClipIsExternalOcclusion : &has_occlusion_from_outside_target_surface)); EXPECT_TRUE(has_occlusion_from_outside_target_surface); - this->LeaveContributingSurface(small, occlusion); - this->VisitLayer(smaller, occlusion); - this->EnterContributingSurface(smaller, occlusion); + this->LeaveContributingSurface(small, &occlusion); + this->VisitLayer(smaller, &occlusion); + this->EnterContributingSurface(smaller, &occlusion); // The |smaller| surface is clipped from inside its target by |smallest|. has_occlusion_from_outside_target_surface = false; diff --git a/cc/trees/quad_culler_unittest.cc b/cc/trees/quad_culler_unittest.cc index 0631838..c2835d3 100644 --- a/cc/trees/quad_culler_unittest.cc +++ b/cc/trees/quad_culler_unittest.cc @@ -107,16 +107,16 @@ class QuadCullerTest : public testing::Test { } void AppendQuads(QuadList* quad_list, - SharedQuadStateList& shared_state_list, + SharedQuadStateList* shared_state_list, TiledLayerImpl* layer, - LayerIteratorType& it, - OcclusionTrackerImpl& occlusion_tracker) { - occlusion_tracker.EnterLayer(it); + LayerIteratorType* it, + OcclusionTrackerImpl* occlusion_tracker) { + occlusion_tracker->EnterLayer(*it); QuadCuller quad_culler( - quad_list, &shared_state_list, layer, occlusion_tracker, false, false); + quad_list, shared_state_list, layer, *occlusion_tracker, false, false); AppendQuadsData data; layer->AppendQuads(&quad_culler, &data); - occlusion_tracker.LeaveLayer(it); + occlusion_tracker->LeaveLayer(*it); ++it; } @@ -159,10 +159,16 @@ TEST_F(QuadCullerTest, VerifyNoCulling) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 13u); EXPECT_NEAR( occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); @@ -194,10 +200,16 @@ TEST_F(QuadCullerTest, VerifyCullChildLinesUpTopLeft) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 9u); EXPECT_NEAR( occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); @@ -229,10 +241,16 @@ TEST_F(QuadCullerTest, VerifyCullWhenChildOpacityNotOne) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 13u); EXPECT_NEAR( occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); @@ -264,10 +282,16 @@ TEST_F(QuadCullerTest, VerifyCullWhenChildOpaqueFlagFalse) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 13u); EXPECT_NEAR( occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); @@ -299,10 +323,16 @@ TEST_F(QuadCullerTest, VerifyCullCenterTileOnly) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); ASSERT_EQ(quad_list.size(), 12u); gfx::Rect quad_visible_rect1 = quad_list[5]->visible_rect; @@ -359,10 +389,16 @@ TEST_F(QuadCullerTest, VerifyCullCenterTileNonIntegralSize1) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 2u); EXPECT_NEAR( @@ -404,10 +440,16 @@ TEST_F(QuadCullerTest, VerifyCullCenterTileNonIntegralSize2) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 2u); EXPECT_NEAR( @@ -439,10 +481,16 @@ TEST_F(QuadCullerTest, VerifyCullChildLinesUpBottomRight) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 9u); EXPECT_NEAR( occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); @@ -478,10 +526,16 @@ TEST_F(QuadCullerTest, VerifyCullSubRegion) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 12u); EXPECT_NEAR( occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); @@ -518,10 +572,16 @@ TEST_F(QuadCullerTest, VerifyCullSubRegion2) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 12u); EXPECT_NEAR( occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); @@ -558,10 +618,16 @@ TEST_F(QuadCullerTest, VerifyCullSubRegionCheckOvercull) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 13u); EXPECT_NEAR( occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); @@ -596,10 +662,16 @@ TEST_F(QuadCullerTest, VerifyNonAxisAlignedQuadsDontOcclude) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 13u); EXPECT_NEAR( occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 130000, 1); @@ -639,10 +711,16 @@ TEST_F(QuadCullerTest, VerifyNonAxisAlignedQuadsSafelyCulled) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 12u); EXPECT_NEAR( occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 100600, 1); @@ -673,10 +751,16 @@ TEST_F(QuadCullerTest, VerifyCullOutsideScissorOverTile) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(200, 100, 100, 100)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 1u); EXPECT_NEAR( occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 10000, 1); @@ -707,10 +791,16 @@ TEST_F(QuadCullerTest, VerifyCullOutsideScissorOverCulledTile) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(100, 100, 100, 100)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 1u); EXPECT_NEAR( occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 10000, 1); @@ -741,10 +831,16 @@ TEST_F(QuadCullerTest, VerifyCullOutsideScissorOverPartialTiles) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(50, 50, 200, 200)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 9u); EXPECT_NEAR( occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 40000, 1); @@ -775,10 +871,16 @@ TEST_F(QuadCullerTest, VerifyCullOutsideScissorOverNoTiles) { TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(500, 500, 100, 100)); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 0u); EXPECT_NEAR( occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 0, 1); @@ -810,10 +912,16 @@ TEST_F(QuadCullerTest, VerifyWithoutMetrics) { false); LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); - AppendQuads( - &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); - AppendQuads( - &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + child_layer.get(), + &it, + &occlusion_tracker); + AppendQuads(&quad_list, + &shared_state_list, + root_layer.get(), + &it, + &occlusion_tracker); EXPECT_EQ(quad_list.size(), 9u); EXPECT_NEAR( occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 0, 1); |