diff options
54 files changed, 306 insertions, 277 deletions
diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc index 04e301e..a91c474 100644 --- a/cc/base/math_util.cc +++ b/cc/base/math_util.cc @@ -202,7 +202,7 @@ gfx::Rect MathUtil::MapEnclosedRectWith2dAxisAlignedTransform( if (transform.IsIdentityOrTranslation()) { gfx::Vector2dF offset(transform.matrix().getFloat(0, 3), transform.matrix().getFloat(1, 3)); - return gfx::ToEnclosedRect(rect + offset); + return gfx::ToEnclosedRect(gfx::RectF(rect) + offset); } SkMScalar quad[2 * 2]; // input: 2 x 2D points diff --git a/cc/layers/delegated_frame_provider.cc b/cc/layers/delegated_frame_provider.cc index bae5e43..5e016eb 100644 --- a/cc/layers/delegated_frame_provider.cc +++ b/cc/layers/delegated_frame_provider.cc @@ -33,7 +33,7 @@ void DelegatedFrameProvider::AddObserver(DelegatedRendererLayer* layer) { DCHECK(observers_[i].layer != layer); #endif - observers_.push_back(Observer(layer, gfx::RectF(frame_size_))); + observers_.push_back(Observer(layer, gfx::Rect(frame_size_))); DCHECK(frame_) << "Must have a frame when given to a DelegatedRendererLayer."; } @@ -80,15 +80,14 @@ void DelegatedFrameProvider::SetFrameData( DelegatedFrameData* DelegatedFrameProvider::GetFrameDataAndRefResources( DelegatedRendererLayer* observer, - gfx::RectF* damage) { - + gfx::Rect* damage) { bool found_observer = false; for (size_t i = 0; i < observers_.size(); ++i) { if (observers_[i].layer != observer) continue; *damage = observers_[i].damage; // The observer is now responsible for the damage. - observers_[i].damage = gfx::RectF(); + observers_[i].damage = gfx::Rect(); found_observer = true; } DCHECK(found_observer); diff --git a/cc/layers/delegated_frame_provider.h b/cc/layers/delegated_frame_provider.h index 3bcf9195..f3f9373 100644 --- a/cc/layers/delegated_frame_provider.h +++ b/cc/layers/delegated_frame_provider.h @@ -12,7 +12,7 @@ #include "cc/base/cc_export.h" #include "cc/resources/return_callback.h" #include "cc/resources/returned_resource.h" -#include "ui/gfx/geometry/rect_f.h" +#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" namespace cc { @@ -41,7 +41,7 @@ class CC_EXPORT DelegatedFrameProvider // lose track of damage. DelegatedFrameData* GetFrameDataAndRefResources( DelegatedRendererLayer* observer, - gfx::RectF* damage); + gfx::Rect* damage); ReturnCallback GetReturnResourcesCallbackForImplThread(); void UnrefResourcesOnMainThread(const ReturnedResourceArray& unused); @@ -58,9 +58,9 @@ class CC_EXPORT DelegatedFrameProvider struct Observer { DelegatedRendererLayer* layer; - gfx::RectF damage; + gfx::Rect damage; - Observer(DelegatedRendererLayer* layer, const gfx::RectF& damage) + Observer(DelegatedRendererLayer* layer, const gfx::Rect& damage) : layer(layer), damage(damage) {} }; std::vector<Observer> observers_; diff --git a/cc/layers/delegated_frame_provider_unittest.cc b/cc/layers/delegated_frame_provider_unittest.cc index 3aef0d1..4248899 100644 --- a/cc/layers/delegated_frame_provider_unittest.cc +++ b/cc/layers/delegated_frame_provider_unittest.cc @@ -159,20 +159,20 @@ TEST_F(DelegatedFrameProviderTest, RefResources) { scoped_refptr<DelegatedRendererLayer> observer2 = DelegatedRendererLayer::Create(layer_settings_, frame_provider_); - gfx::RectF damage; + gfx::Rect damage; // Both observers get a full frame of damage on the first request. frame_provider_->GetFrameDataAndRefResources(observer1.get(), &damage); - EXPECT_EQ(gfx::RectF(5.f, 5.f).ToString(), damage.ToString()); + EXPECT_EQ(gfx::Rect(5, 5), damage); frame_provider_->GetFrameDataAndRefResources(observer2.get(), &damage); - EXPECT_EQ(gfx::RectF(5.f, 5.f).ToString(), damage.ToString()); + EXPECT_EQ(gfx::Rect(5, 5), damage); // And both get no damage on the 2nd request. This adds a second ref to the // resources. frame_provider_->GetFrameDataAndRefResources(observer1.get(), &damage); - EXPECT_EQ(gfx::RectF().ToString(), damage.ToString()); + EXPECT_EQ(gfx::Rect(), damage); frame_provider_->GetFrameDataAndRefResources(observer2.get(), &damage); - EXPECT_EQ(gfx::RectF().ToString(), damage.ToString()); + EXPECT_EQ(gfx::Rect(), damage); EXPECT_FALSE(ReturnAndResetResourcesAvailable()); @@ -217,7 +217,7 @@ TEST_F(DelegatedFrameProviderTest, RefResourcesInFrameProvider) { scoped_refptr<DelegatedRendererLayer> observer2 = DelegatedRendererLayer::Create(layer_settings_, frame_provider_); - gfx::RectF damage; + gfx::Rect damage; // Take a ref on each observer. frame_provider_->GetFrameDataAndRefResources(observer1.get(), &damage); @@ -259,7 +259,7 @@ TEST_F(DelegatedFrameProviderTest, RefResourcesInFrameProviderUntilDestroy) { scoped_refptr<DelegatedRendererLayer> observer2 = DelegatedRendererLayer::Create(layer_settings_, frame_provider_); - gfx::RectF damage; + gfx::Rect damage; // Take a ref on each observer. frame_provider_->GetFrameDataAndRefResources(observer1.get(), &damage); @@ -303,19 +303,19 @@ TEST_F(DelegatedFrameProviderTest, Damage) { scoped_refptr<DelegatedRendererLayer> observer2 = DelegatedRendererLayer::Create(layer_settings_, frame_provider_); - gfx::RectF damage; + gfx::Rect damage; // Both observers get a full frame of damage on the first request. frame_provider_->GetFrameDataAndRefResources(observer1.get(), &damage); - EXPECT_EQ(gfx::RectF(5.f, 5.f).ToString(), damage.ToString()); + EXPECT_EQ(gfx::Rect(5, 5), damage); frame_provider_->GetFrameDataAndRefResources(observer2.get(), &damage); - EXPECT_EQ(gfx::RectF(5.f, 5.f).ToString(), damage.ToString()); + EXPECT_EQ(gfx::Rect(5, 5), damage); // And both get no damage on the 2nd request. frame_provider_->GetFrameDataAndRefResources(observer1.get(), &damage); - EXPECT_EQ(gfx::RectF().ToString(), damage.ToString()); + EXPECT_EQ(gfx::Rect(), damage); frame_provider_->GetFrameDataAndRefResources(observer2.get(), &damage); - EXPECT_EQ(gfx::RectF().ToString(), damage.ToString()); + EXPECT_EQ(gfx::Rect(), damage); frame = CreateFrameData(gfx::Rect(5, 5), gfx::Rect(2, 2)); AddTextureQuad(frame.get(), 555); @@ -324,15 +324,15 @@ TEST_F(DelegatedFrameProviderTest, Damage) { // Both observers get the damage for the new frame. frame_provider_->GetFrameDataAndRefResources(observer1.get(), &damage); - EXPECT_EQ(gfx::RectF(2.f, 2.f).ToString(), damage.ToString()); + EXPECT_EQ(gfx::Rect(2, 2), damage); frame_provider_->GetFrameDataAndRefResources(observer2.get(), &damage); - EXPECT_EQ(gfx::RectF(2.f, 2.f).ToString(), damage.ToString()); + EXPECT_EQ(gfx::Rect(2, 2), damage); // And both get no damage on the 2nd request. frame_provider_->GetFrameDataAndRefResources(observer1.get(), &damage); - EXPECT_EQ(gfx::RectF().ToString(), damage.ToString()); + EXPECT_EQ(gfx::Rect(), damage); frame_provider_->GetFrameDataAndRefResources(observer2.get(), &damage); - EXPECT_EQ(gfx::RectF().ToString(), damage.ToString()); + EXPECT_EQ(gfx::Rect(), damage); } TEST_F(DelegatedFrameProviderTest, LostNothing) { diff --git a/cc/layers/delegated_renderer_layer.cc b/cc/layers/delegated_renderer_layer.cc index b48d1ea..4c0e3cc 100644 --- a/cc/layers/delegated_renderer_layer.cc +++ b/cc/layers/delegated_renderer_layer.cc @@ -72,7 +72,7 @@ void DelegatedRendererLayer::PushPropertiesTo(LayerImpl* impl) { if (frame_data_) delegated_impl->SetFrameData(frame_data_, frame_damage_); frame_data_ = nullptr; - frame_damage_ = gfx::RectF(); + frame_damage_ = gfx::Rect(); } void DelegatedRendererLayer::ProviderHasNewFrame() { diff --git a/cc/layers/delegated_renderer_layer.h b/cc/layers/delegated_renderer_layer.h index 124b389..8845258 100644 --- a/cc/layers/delegated_renderer_layer.h +++ b/cc/layers/delegated_renderer_layer.h @@ -44,7 +44,7 @@ class CC_EXPORT DelegatedRendererLayer : public Layer { bool should_collect_new_frame_; DelegatedFrameData* frame_data_; - gfx::RectF frame_damage_; + gfx::Rect frame_damage_; base::WeakPtrFactory<DelegatedRendererLayer> weak_ptrs_; diff --git a/cc/layers/delegated_renderer_layer_impl.cc b/cc/layers/delegated_renderer_layer_impl.cc index 9235af5..9b3a513 100644 --- a/cc/layers/delegated_renderer_layer_impl.cc +++ b/cc/layers/delegated_renderer_layer_impl.cc @@ -87,7 +87,7 @@ void DelegatedRendererLayerImpl::CreateChildIdIfNeeded( void DelegatedRendererLayerImpl::SetFrameData( const DelegatedFrameData* frame_data, - const gfx::RectF& damage_in_frame) { + const gfx::Rect& damage_in_frame) { DCHECK(child_id_) << "CreateChildIdIfNeeded must be called first."; DCHECK(frame_data); DCHECK(!frame_data->render_pass_list.empty()); @@ -153,11 +153,10 @@ void DelegatedRendererLayerImpl::SetFrameData( // the frame, so intersect the damage to the layer's bounds. RenderPass* new_root_pass = render_pass_list.back(); gfx::Size frame_size = new_root_pass->output_rect.size(); - gfx::RectF damage_in_layer = damage_in_frame; - damage_in_layer.Scale(inverse_device_scale_factor_); + gfx::Rect damage_in_layer = + gfx::ScaleToEnclosingRect(damage_in_frame, inverse_device_scale_factor_); SetUpdateRect(gfx::IntersectRects( - gfx::UnionRects(update_rect(), gfx::ToEnclosingRect(damage_in_layer)), - gfx::Rect(bounds()))); + gfx::UnionRects(update_rect(), damage_in_layer), gfx::Rect(bounds()))); SetRenderPasses(&render_pass_list); have_render_passes_to_push_ = true; diff --git a/cc/layers/delegated_renderer_layer_impl.h b/cc/layers/delegated_renderer_layer_impl.h index 2543894..e59c3ac 100644 --- a/cc/layers/delegated_renderer_layer_impl.h +++ b/cc/layers/delegated_renderer_layer_impl.h @@ -45,7 +45,7 @@ class CC_EXPORT DelegatedRendererLayerImpl : public LayerImpl { void CreateChildIdIfNeeded(const ReturnCallback& return_callback); void SetFrameData(const DelegatedFrameData* frame_data, - const gfx::RectF& damage_in_frame); + const gfx::Rect& damage_in_frame); float inverse_device_scale_factor() const { return inverse_device_scale_factor_; diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index 71f09f0..c1509b0 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc @@ -1761,8 +1761,9 @@ void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const { MathUtil::AddToTracedValue("transform_origin", transform_origin_, state); bool clipped; - gfx::QuadF layer_quad = MathUtil::MapQuad( - screen_space_transform(), gfx::QuadF(gfx::Rect(bounds())), &clipped); + gfx::QuadF layer_quad = + MathUtil::MapQuad(screen_space_transform(), + gfx::QuadF(gfx::RectF(gfx::Rect(bounds()))), &clipped); MathUtil::AddToTracedValue("layer_quad", layer_quad, state); if (!touch_event_handler_region_.IsEmpty()) { state->BeginArray("touch_event_handler_region"); diff --git a/cc/layers/nine_patch_layer_impl_unittest.cc b/cc/layers/nine_patch_layer_impl_unittest.cc index 3535c98..ac77d12 100644 --- a/cc/layers/nine_patch_layer_impl_unittest.cc +++ b/cc/layers/nine_patch_layer_impl_unittest.cc @@ -84,7 +84,7 @@ void NinePatchLayerLayoutTest(const gfx::Size& bitmap_size, // Check if the left-over quad is the same size as the mapped aperture quad in // layer space. if (!fill_center) { - EXPECT_EQ(expected_remaining, gfx::ToEnclosedRect(remaining.bounds())); + EXPECT_EQ(expected_remaining, remaining.bounds()); } else { EXPECT_TRUE(remaining.bounds().IsEmpty()); } diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc index 41e29800..740555f 100644 --- a/cc/layers/picture_layer_impl.cc +++ b/cc/layers/picture_layer_impl.cc @@ -477,9 +477,8 @@ void PictureLayerImpl::UpdateViewportRectForTilePriorityInContentSpace() { gfx::Transform view_to_layer(gfx::Transform::kSkipInitialization); if (screen_space_transform().GetInverse(&view_to_layer)) { // Transform from view space to content space. - visible_rect_in_content_space = - gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( - view_to_layer, viewport_rect_for_tile_priority)); + visible_rect_in_content_space = MathUtil::ProjectEnclosingClippedRect( + view_to_layer, viewport_rect_for_tile_priority); // We have to allow for a viewport that is outside of the layer bounds in // order to compute tile priorities correctly for offscreen content that diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc index ad7d51d..60559ee 100644 --- a/cc/layers/picture_layer_impl_unittest.cc +++ b/cc/layers/picture_layer_impl_unittest.cc @@ -524,8 +524,8 @@ TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) { // bounds, then tile priorities will end up being incorrect in cases of fully // offscreen layer. viewport_rect_for_tile_priority_in_view_space = - gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( - screen_to_view, viewport_rect_for_tile_priority)); + MathUtil::ProjectEnclosingClippedRect(screen_to_view, + viewport_rect_for_tile_priority); EXPECT_EQ(viewport_rect_for_tile_priority_in_view_space, active_layer_->viewport_rect_for_tile_priority_in_content_space()); diff --git a/cc/layers/render_surface_impl.cc b/cc/layers/render_surface_impl.cc index 0b428dcc..c10f697 100644 --- a/cc/layers/render_surface_impl.cc +++ b/cc/layers/render_surface_impl.cc @@ -41,10 +41,10 @@ RenderSurfaceImpl::~RenderSurfaceImpl() {} gfx::RectF RenderSurfaceImpl::DrawableContentRect() const { gfx::RectF drawable_content_rect = - MathUtil::MapClippedRect(draw_transform_, content_rect_); + MathUtil::MapClippedRect(draw_transform_, gfx::RectF(content_rect_)); if (owning_layer_->has_replica()) { - drawable_content_rect.Union( - MathUtil::MapClippedRect(replica_draw_transform_, content_rect_)); + drawable_content_rect.Union(MathUtil::MapClippedRect( + replica_draw_transform_, gfx::RectF(content_rect_))); } return drawable_content_rect; diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc index 9ad1cd7..8fa66b1 100644 --- a/cc/layers/scrollbar_layer_unittest.cc +++ b/cc/layers/scrollbar_layer_unittest.cc @@ -599,9 +599,9 @@ TEST_F(ScrollbarLayerSolidColorThumbTest, SolidColorThumbVerticalAdjust) { layers[0]->SetBounds(gfx::Size(100, 3)); layers[1]->SetBounds(gfx::Size(3, 100)); - EXPECT_EQ(gfx::RectF(20.f, 0.f, 20.f, 3.f), + EXPECT_EQ(gfx::Rect(20, 0, 20, 3), horizontal_scrollbar_layer_->ComputeThumbQuadRect()); - EXPECT_EQ(gfx::RectF(0.f, 20.f, 3.f, 20.f), + EXPECT_EQ(gfx::Rect(0, 20, 3, 20), vertical_scrollbar_layer_->ComputeThumbQuadRect()); horizontal_scrollbar_layer_->SetVerticalAdjust(10.f); diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc index 7ceaa00..58facc4 100644 --- a/cc/output/direct_renderer.cc +++ b/cc/output/direct_renderer.cc @@ -17,6 +17,7 @@ #include "cc/output/bsp_walk_action.h" #include "cc/output/copy_output_request.h" #include "cc/quads/draw_quad.h" +#include "ui/gfx/geometry/quad_f.h" #include "ui/gfx/geometry/rect_conversions.h" #include "ui/gfx/transform.h" @@ -445,7 +446,7 @@ void DirectRenderer::DrawRenderPass(DrawingFrame* frame, for (auto it = quad_list.BackToFrontBegin(); it != quad_list.BackToFrontEnd(); ++it) { const DrawQuad& quad = **it; - gfx::QuadF send_quad(quad.visible_rect); + gfx::QuadF send_quad(gfx::RectF(quad.visible_rect)); if (render_pass_is_clipped && ShouldSkipQuad(quad, render_pass_scissor_in_draw_space)) { @@ -462,7 +463,7 @@ void DirectRenderer::DrawRenderPass(DrawingFrame* frame, // polygons to go into the BSP tree. if (quad.shared_quad_state->sorting_context_id != 0) { scoped_ptr<DrawPolygon> new_polygon(new DrawPolygon( - *it, quad.visible_rect, + *it, gfx::RectF(quad.visible_rect), quad.shared_quad_state->quad_to_target_transform, next_polygon_id++)); if (new_polygon->points().size() > 2u) { poly_list.push_back(new_polygon.Pass()); diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 7f3e8bf..14a48bf 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -579,7 +579,7 @@ void GLRenderer::DrawDebugBorderQuad(const DrawingFrame* frame, gfx::Transform render_matrix; QuadRectTransform(&render_matrix, quad->shared_quad_state->quad_to_target_transform, - layer_rect); + gfx::RectF(layer_rect)); GLRenderer::ToGLMatrix(&gl_matrix[0], frame->projection_matrix * render_matrix); gl_->UniformMatrix4fv(program->vertex_shader().matrix_location(), 1, false, @@ -878,7 +878,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, gfx::Transform quad_rect_matrix; QuadRectTransform(&quad_rect_matrix, quad->shared_quad_state->quad_to_target_transform, - quad->rect); + gfx::RectF(quad->rect)); gfx::Transform contents_device_transform = frame->window_matrix * frame->projection_matrix * quad_rect_matrix; contents_device_transform.FlattenTo2d(); @@ -1207,7 +1207,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, SetShaderOpacity(quad->shared_quad_state->opacity, locations.alpha); SetShaderQuadF(surface_quad, locations.quad); DrawQuadGeometry(frame, quad->shared_quad_state->quad_to_target_transform, - quad->rect, locations.matrix); + gfx::RectF(quad->rect), locations.matrix); // Flush the compositor context before the filter bitmap goes out of // scope, so the draw gets processed before the filter texture gets deleted. @@ -1296,7 +1296,7 @@ static gfx::QuadF GetDeviceQuadWithAntialiasingOnExteriorEdges( const gfx::QuadF& tile_quad, const gfx::QuadF* clip_region, const DrawQuad* quad) { - gfx::RectF tile_rect = quad->visible_rect; + gfx::RectF tile_rect = gfx::RectF(quad->visible_rect); gfx::PointF bottom_right = tile_quad.p3(); gfx::PointF bottom_left = tile_quad.p4(); @@ -1466,8 +1466,9 @@ void GLRenderer::SetupQuadForClippingAndAntialiasing( if (use_aa_on_all_four_edges) { device_quad = device_layer_edges.ToQuadF(); } else { - gfx::QuadF tile_quad(local_clip_region ? *local_clip_region - : gfx::QuadF(quad->visible_rect)); + gfx::QuadF tile_quad(local_clip_region + ? *local_clip_region + : gfx::QuadF(gfx::RectF(quad->visible_rect))); device_quad = GetDeviceQuadWithAntialiasingOnExteriorEdges( device_layer_edges, device_transform, tile_quad, local_clip_region, quad); @@ -1504,7 +1505,7 @@ void GLRenderer::SetupRenderPassQuadForClippingAndAntialiasing( // Apply anti-aliasing only to the edges that are not being clipped if (local_clip_region) { - gfx::QuadF tile_quad(quad->visible_rect); + gfx::QuadF tile_quad(gfx::RectF(quad->visible_rect)); GetScaledRegion(quad->rect, local_clip_region, &tile_quad); device_quad = GetDeviceQuadWithAntialiasingOnExteriorEdges( device_layer_edges, device_transform, tile_quad, local_clip_region, @@ -1549,7 +1550,9 @@ void GLRenderer::DrawSolidColorQuad(const DrawingFrame* frame, bool force_aa = false; device_layer_quad = MathUtil::MapQuad( device_transform, - gfx::QuadF(quad->shared_quad_state->visible_quad_layer_rect), &clipped); + gfx::QuadF( + gfx::RectF(quad->shared_quad_state->visible_quad_layer_rect)), + &clipped); use_aa = ShouldAntialiasQuad(device_layer_quad, clipped, force_aa); } @@ -1667,7 +1670,9 @@ void GLRenderer::DrawContentQuad(const DrawingFrame* frame, bool force_aa = false; device_layer_quad = MathUtil::MapQuad( device_transform, - gfx::QuadF(quad->shared_quad_state->visible_quad_layer_rect), &clipped); + gfx::QuadF( + gfx::RectF(quad->shared_quad_state->visible_quad_layer_rect)), + &clipped); use_aa = ShouldAntialiasQuad(device_layer_quad, clipped, force_aa); } @@ -1693,7 +1698,7 @@ void GLRenderer::DrawContentQuadAA(const DrawingFrame* frame, gfx::Rect tile_rect = quad->visible_rect; gfx::RectF tex_coord_rect = MathUtil::ScaleRectProportional( - quad->tex_coord_rect, quad->rect, tile_rect); + quad->tex_coord_rect, gfx::RectF(quad->rect), gfx::RectF(tile_rect)); float tex_to_geom_scale_x = quad->rect.width() / quad->tex_coord_rect.width(); float tex_to_geom_scale_y = quad->rect.height() / quad->tex_coord_rect.height(); @@ -1807,7 +1812,8 @@ void GLRenderer::DrawContentQuadNoAA(const DrawingFrame* frame, ResourceId resource_id, const gfx::QuadF* clip_region) { gfx::RectF tex_coord_rect = MathUtil::ScaleRectProportional( - quad->tex_coord_rect, quad->rect, quad->visible_rect); + quad->tex_coord_rect, gfx::RectF(quad->rect), + gfx::RectF(quad->visible_rect)); float tex_to_geom_scale_x = quad->rect.width() / quad->tex_coord_rect.width(); float tex_to_geom_scale_y = quad->rect.height() / quad->tex_coord_rect.height(); @@ -1877,37 +1883,32 @@ void GLRenderer::DrawContentQuadNoAA(const DrawingFrame* frame, // does, then vertices will match the texture mapping in the vertex buffer. // The method SetShaderQuadF() changes the order of vertices and so it's // not used here. - gfx::QuadF tile_rect(quad->visible_rect); + gfx::QuadF tile_quad(gfx::RectF(quad->visible_rect)); float width = quad->visible_rect.width(); float height = quad->visible_rect.height(); gfx::PointF top_left = quad->visible_rect.origin(); if (clip_region) { - tile_rect = *clip_region; + tile_quad = *clip_region; float gl_uv[8] = { - (tile_rect.p4().x() - top_left.x()) / width, - (tile_rect.p4().y() - top_left.y()) / height, - (tile_rect.p1().x() - top_left.x()) / width, - (tile_rect.p1().y() - top_left.y()) / height, - (tile_rect.p2().x() - top_left.x()) / width, - (tile_rect.p2().y() - top_left.y()) / height, - (tile_rect.p3().x() - top_left.x()) / width, - (tile_rect.p3().y() - top_left.y()) / height, + (tile_quad.p4().x() - top_left.x()) / width, + (tile_quad.p4().y() - top_left.y()) / height, + (tile_quad.p1().x() - top_left.x()) / width, + (tile_quad.p1().y() - top_left.y()) / height, + (tile_quad.p2().x() - top_left.x()) / width, + (tile_quad.p2().y() - top_left.y()) / height, + (tile_quad.p3().x() - top_left.x()) / width, + (tile_quad.p3().y() - top_left.y()) / height, }; PrepareGeometry(CLIPPED_BINDING); clipped_geometry_->InitializeCustomQuadWithUVs( - gfx::QuadF(quad->visible_rect), gl_uv); + gfx::QuadF(gfx::RectF(quad->visible_rect)), gl_uv); } else { PrepareGeometry(SHARED_BINDING); } float gl_quad[8] = { - tile_rect.p4().x(), - tile_rect.p4().y(), - tile_rect.p1().x(), - tile_rect.p1().y(), - tile_rect.p2().x(), - tile_rect.p2().y(), - tile_rect.p3().x(), - tile_rect.p3().y(), + tile_quad.p4().x(), tile_quad.p4().y(), tile_quad.p1().x(), + tile_quad.p1().y(), tile_quad.p2().x(), tile_quad.p2().y(), + tile_quad.p3().x(), tile_quad.p3().y(), }; gl_->Uniform2fv(uniforms.quad_location, 4, gl_quad); @@ -2114,7 +2115,7 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame, // un-antialiased quad should have and which vertex this is and the float // quad passed in via uniform is the actual geometry that gets used to draw // it. This is why this centered rect is used and not the original quad_rect. - gfx::RectF tile_rect = quad->rect; + gfx::RectF tile_rect = gfx::RectF(quad->rect); gl_->UniformMatrix3fv(yuv_matrix_location, 1, 0, yuv_to_rgb); gl_->Uniform3fv(yuv_adj_location, 1, yuv_adjust); @@ -2166,7 +2167,8 @@ void GLRenderer::DrawStreamVideoQuad(const DrawingFrame* frame, program->fragment_shader().alpha_location()); if (!clip_region) { DrawQuadGeometry(frame, quad->shared_quad_state->quad_to_target_transform, - quad->rect, program->vertex_shader().matrix_location()); + gfx::RectF(quad->rect), + program->vertex_shader().matrix_location()); } else { gfx::QuadF region_quad(*clip_region); region_quad.Scale(1.0f / quad->rect.width(), 1.0f / quad->rect.height()); @@ -2174,8 +2176,9 @@ void GLRenderer::DrawStreamVideoQuad(const DrawingFrame* frame, float uvs[8] = {0}; GetScaledUVs(quad->visible_rect, clip_region, uvs); DrawQuadGeometryClippedByQuadF( - frame, quad->shared_quad_state->quad_to_target_transform, quad->rect, - region_quad, program->vertex_shader().matrix_location(), uvs); + frame, quad->shared_quad_state->quad_to_target_transform, + gfx::RectF(quad->rect), region_quad, + program->vertex_shader().matrix_location(), uvs); } } @@ -2355,7 +2358,7 @@ void GLRenderer::EnqueueTextureQuad(const DrawingFrame* frame, gfx::Transform quad_rect_matrix; QuadRectTransform(&quad_rect_matrix, quad->shared_quad_state->quad_to_target_transform, - quad->rect); + gfx::RectF(quad->rect)); quad_rect_matrix = frame->projection_matrix * quad_rect_matrix; Float16 m; @@ -2421,13 +2424,13 @@ void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame* frame, if (!clip_region) { DrawQuadGeometry(frame, quad->shared_quad_state->quad_to_target_transform, - quad->rect, binding.matrix_location); + gfx::RectF(quad->rect), binding.matrix_location); } else { float uvs[8] = {0}; GetScaledUVs(quad->visible_rect, clip_region, uvs); DrawQuadGeometryClippedByQuadF( - frame, quad->shared_quad_state->quad_to_target_transform, quad->rect, - *clip_region, binding.matrix_location, uvs); + frame, quad->shared_quad_state->quad_to_target_transform, + gfx::RectF(quad->rect), *clip_region, binding.matrix_location, uvs); } gl_->BindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); @@ -2441,7 +2444,7 @@ void GLRenderer::FinishDrawingFrame(DrawingFrame* frame) { } current_framebuffer_lock_ = nullptr; - swap_buffer_rect_.Union(gfx::ToEnclosingRect(frame->root_damage_rect)); + swap_buffer_rect_.Union(frame->root_damage_rect); gl_->Disable(GL_BLEND); blend_shadow_ = false; diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc index d3a0191..bd6eeb9 100644 --- a/cc/output/gl_renderer_unittest.cc +++ b/cc/output/gl_renderer_unittest.cc @@ -1741,7 +1741,8 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadSkipsAAForClippingTransform) { // Verify that the test transform and test rect actually do cause the clipped // flag to trigger. Otherwise we are not testing the intended scenario. bool clipped = false; - MathUtil::MapQuad(transform_preventing_aa, gfx::QuadF(child_rect), &clipped); + MathUtil::MapQuad(transform_preventing_aa, gfx::QuadF(gfx::RectF(child_rect)), + &clipped); ASSERT_TRUE(clipped); child_pass = AddRenderPass(&render_passes_in_draw_order_, diff --git a/cc/output/overlay_candidate.h b/cc/output/overlay_candidate.h index 4ca80b3..bcad373 100644 --- a/cc/output/overlay_candidate.h +++ b/cc/output/overlay_candidate.h @@ -9,10 +9,15 @@ #include "cc/base/cc_export.h" #include "cc/resources/resource_format.h" -#include "ui/gfx/geometry/rect.h" +#include "ui/gfx/geometry/rect_f.h" +#include "ui/gfx/geometry/size.h" #include "ui/gfx/overlay_transform.h" #include "ui/gfx/transform.h" +namespace gfx { +class Rect; +} + namespace cc { class CC_EXPORT OverlayCandidate { diff --git a/cc/output/overlay_strategy_common.cc b/cc/output/overlay_strategy_common.cc index 5d79cd0..3d3bf48 100644 --- a/cc/output/overlay_strategy_common.cc +++ b/cc/output/overlay_strategy_common.cc @@ -143,7 +143,7 @@ bool OverlayStrategyCommon::GetIOSurfaceQuadInfo(const IOSurfaceDrawQuad& quad, quad_info->resource_id = quad.io_surface_resource_id(); quad_info->resource_size_in_pixels = quad.io_surface_size; quad_info->transform = overlay_transform; - quad_info->uv_rect = gfx::Rect(0, 0, 1, 1); + quad_info->uv_rect = gfx::RectF(1.f, 1.f); return true; } diff --git a/cc/output/overlay_strategy_sandwich.cc b/cc/output/overlay_strategy_sandwich.cc index bdcaf29d..5974788 100644 --- a/cc/output/overlay_strategy_sandwich.cc +++ b/cc/output/overlay_strategy_sandwich.cc @@ -4,6 +4,7 @@ #include "cc/output/overlay_strategy_sandwich.h" +#include "cc/base/math_util.h" #include "cc/base/region.h" #include "cc/output/overlay_candidate_validator.h" #include "cc/quads/draw_quad.h" @@ -15,9 +16,8 @@ namespace { gfx::Rect AlignPixelRectToDIP(float scale_factor, const gfx::Rect& pixel_rect) { gfx::Rect dip_rect = - gfx::ToEnclosingRect(gfx::ScaleRect(pixel_rect, 1.0f / scale_factor)); - gfx::Rect new_pixel_rect = - gfx::ToEnclosingRect(gfx::ScaleRect(dip_rect, scale_factor)); + gfx::ScaleToEnclosingRect(pixel_rect, 1.0f / scale_factor); + gfx::Rect new_pixel_rect = gfx::ScaleToEnclosingRect(dip_rect, scale_factor); return new_pixel_rect; } @@ -51,12 +51,12 @@ bool OverlayStrategySandwich::TryOverlay( // Compute the candidate's rect in display space (pixels on the screen). The // rect needs to be DIP-aligned, or we cannot use it. - gfx::RectF candidate_pixel_rect_float = candidate_quad->rect; - candidate_transform.TransformRect(&candidate_pixel_rect_float); - gfx::Rect candidate_pixel_rect; - candidate_pixel_rect = gfx::ToEnclosingRect(candidate_pixel_rect_float); - if (candidate_pixel_rect != candidate_pixel_rect_float) + gfx::RectF candidate_pixel_rect_float = MathUtil::MapClippedRect( + candidate_transform, gfx::RectF(candidate_quad->rect)); + if (!candidate_pixel_rect_float.IsExpressibleAsRect()) return false; + gfx::Rect candidate_pixel_rect = + gfx::ToNearestRect(candidate_pixel_rect_float); if (!IsPixelRectAlignedToDIP(device_scale_factor, candidate_pixel_rect)) return false; @@ -69,11 +69,11 @@ bool OverlayStrategySandwich::TryOverlay( continue; // Compute the quad's bounds in display space, and ensure that it is rounded // up to be DIP-aligned. - gfx::RectF pixel_covered_rect_float = overlap_iter->rect; - overlap_iter->shared_quad_state->quad_to_target_transform.TransformRect( - &pixel_covered_rect_float); - gfx::Rect pixel_covered_rect = AlignPixelRectToDIP( - device_scale_factor, gfx::ToEnclosingRect(pixel_covered_rect_float)); + gfx::Rect unaligned_pixel_covered_rect = MathUtil::MapEnclosingClippedRect( + overlap_iter->shared_quad_state->quad_to_target_transform, + overlap_iter->rect); + gfx::Rect pixel_covered_rect = + AlignPixelRectToDIP(device_scale_factor, unaligned_pixel_covered_rect); // Include the intersection of that quad with the candidate's quad in the // covered region. @@ -84,7 +84,7 @@ bool OverlayStrategySandwich::TryOverlay( // Add our primary surface. OverlayCandidateList new_candidate_list; OverlayCandidate main_image; - main_image.display_rect = pixel_bounds; + main_image.display_rect = gfx::RectF(pixel_bounds); new_candidate_list.push_back(main_image); // Add the candidate's overlay. @@ -101,8 +101,8 @@ bool OverlayStrategySandwich::TryOverlay( } for (const gfx::Rect& pixel_covered_rect : pixel_covered_rects) { OverlayCandidate main_image_on_top; - main_image_on_top.display_rect = pixel_covered_rect; - main_image_on_top.uv_rect = pixel_covered_rect; + main_image_on_top.display_rect = gfx::RectF(pixel_covered_rect); + main_image_on_top.uv_rect = gfx::RectF(pixel_covered_rect); main_image_on_top.uv_rect.Scale(1.f / pixel_bounds.width(), 1.f / pixel_bounds.height()); main_image_on_top.plane_z_order = 2; @@ -138,10 +138,8 @@ bool OverlayStrategySandwich::TryOverlay( // Cover the region with transparent quads. for (const gfx::Rect& pixel_covered_rect : pixel_covered_rects) { - gfx::RectF quad_space_covered_rect_float = pixel_covered_rect; - candidate_inverse_transform.TransformRect(&quad_space_covered_rect_float); - gfx::Rect quad_space_covered_rect = - gfx::ToEnclosingRect(quad_space_covered_rect_float); + gfx::Rect quad_space_covered_rect = MathUtil::MapEnclosingClippedRect( + candidate_inverse_transform, pixel_covered_rect); quad_space_covered_rect.Intersect(candidate_rect); SolidColorDrawQuad* transparent_quad = diff --git a/cc/output/overlay_strategy_single_on_top.cc b/cc/output/overlay_strategy_single_on_top.cc index 5670a37..4908eca 100644 --- a/cc/output/overlay_strategy_single_on_top.cc +++ b/cc/output/overlay_strategy_single_on_top.cc @@ -6,6 +6,7 @@ #include <limits> +#include "cc/base/math_util.h" #include "cc/output/overlay_candidate_validator.h" #include "cc/quads/draw_quad.h" @@ -23,15 +24,16 @@ bool OverlayStrategySingleOnTop::TryOverlay( RenderPass* root_render_pass = render_passes_in_draw_order->back(); QuadList& quad_list = root_render_pass->quad_list; const DrawQuad* draw_quad = *candidate_iterator; - gfx::RectF rect = draw_quad->rect; - draw_quad->shared_quad_state->quad_to_target_transform.TransformRect(&rect); + gfx::RectF rect = MathUtil::MapClippedRect( + draw_quad->shared_quad_state->quad_to_target_transform, + gfx::RectF(draw_quad->rect)); // Check that no prior quads overlap it. for (auto overlap_iter = quad_list.cbegin(); overlap_iter != candidate_iterator; ++overlap_iter) { - gfx::RectF overlap_rect = overlap_iter->rect; - overlap_iter->shared_quad_state->quad_to_target_transform.TransformRect( - &overlap_rect); + gfx::RectF overlap_rect = MathUtil::MapClippedRect( + overlap_iter->shared_quad_state->quad_to_target_transform, + gfx::RectF(overlap_iter->rect)); if (rect.Intersects(overlap_rect) && !OverlayStrategyCommon::IsInvisibleQuad(*overlap_iter)) return false; @@ -40,7 +42,7 @@ bool OverlayStrategySingleOnTop::TryOverlay( // Add our primary surface. OverlayCandidateList candidates; OverlayCandidate main_image; - main_image.display_rect = root_render_pass->output_rect; + main_image.display_rect = gfx::RectF(root_render_pass->output_rect); candidates.push_back(main_image); // Add the overlay. diff --git a/cc/output/overlay_strategy_underlay.cc b/cc/output/overlay_strategy_underlay.cc index 67cd77d..cb3c36d 100644 --- a/cc/output/overlay_strategy_underlay.cc +++ b/cc/output/overlay_strategy_underlay.cc @@ -25,7 +25,7 @@ bool OverlayStrategyUnderlay::TryOverlay( // Add our primary surface. OverlayCandidateList candidates; OverlayCandidate main_image; - main_image.display_rect = root_render_pass->output_rect; + main_image.display_rect = gfx::RectF(root_render_pass->output_rect); candidates.push_back(main_image); // Add the overlay. diff --git a/cc/output/overlay_unittest.cc b/cc/output/overlay_unittest.cc index 9faf823..cff70f7 100644 --- a/cc/output/overlay_unittest.cc +++ b/cc/output/overlay_unittest.cc @@ -69,7 +69,7 @@ class SingleOverlayValidator : public OverlayCandidateValidator { OverlayCandidate& candidate = surfaces->back(); if (candidate.display_rect.width() == 64) { - EXPECT_EQ(kOverlayBottomRightRect, candidate.display_rect); + EXPECT_EQ(gfx::RectF(kOverlayBottomRightRect), candidate.display_rect); } else { EXPECT_NEAR(kOverlayRect.x(), candidate.display_rect.x(), 0.01f); EXPECT_NEAR(kOverlayRect.y(), candidate.display_rect.y(), 0.01f); @@ -77,8 +77,8 @@ class SingleOverlayValidator : public OverlayCandidateValidator { EXPECT_NEAR(kOverlayRect.height(), candidate.display_rect.height(), 0.01f); } - EXPECT_EQ(BoundingRect(kUVTopLeft, kUVBottomRight).ToString(), - candidate.uv_rect.ToString()); + EXPECT_FLOAT_RECT_EQ(BoundingRect(kUVTopLeft, kUVBottomRight), + candidate.uv_rect); candidate.overlay_handled = true; } }; @@ -469,10 +469,10 @@ TEST_F(SandwichTest, SuccessfulSandwichOverlay) { EXPECT_FALSE(candidate_list[0].use_output_surface_for_resource); EXPECT_EQ(candidate_id, candidate_list[1].resource_id); - EXPECT_EQ(gfx::Rect(32, 32, 32, 32), candidate_list[1].display_rect); + EXPECT_EQ(gfx::RectF(32.f, 32.f, 32.f, 32.f), candidate_list[1].display_rect); EXPECT_TRUE(candidate_list[2].use_output_surface_for_resource); - EXPECT_EQ(gfx::Rect(32, 32, 16, 16), candidate_list[2].display_rect); - EXPECT_EQ(gfx::RectF(32. / 256, 32. / 256, 16. / 256, 16. / 256), + EXPECT_EQ(gfx::RectF(32.f, 32.f, 16.f, 16.f), candidate_list[2].display_rect); + EXPECT_EQ(gfx::RectF(32.f / 256.f, 32.f / 256.f, 16.f / 256.f, 16.f / 256.f), candidate_list[2].uv_rect); } @@ -514,10 +514,10 @@ TEST_F(SandwichTest, GrowTopOverlayForToAlignWithDIP) { EXPECT_FALSE(candidate_list[0].use_output_surface_for_resource); EXPECT_EQ(candidate_id, candidate_list[1].resource_id); - EXPECT_EQ(gfx::Rect(32, 32, 32, 32), candidate_list[1].display_rect); + EXPECT_EQ(gfx::RectF(32.f, 32.f, 32.f, 32.f), candidate_list[1].display_rect); EXPECT_TRUE(candidate_list[2].use_output_surface_for_resource); - EXPECT_EQ(gfx::Rect(32, 32, 18, 18), candidate_list[2].display_rect); - EXPECT_EQ(gfx::RectF(32. / 256, 32. / 256, 18. / 256, 18. / 256), + EXPECT_EQ(gfx::RectF(32.f, 32.f, 18.f, 18.f), candidate_list[2].display_rect); + EXPECT_EQ(gfx::RectF(32.f / 256.f, 32.f / 256.f, 18.f / 256.f, 18.f / 256.f), candidate_list[2].uv_rect); } @@ -601,7 +601,7 @@ TEST_F(SandwichTest, MultiQuadOverlay) { // Check that overlays cover the same region that the quads covered. EXPECT_FALSE(candidate_list[0].use_output_surface_for_resource); EXPECT_EQ(candidate_id, candidate_list[1].resource_id); - EXPECT_EQ(gfx::Rect(0, 0, 64, 64), candidate_list[1].display_rect); + EXPECT_EQ(gfx::RectF(64.f, 64.f), candidate_list[1].display_rect); EXPECT_TRUE(candidate_list[2].use_output_surface_for_resource); EXPECT_TRUE(candidate_list[3].use_output_surface_for_resource); Region overlay_region; diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc index 608e3a5..093801a 100644 --- a/cc/output/renderer_pixeltest.cc +++ b/cc/output/renderer_pixeltest.cc @@ -749,11 +749,11 @@ TYPED_TEST(IntersectingQuadPixelTest, TexturedQuads) { TYPED_TEST(IntersectingQuadSoftwareTest, PictureQuads) { this->SetupQuadStateAndRenderPass(); - gfx::RectF outer_rect(this->quad_rect_); - gfx::RectF inner_rect(this->quad_rect_.x() + (this->quad_rect_.width() / 4), - this->quad_rect_.y() + (this->quad_rect_.height() / 4), - this->quad_rect_.width() / 2, - this->quad_rect_.height() / 2); + gfx::Rect outer_rect(this->quad_rect_); + gfx::Rect inner_rect(this->quad_rect_.x() + (this->quad_rect_.width() / 4), + this->quad_rect_.y() + (this->quad_rect_.height() / 4), + this->quad_rect_.width() / 2, + this->quad_rect_.height() / 2); SkPaint black_paint; black_paint.setColor(SK_ColorBLACK); @@ -775,8 +775,9 @@ TYPED_TEST(IntersectingQuadSoftwareTest, PictureQuads) { this->render_pass_->template CreateAndAppendDrawQuad<PictureDrawQuad>(); blue_quad->SetNew(this->front_quad_state_, this->quad_rect_, gfx::Rect(), - this->quad_rect_, this->quad_rect_, this->quad_rect_.size(), - false, RGBA_8888, this->quad_rect_, 1.f, blue_pile); + this->quad_rect_, gfx::RectF(this->quad_rect_), + this->quad_rect_.size(), false, RGBA_8888, this->quad_rect_, + 1.f, blue_pile); scoped_ptr<FakePicturePile> green_recording = FakePicturePile::CreateFilledPile(this->quad_rect_.size(), @@ -790,7 +791,7 @@ TYPED_TEST(IntersectingQuadSoftwareTest, PictureQuads) { PictureDrawQuad* green_quad = this->render_pass_->template CreateAndAppendDrawQuad<PictureDrawQuad>(); green_quad->SetNew(this->back_quad_state_, this->quad_rect_, gfx::Rect(), - this->quad_rect_, this->quad_rect_, + this->quad_rect_, gfx::RectF(this->quad_rect_), this->quad_rect_.size(), false, RGBA_8888, this->quad_rect_, 1.f, green_pile); SCOPED_TRACE("IntersectingPictureQuadsPass"); @@ -2198,14 +2199,14 @@ TYPED_TEST(SoftwareRendererPixelTest, PictureDrawQuadIdentityScale) { scoped_refptr<FakePicturePileImpl> blue_pile = FakePicturePileImpl::CreateFromPile(blue_recording.get(), nullptr); - gfx::Transform blue_quad_to_target_transform; gfx::Vector2d offset(viewport.bottom_right() - blue_rect.bottom_right()); + gfx::Transform blue_quad_to_target_transform; blue_quad_to_target_transform.Translate(offset.x(), offset.y()); - gfx::RectF blue_scissor_rect = blue_clip_rect; - blue_quad_to_target_transform.TransformRect(&blue_scissor_rect); - SharedQuadState* blue_shared_state = CreateTestSharedQuadStateClipped( - blue_quad_to_target_transform, blue_rect, - gfx::ToEnclosingRect(blue_scissor_rect), pass.get()); + gfx::Rect blue_target_clip_rect = MathUtil::MapEnclosingClippedRect( + blue_quad_to_target_transform, blue_clip_rect); + SharedQuadState* blue_shared_state = + CreateTestSharedQuadStateClipped(blue_quad_to_target_transform, blue_rect, + blue_target_clip_rect, pass.get()); PictureDrawQuad* blue_quad = pass->CreateAndAppendDrawQuad<PictureDrawQuad>(); @@ -2468,7 +2469,7 @@ TYPED_TEST(RendererPixelTest, TileDrawQuadNearestNeighbor) { TileDrawQuad* quad = pass->CreateAndAppendDrawQuad<TileDrawQuad>(); quad->SetNew(shared_state, viewport, gfx::Rect(), viewport, resource, - gfx::Rect(tile_size), tile_size, swizzle_contents, + gfx::RectF(gfx::Rect(tile_size)), tile_size, swizzle_contents, nearest_neighbor); RenderPassList pass_list; @@ -2682,8 +2683,8 @@ TYPED_TEST(SoftwareRendererPixelTest, PictureDrawQuadNonIdentityScale) { SkPaint blue_paint; blue_paint.setColor(SK_ColorBLUE); - recording->add_draw_rect_with_paint(blue_layer_rect1, blue_paint); - recording->add_draw_rect_with_paint(blue_layer_rect2, blue_paint); + recording->add_draw_rectf_with_paint(blue_layer_rect1, blue_paint); + recording->add_draw_rectf_with_paint(blue_layer_rect2, blue_paint); recording->Rerecord(); scoped_refptr<FakePicturePileImpl> pile = FakePicturePileImpl::CreateFromPile(recording.get(), nullptr); diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc index ce4fc82..b9b46eb 100644 --- a/cc/output/software_renderer.cc +++ b/cc/output/software_renderer.cc @@ -102,8 +102,7 @@ const RendererCapabilitiesImpl& SoftwareRenderer::Capabilities() const { void SoftwareRenderer::BeginDrawingFrame(DrawingFrame* frame) { TRACE_EVENT0("cc", "SoftwareRenderer::BeginDrawingFrame"); - root_canvas_ = output_device_->BeginPaint( - gfx::ToEnclosingRect(frame->root_damage_rect)); + root_canvas_ = output_device_->BeginPaint(frame->root_damage_rect); } void SoftwareRenderer::FinishDrawingFrame(DrawingFrame* frame) { @@ -254,7 +253,7 @@ void SoftwareRenderer::DoDrawQuad(DrawingFrame* frame, gfx::Transform quad_rect_matrix; QuadRectTransform(&quad_rect_matrix, quad->shared_quad_state->quad_to_target_transform, - quad->rect); + gfx::RectF(quad->rect)); gfx::Transform contents_device_transform = frame->window_matrix * frame->projection_matrix * quad_rect_matrix; contents_device_transform.FlattenTo2d(); @@ -396,7 +395,7 @@ void SoftwareRenderer::DrawPictureQuad(const DrawingFrame* frame, void SoftwareRenderer::DrawSolidColorQuad(const DrawingFrame* frame, const SolidColorDrawQuad* quad) { gfx::RectF visible_quad_vertex_rect = MathUtil::ScaleRectProportional( - QuadVertexRect(), quad->rect, quad->visible_rect); + QuadVertexRect(), gfx::RectF(quad->rect), gfx::RectF(quad->visible_rect)); current_paint_.setColor(quad->color); current_paint_.setAlpha(quad->shared_quad_state->opacity * SkColorGetA(quad->color)); @@ -421,11 +420,11 @@ void SoftwareRenderer::DrawTextureQuad(const DrawingFrame* frame, quad->uv_bottom_right), bitmap->width(), bitmap->height()); - gfx::RectF visible_uv_rect = - MathUtil::ScaleRectProportional(uv_rect, quad->rect, quad->visible_rect); + gfx::RectF visible_uv_rect = MathUtil::ScaleRectProportional( + uv_rect, gfx::RectF(quad->rect), gfx::RectF(quad->visible_rect)); SkRect sk_uv_rect = gfx::RectFToSkRect(visible_uv_rect); gfx::RectF visible_quad_vertex_rect = MathUtil::ScaleRectProportional( - QuadVertexRect(), quad->rect, quad->visible_rect); + QuadVertexRect(), gfx::RectF(quad->rect), gfx::RectF(quad->visible_rect)); SkRect quad_rect = gfx::RectFToSkRect(visible_quad_vertex_rect); if (quad->y_flipped) @@ -478,9 +477,10 @@ void SoftwareRenderer::DrawTileQuad(const DrawingFrame* frame, DCHECK_EQ(GL_CLAMP_TO_EDGE, lock.wrap_mode()); gfx::RectF visible_tex_coord_rect = MathUtil::ScaleRectProportional( - quad->tex_coord_rect, quad->rect, quad->visible_rect); + quad->tex_coord_rect, gfx::RectF(quad->rect), + gfx::RectF(quad->visible_rect)); gfx::RectF visible_quad_vertex_rect = MathUtil::ScaleRectProportional( - QuadVertexRect(), quad->rect, quad->visible_rect); + QuadVertexRect(), gfx::RectF(quad->rect), gfx::RectF(quad->visible_rect)); SkRect uv_rect = gfx::RectFToSkRect(visible_tex_coord_rect); current_paint_.setFilterQuality( @@ -505,8 +505,9 @@ void SoftwareRenderer::DrawRenderPassQuad(const DrawingFrame* frame, SkShader::TileMode content_tile_mode = WrapModeToTileMode(lock.wrap_mode()); SkRect dest_rect = gfx::RectFToSkRect(QuadVertexRect()); - SkRect dest_visible_rect = gfx::RectFToSkRect(MathUtil::ScaleRectProportional( - QuadVertexRect(), quad->rect, quad->visible_rect)); + SkRect dest_visible_rect = gfx::RectFToSkRect( + MathUtil::ScaleRectProportional(QuadVertexRect(), gfx::RectF(quad->rect), + gfx::RectF(quad->visible_rect))); SkRect content_rect = SkRect::MakeWH(quad->rect.width(), quad->rect.height()); SkMatrix content_mat; @@ -708,7 +709,7 @@ skia::RefPtr<SkShader> SoftwareRenderer::GetBackgroundFilterShader( gfx::Transform quad_rect_matrix; QuadRectTransform(&quad_rect_matrix, quad->shared_quad_state->quad_to_target_transform, - quad->rect); + gfx::RectF(quad->rect)); gfx::Transform contents_device_transform = frame->window_matrix * frame->projection_matrix * quad_rect_matrix; contents_device_transform.FlattenTo2d(); diff --git a/cc/playback/display_item_list_unittest.cc b/cc/playback/display_item_list_unittest.cc index 89d4970..0b15bf8 100644 --- a/cc/playback/display_item_list_unittest.cc +++ b/cc/playback/display_item_list_unittest.cc @@ -421,7 +421,7 @@ TEST(DisplayItemListTest, ApproximateMemoryUsage) { SkPictureRecorder recorder; SkPaint blue_paint; blue_paint.setColor(SK_ColorBLUE); - SkCanvas* canvas = recorder.beginRecording(gfx::RectFToSkRect(layer_rect)); + SkCanvas* canvas = recorder.beginRecording(gfx::RectToSkRect(layer_rect)); for (int i = 0; i < kNumCommandsInTestSkPicture; i++) canvas->drawPaint(blue_paint); skia::RefPtr<SkPicture> picture = diff --git a/cc/playback/display_list_raster_source.cc b/cc/playback/display_list_raster_source.cc index 7a5b2ae..ee48065 100644 --- a/cc/playback/display_list_raster_source.cc +++ b/cc/playback/display_list_raster_source.cc @@ -108,7 +108,7 @@ void DisplayListRasterSource::RasterCommon( float contents_scale) const { canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y()); gfx::Rect content_rect = - gfx::ToEnclosingRect(gfx::ScaleRect(gfx::Rect(size_), contents_scale)); + gfx::ScaleToEnclosingRect(gfx::Rect(size_), contents_scale); content_rect.Intersect(canvas_playback_rect); canvas->clipRect(gfx::RectToSkRect(content_rect), SkRegion::kIntersect_Op); diff --git a/cc/playback/picture_pile_impl.cc b/cc/playback/picture_pile_impl.cc index e05a9f5..6227d83 100644 --- a/cc/playback/picture_pile_impl.cc +++ b/cc/playback/picture_pile_impl.cc @@ -210,8 +210,8 @@ void PicturePileImpl::RasterCommon(SkCanvas* canvas, DCHECK(contents_scale >= min_contents_scale_); canvas->translate(-canvas_rect.x(), -canvas_rect.y()); - gfx::Rect content_tiling_rect = gfx::ToEnclosingRect( - gfx::ScaleRect(gfx::Rect(tiling_.tiling_size()), contents_scale)); + gfx::Rect content_tiling_rect = gfx::ScaleToEnclosingRect( + gfx::Rect(tiling_.tiling_size()), contents_scale); content_tiling_rect.Intersect(canvas_rect); canvas->clipRect(gfx::RectToSkRect(content_tiling_rect), diff --git a/cc/playback/picture_pile_impl_unittest.cc b/cc/playback/picture_pile_impl_unittest.cc index a3df5c9..4ea3ba5 100644 --- a/cc/playback/picture_pile_impl_unittest.cc +++ b/cc/playback/picture_pile_impl_unittest.cc @@ -30,8 +30,7 @@ TEST(PicturePileImplTest, AnalyzeIsSolidUnscaled) { SkPaint non_solid_paint; non_solid_paint.setColor(non_solid_color); - recording_source->add_draw_rect_with_paint(gfx::Rect(0, 0, 400, 400), - solid_paint); + recording_source->add_draw_rect_with_paint(gfx::Rect(400, 400), solid_paint); recording_source->Rerecord(); scoped_refptr<FakePicturePileImpl> pile = @@ -95,8 +94,7 @@ TEST(PicturePileImplTest, AnalyzeIsSolidScaled) { SkPaint non_solid_paint; non_solid_paint.setColor(non_solid_color); - recording_source->add_draw_rect_with_paint(gfx::Rect(0, 0, 400, 400), - solid_paint); + recording_source->add_draw_rect_with_paint(gfx::Rect(400, 400), solid_paint); recording_source->Rerecord(); scoped_refptr<FakePicturePileImpl> pile = @@ -397,7 +395,7 @@ TEST_P(OverlapTest, NoOverlap) { color_paint.setXfermodeMode(SkXfermode::kPlus_Mode); // Paint outside the layer to make sure that blending works. recording_source->add_draw_rect_with_paint( - gfx::RectF(bigger_than_layer_bounds), color_paint); + gfx::Rect(bigger_than_layer_bounds), color_paint); recording_source->Rerecord(); scoped_refptr<FakePicturePileImpl> pile = diff --git a/cc/playback/raster_source_helper.cc b/cc/playback/raster_source_helper.cc index bd5edda..3655ba3 100644 --- a/cc/playback/raster_source_helper.cc +++ b/cc/playback/raster_source_helper.cc @@ -60,7 +60,7 @@ void RasterSourceHelper::PrepareForPlaybackToCanvas( // texel (since the recording won't cover it) and outside the last texel // (due to linear filtering when using this texture). gfx::Rect content_rect = - gfx::ToEnclosingRect(gfx::ScaleRect(source_rect, contents_scale)); + gfx::ScaleToEnclosingRect(source_rect, contents_scale); // The final texel of content may only be partially covered by a // rasterization; this rect represents the content rect that is fully diff --git a/cc/quads/content_draw_quad_base.h b/cc/quads/content_draw_quad_base.h index f80e06c..da8a472 100644 --- a/cc/quads/content_draw_quad_base.h +++ b/cc/quads/content_draw_quad_base.h @@ -8,9 +8,13 @@ #include "base/memory/scoped_ptr.h" #include "cc/base/cc_export.h" #include "cc/quads/draw_quad.h" -#include "ui/gfx/geometry/point.h" +#include "ui/gfx/geometry/rect_f.h" #include "ui/gfx/geometry/size.h" +namespace gfx { +class Rect; +} + namespace cc { class CC_EXPORT ContentDrawQuadBase : public DrawQuad { diff --git a/cc/quads/draw_quad.cc b/cc/quads/draw_quad.cc index 0bdcdc7..f9bf6fc 100644 --- a/cc/quads/draw_quad.cc +++ b/cc/quads/draw_quad.cc @@ -63,7 +63,7 @@ void DrawQuad::AsValueInto(base::trace_event::TracedValue* value) const { bool rect_is_clipped; gfx::QuadF rect_as_target_space_quad = MathUtil::MapQuad(shared_quad_state->quad_to_target_transform, - gfx::QuadF(rect), &rect_is_clipped); + gfx::QuadF(gfx::RectF(rect)), &rect_is_clipped); MathUtil::AddToTracedValue("rect_as_target_space_quad", rect_as_target_space_quad, value); @@ -72,9 +72,9 @@ void DrawQuad::AsValueInto(base::trace_event::TracedValue* value) const { MathUtil::AddToTracedValue("content_space_opaque_rect", opaque_rect, value); bool opaque_rect_is_clipped; - gfx::QuadF opaque_rect_as_target_space_quad = - MathUtil::MapQuad(shared_quad_state->quad_to_target_transform, - gfx::QuadF(opaque_rect), &opaque_rect_is_clipped); + gfx::QuadF opaque_rect_as_target_space_quad = MathUtil::MapQuad( + shared_quad_state->quad_to_target_transform, + gfx::QuadF(gfx::RectF(opaque_rect)), &opaque_rect_is_clipped); MathUtil::AddToTracedValue("opaque_rect_as_target_space_quad", opaque_rect_as_target_space_quad, value); @@ -83,9 +83,9 @@ void DrawQuad::AsValueInto(base::trace_event::TracedValue* value) const { MathUtil::AddToTracedValue("content_space_visible_rect", visible_rect, value); bool visible_rect_is_clipped; - gfx::QuadF visible_rect_as_target_space_quad = - MathUtil::MapQuad(shared_quad_state->quad_to_target_transform, - gfx::QuadF(visible_rect), &visible_rect_is_clipped); + gfx::QuadF visible_rect_as_target_space_quad = MathUtil::MapQuad( + shared_quad_state->quad_to_target_transform, + gfx::QuadF(gfx::RectF(visible_rect)), &visible_rect_is_clipped); MathUtil::AddToTracedValue("visible_rect_as_target_space_quad", visible_rect_as_target_space_quad, value); diff --git a/cc/quads/yuv_video_draw_quad.h b/cc/quads/yuv_video_draw_quad.h index 53ef571..3dfd85b 100644 --- a/cc/quads/yuv_video_draw_quad.h +++ b/cc/quads/yuv_video_draw_quad.h @@ -9,6 +9,8 @@ #include "base/memory/scoped_ptr.h" #include "cc/base/cc_export.h" #include "cc/quads/draw_quad.h" +#include "ui/gfx/geometry/rect_f.h" +#include "ui/gfx/geometry/size.h" namespace cc { diff --git a/cc/test/fake_content_layer_client.cc b/cc/test/fake_content_layer_client.cc index 789e21e..0cbb92a 100644 --- a/cc/test/fake_content_layer_client.cc +++ b/cc/test/fake_content_layer_client.cc @@ -49,11 +49,7 @@ void FakeContentLayerClient::PaintContents( it != draw_rects_.end(); ++it) { const gfx::RectF& draw_rect = it->first; const SkPaint& paint = it->second; - canvas->drawRectCoords(draw_rect.x(), - draw_rect.y(), - draw_rect.right(), - draw_rect.bottom(), - paint); + canvas->drawRect(gfx::RectFToSkRect(draw_rect), paint); } for (BitmapVector::const_iterator it = draw_bitmaps_.begin(); @@ -62,12 +58,12 @@ void FakeContentLayerClient::PaintContents( } if (fill_with_nonsolid_color_) { - gfx::RectF draw_rect = paint_rect; + gfx::Rect draw_rect = paint_rect; bool red = true; while (!draw_rect.IsEmpty()) { SkPaint paint; paint.setColor(red ? SK_ColorRED : SK_ColorBLUE); - canvas->drawRect(gfx::RectFToSkRect(draw_rect), paint); + canvas->drawIRect(gfx::RectToSkIRect(draw_rect), paint); draw_rect.Inset(1, 1); } } @@ -94,8 +90,7 @@ FakeContentLayerClient::PaintContentsToDisplayList( const SkPaint& paint = it->second; canvas = skia::SharePtr(recorder.beginRecording(gfx::RectFToSkRect(draw_rect))); - canvas->drawRectCoords(draw_rect.x(), draw_rect.y(), draw_rect.width(), - draw_rect.height(), paint); + canvas->drawRect(gfx::RectFToSkRect(draw_rect), paint); picture = skia::AdoptRef(recorder.endRecordingAsPicture()); auto* item = display_list->CreateAndAppendItem<DrawingDisplayItem>(); item->SetNew(picture.Pass()); @@ -119,14 +114,14 @@ FakeContentLayerClient::PaintContentsToDisplayList( } if (fill_with_nonsolid_color_) { - gfx::RectF draw_rect = clip; + gfx::Rect draw_rect = clip; bool red = true; while (!draw_rect.IsEmpty()) { SkPaint paint; paint.setColor(red ? SK_ColorRED : SK_ColorBLUE); - canvas = skia::SharePtr( - recorder.beginRecording(gfx::RectFToSkRect(draw_rect))); - canvas->drawRect(gfx::RectFToSkRect(draw_rect), paint); + canvas = + skia::SharePtr(recorder.beginRecording(gfx::RectToSkRect(draw_rect))); + canvas->drawIRect(gfx::RectToSkIRect(draw_rect), paint); picture = skia::AdoptRef(recorder.endRecordingAsPicture()); auto* item = display_list->CreateAndAppendItem<DrawingDisplayItem>(); item->SetNew(picture.Pass()); diff --git a/cc/test/fake_content_layer_client.h b/cc/test/fake_content_layer_client.h index 9615240..44160e4 100644 --- a/cc/test/fake_content_layer_client.h +++ b/cc/test/fake_content_layer_client.h @@ -13,6 +13,7 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkPaint.h" #include "ui/gfx/geometry/rect.h" +#include "ui/gfx/geometry/rect_f.h" #include "ui/gfx/transform.h" namespace cc { @@ -50,7 +51,11 @@ class FakeContentLayerClient : public ContentLayerClient { fill_with_nonsolid_color_ = nonsolid; } - void add_draw_rect(const gfx::RectF& rect, const SkPaint& paint) { + void add_draw_rect(const gfx::Rect& rect, const SkPaint& paint) { + draw_rects_.push_back(std::make_pair(gfx::RectF(rect), paint)); + } + + void add_draw_rectf(const gfx::RectF& rect, const SkPaint& paint) { draw_rects_.push_back(std::make_pair(rect, paint)); } diff --git a/cc/test/fake_delegated_renderer_layer_impl.cc b/cc/test/fake_delegated_renderer_layer_impl.cc index 458641b..9567f14 100644 --- a/cc/test/fake_delegated_renderer_layer_impl.cc +++ b/cc/test/fake_delegated_renderer_layer_impl.cc @@ -56,6 +56,6 @@ void FakeDelegatedRendererLayerImpl::SetFrameDataForRenderPasses( } CreateChildIdIfNeeded(base::Bind(&NoopReturnCallback)); - SetFrameData(delegated_frame.get(), gfx::RectF()); + SetFrameData(delegated_frame.get(), gfx::Rect()); } } // namespace cc diff --git a/cc/test/fake_display_list_recording_source.h b/cc/test/fake_display_list_recording_source.h index 9a1ce8b..d5471a4 100644 --- a/cc/test/fake_display_list_recording_source.h +++ b/cc/test/fake_display_list_recording_source.h @@ -62,14 +62,22 @@ class FakeDisplayListRecordingSource : public DisplayListRecordingSource { recorded_viewport_, 0, RECORD_NORMALLY); } - void add_draw_rect(const gfx::RectF& rect) { + void add_draw_rect(const gfx::Rect& rect) { client_.add_draw_rect(rect, default_paint_); } - void add_draw_rect_with_paint(const gfx::RectF& rect, const SkPaint& paint) { + void add_draw_rect_with_paint(const gfx::Rect& rect, const SkPaint& paint) { client_.add_draw_rect(rect, paint); } + void add_draw_rectf(const gfx::RectF& rect) { + client_.add_draw_rectf(rect, default_paint_); + } + + void add_draw_rectf_with_paint(const gfx::RectF& rect, const SkPaint& paint) { + client_.add_draw_rectf(rect, paint); + } + void add_draw_bitmap(const SkBitmap& bitmap, const gfx::Point& point) { client_.add_draw_bitmap(bitmap, point, default_paint_); } diff --git a/cc/test/fake_picture_pile.h b/cc/test/fake_picture_pile.h index 30f95a0..cc888ab 100644 --- a/cc/test/fake_picture_pile.h +++ b/cc/test/fake_picture_pile.h @@ -77,16 +77,24 @@ class FakePicturePile : public PicturePile { void SetPixelRecordDistance(int d) { pixel_record_distance_ = d; } - void add_draw_rect(const gfx::RectF& rect) { + void add_draw_rect(const gfx::Rect& rect) { client_.add_draw_rect(rect, default_paint_); } - void add_draw_bitmap(const SkBitmap& bitmap, const gfx::Point& point) { - client_.add_draw_bitmap(bitmap, point, default_paint_); + void add_draw_rect_with_paint(const gfx::Rect& rect, const SkPaint& paint) { + client_.add_draw_rect(rect, paint); } - void add_draw_rect_with_paint(const gfx::RectF& rect, const SkPaint& paint) { - client_.add_draw_rect(rect, paint); + void add_draw_rectf(const gfx::RectF& rect) { + client_.add_draw_rectf(rect, default_paint_); + } + + void add_draw_rectf_with_paint(const gfx::RectF& rect, const SkPaint& paint) { + client_.add_draw_rectf(rect, paint); + } + + void add_draw_bitmap(const SkBitmap& bitmap, const gfx::Point& point) { + add_draw_bitmap_with_paint(bitmap, point, default_paint_); } void add_draw_bitmap_with_paint(const SkBitmap& bitmap, diff --git a/cc/test/layer_test_common.cc b/cc/test/layer_test_common.cc index 3517490..7cb97cd 100644 --- a/cc/test/layer_test_common.cc +++ b/cc/test/layer_test_common.cc @@ -84,10 +84,11 @@ void LayerTestCommon::VerifyQuadsAreOccluded(const QuadList& quads, .IsPositiveScaleOrTranslation()) << quad->shared_quad_state->quad_to_target_transform.ToString(); gfx::RectF target_rectf = MathUtil::MapClippedRect( - quad->shared_quad_state->quad_to_target_transform, quad->rect); + quad->shared_quad_state->quad_to_target_transform, + gfx::RectF(quad->rect)); // Scale transforms allowed, as long as the final transformed rect // ends up on integer boundaries for ease of testing. - DCHECK_EQ(target_rectf.ToString(), gfx::RectF(target_rect).ToString()); + ASSERT_EQ(target_rectf, gfx::RectF(target_rect)); } gfx::Rect target_visible_rect = MathUtil::MapEnclosingClippedRect( quad->shared_quad_state->quad_to_target_transform, quad->visible_rect); diff --git a/cc/test/test_context_support.h b/cc/test/test_context_support.h index 10405dd..f638a0f 100644 --- a/cc/test/test_context_support.h +++ b/cc/test/test_context_support.h @@ -10,6 +10,11 @@ #include "base/memory/weak_ptr.h" #include "gpu/command_buffer/client/context_support.h" +namespace gfx { +class Rect; +class RectF; +} + namespace cc { class TestContextSupport : public gpu::ContextSupport { diff --git a/cc/tiles/picture_layer_tiling.cc b/cc/tiles/picture_layer_tiling.cc index 5bef3aa..29255d5 100644 --- a/cc/tiles/picture_layer_tiling.cc +++ b/cc/tiles/picture_layer_tiling.cc @@ -538,7 +538,7 @@ gfx::RectF PictureLayerTiling::CoverageIterator::texture_rect() const { gfx::RectF texture_rect(current_geometry_rect_); texture_rect.Scale(dest_to_content_scale_, dest_to_content_scale_); - texture_rect.Intersect(gfx::Rect(tiling_->tiling_size())); + texture_rect.Intersect(gfx::RectF(gfx::SizeF(tiling_->tiling_size()))); if (texture_rect.IsEmpty()) return texture_rect; texture_rect.Offset(-tex_origin.OffsetFromOrigin()); diff --git a/cc/tiles/picture_layer_tiling_unittest.cc b/cc/tiles/picture_layer_tiling_unittest.cc index dda369e..1c0d4d9 100644 --- a/cc/tiles/picture_layer_tiling_unittest.cc +++ b/cc/tiles/picture_layer_tiling_unittest.cc @@ -807,7 +807,7 @@ TEST(PictureLayerTilingTest, ViewportDistanceWithScale) { settings); tiling->set_resolution(HIGH_RESOLUTION); gfx::Rect viewport_in_content_space = - gfx::ToEnclosedRect(gfx::ScaleRect(viewport, 0.25f)); + gfx::ScaleToEnclosedRect(viewport, 0.25f); tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion()); auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); @@ -882,8 +882,7 @@ TEST(PictureLayerTilingTest, ViewportDistanceWithScale) { // Move the viewport down 40 pixels. viewport = gfx::Rect(0, 40, 100, 100); - viewport_in_content_space = - gfx::ToEnclosedRect(gfx::ScaleRect(viewport, 0.25f)); + viewport_in_content_space = gfx::ScaleToEnclosedRect(viewport, 0.25f); gfx::Rect skewport = tiling->ComputeSkewport(2.0, viewport_in_content_space); // Compute the soon border. diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc index 2ac9ef42..4eb48b2 100644 --- a/cc/trees/layer_tree_host_common.cc +++ b/cc/trees/layer_tree_host_common.cc @@ -417,8 +417,8 @@ void UpdateAccumulatedSurfaceState( DCHECK_IMPLIES(current_target->num_unclipped_descendants(), current_draw_transform.IsIdentityOrTranslation()); - target_rect = gfx::ToEnclosingRect( - MathUtil::MapClippedRect(current_draw_transform, target_rect)); + target_rect = + MathUtil::MapEnclosingClippedRect(current_draw_transform, target_rect); } // It is an error to not reach |render_target|. If this happens, it means that diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc index 0eaeb63..99dc89c 100644 --- a/cc/trees/layer_tree_host_common_unittest.cc +++ b/cc/trees/layer_tree_host_common_unittest.cc @@ -2307,8 +2307,8 @@ TEST_F(LayerTreeHostCommonTest, VisibleRectForPerspectiveUnprojection) { // Sanity check that un-projection does indeed cause w < 0, otherwise this // code is not testing the intended scenario. bool clipped; - gfx::RectF clipped_rect = - MathUtil::MapClippedRect(layer_to_surface_transform, layer_content_rect); + gfx::RectF clipped_rect = MathUtil::MapClippedRect( + layer_to_surface_transform, gfx::RectF(layer_content_rect)); MathUtil::ProjectQuad( Inverse(layer_to_surface_transform), gfx::QuadF(clipped_rect), &clipped); ASSERT_TRUE(clipped); @@ -2336,12 +2336,12 @@ TEST_F(LayerTreeHostCommonTest, false, true); ExecuteCalculateDrawProperties(root); - EXPECT_EQ(gfx::Rect(0, 0, 100, 100), + EXPECT_EQ(gfx::RectF(100.f, 100.f), root->render_surface()->DrawableContentRect()); // In target space, not clipped. EXPECT_EQ(gfx::Rect(60, 70, 100, 100), root->drawable_content_rect()); // In layer space, clipped. - EXPECT_EQ(gfx::Rect(0, 0, 40, 30), root->visible_layer_rect()); + EXPECT_EQ(gfx::Rect(40, 30), root->visible_layer_rect()); } TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsForSimpleLayers) { @@ -2369,9 +2369,9 @@ TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsForSimpleLayers) { ExecuteCalculateDrawProperties(root); - EXPECT_EQ(gfx::Rect(0, 0, 100, 100), + EXPECT_EQ(gfx::RectF(100.f, 100.f), root->render_surface()->DrawableContentRect()); - EXPECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawable_content_rect()); + EXPECT_EQ(gfx::Rect(100, 100), root->drawable_content_rect()); // Layers that do not draw content should have empty visible_layer_rects. EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); @@ -2418,9 +2418,9 @@ TEST_F(LayerTreeHostCommonTest, child->SetMasksToBounds(true); ExecuteCalculateDrawProperties(root); - EXPECT_EQ(gfx::Rect(0, 0, 100, 100), + EXPECT_EQ(gfx::RectF(100.f, 100.f), root->render_surface()->DrawableContentRect()); - EXPECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawable_content_rect()); + EXPECT_EQ(gfx::Rect(100, 100), root->drawable_content_rect()); // Layers that do not draw content should have empty visible content rects. EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); @@ -2501,9 +2501,9 @@ TEST_F(LayerTreeHostCommonTest, ASSERT_TRUE(render_surface->render_surface()); - EXPECT_EQ(gfx::Rect(0, 0, 100, 100), + EXPECT_EQ(gfx::RectF(100.f, 100.f), root->render_surface()->DrawableContentRect()); - EXPECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawable_content_rect()); + EXPECT_EQ(gfx::Rect(100, 100), root->drawable_content_rect()); // Layers that do not draw content should have empty visible content rects. EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); @@ -2511,7 +2511,7 @@ TEST_F(LayerTreeHostCommonTest, // An unclipped surface grows its DrawableContentRect to include all drawable // regions of the subtree. - EXPECT_EQ(gfx::Rect(5, 5, 170, 170), + EXPECT_EQ(gfx::RectF(5.f, 5.f, 170.f, 170.f), render_surface->render_surface()->DrawableContentRect()); // All layers that draw content into the unclipped surface are also unclipped. @@ -2837,9 +2837,9 @@ TEST_F(LayerTreeHostCommonTest, ASSERT_TRUE(render_surface->render_surface()); - EXPECT_EQ(gfx::Rect(0, 0, 100, 100), + EXPECT_EQ(gfx::RectF(100.f, 100.f), root->render_surface()->DrawableContentRect()); - EXPECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawable_content_rect()); + EXPECT_EQ(gfx::Rect(100, 100), root->drawable_content_rect()); // Layers that do not draw content should have empty visible content rects. EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); @@ -2847,7 +2847,7 @@ TEST_F(LayerTreeHostCommonTest, // A clipped surface grows its DrawableContentRect to include all drawable // regions of the subtree, but also gets clamped by the ancestor's clip. - EXPECT_EQ(gfx::Rect(5, 5, 95, 95), + EXPECT_EQ(gfx::RectF(5.f, 5.f, 95.f, 95.f), render_surface->render_surface()->DrawableContentRect()); // All layers that draw content into the surface have their visible content @@ -2902,9 +2902,9 @@ TEST_F(LayerTreeHostCommonTest, ASSERT_TRUE(render_surface1->render_surface()); ASSERT_TRUE(render_surface2->render_surface()); - EXPECT_EQ(gfx::Rect(0, 0, 100, 100), + EXPECT_EQ(gfx::RectF(100.f, 100.f), root->render_surface()->DrawableContentRect()); - EXPECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawable_content_rect()); + EXPECT_EQ(gfx::Rect(100, 100), root->drawable_content_rect()); // Layers that do not draw content should have empty visible content rects. EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); @@ -2913,13 +2913,13 @@ TEST_F(LayerTreeHostCommonTest, // A clipped surface grows its DrawableContentRect to include all drawable // regions of the subtree, but also gets clamped by the ancestor's clip. - EXPECT_EQ(gfx::Rect(5, 5, 95, 95), + EXPECT_EQ(gfx::RectF(5.f, 5.f, 95.f, 95.f), render_surface1->render_surface()->DrawableContentRect()); // render_surface1 lives in the "unclipped universe" of render_surface1, and // is only implicitly clipped by render_surface1's content rect. So, // render_surface2 grows to enclose all drawable content of its subtree. - EXPECT_EQ(gfx::Rect(5, 5, 170, 170), + EXPECT_EQ(gfx::RectF(5.f, 5.f, 170.f, 170.f), render_surface2->render_surface()->DrawableContentRect()); // All layers that draw content into render_surface2 think they are unclipped. @@ -2959,7 +2959,7 @@ TEST_F(LayerTreeHostCommonTest, ASSERT_TRUE(render_surface->render_surface()); - EXPECT_EQ(gfx::Rect(0, 0, 100, 100), + EXPECT_EQ(gfx::RectF(100.f, 100.f), root->render_surface()->DrawableContentRect()); EXPECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawable_content_rect()); @@ -2975,7 +2975,7 @@ TEST_F(LayerTreeHostCommonTest, 50 - diagonal_radius, diagonal_radius * 2, diagonal_radius * 2); - EXPECT_EQ(expected_surface_drawable_content, + EXPECT_EQ(gfx::RectF(expected_surface_drawable_content), render_surface->render_surface()->DrawableContentRect()); // All layers that draw content into the unclipped surface are also unclipped. @@ -3019,8 +3019,8 @@ TEST_F(LayerTreeHostCommonTest, 50 - diagonal_radius, diagonal_radius * 2, diagonal_radius * 2); - gfx::Rect expected_surface_drawable_content = - gfx::IntersectRects(unclipped_surface_content, gfx::Rect(0, 0, 50, 50)); + gfx::RectF expected_surface_drawable_content( + gfx::IntersectRects(unclipped_surface_content, gfx::Rect(50, 50))); EXPECT_EQ(expected_surface_drawable_content, render_surface->render_surface()->DrawableContentRect()); @@ -3084,15 +3084,15 @@ TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsInHighDPI) { // drawable_content_rects for all layers and surfaces are scaled by // device_scale_factor. - EXPECT_EQ(gfx::Rect(0, 0, 200, 200), + EXPECT_EQ(gfx::RectF(200.f, 200.f), root->render_surface()->DrawableContentRect()); EXPECT_EQ(gfx::Rect(0, 0, 200, 200), root->drawable_content_rect()); - EXPECT_EQ(gfx::Rect(10, 10, 190, 190), + EXPECT_EQ(gfx::RectF(10.f, 10.f, 190.f, 190.f), render_surface1->render_surface()->DrawableContentRect()); // render_surface2 lives in the "unclipped universe" of render_surface1, and // is only implicitly clipped by render_surface1. - EXPECT_EQ(gfx::Rect(10, 10, 350, 350), + EXPECT_EQ(gfx::RectF(10.f, 10.f, 350.f, 350.f), render_surface2->render_surface()->DrawableContentRect()); EXPECT_EQ(gfx::Rect(10, 10, 100, 100), child1->drawable_content_rect()); @@ -7833,7 +7833,7 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceClipsSubtree) { ClipTree clip_tree = root->layer_tree_impl()->property_trees()->clip_tree; ClipNode* clip_node = clip_tree.Node(render_surface->clip_tree_index()); EXPECT_TRUE(clip_node->data.inherit_parent_target_space_clip); - EXPECT_EQ(test_layer->visible_rect_from_property_trees(), gfx::RectF(30, 21)); + EXPECT_EQ(gfx::Rect(30, 21), test_layer->visible_rect_from_property_trees()); } TEST_F(LayerTreeHostCommonTest, TransformOfParentClipNodeAncestorOfTarget) { @@ -7868,8 +7868,8 @@ TEST_F(LayerTreeHostCommonTest, TransformOfParentClipNodeAncestorOfTarget) { ClipTree clip_tree = root->layer_tree_impl()->property_trees()->clip_tree; ClipNode* clip_node = clip_tree.Node(target_layer->clip_tree_index()); - EXPECT_EQ(clip_node->data.combined_clip, gfx::RectF(30, 30)); - EXPECT_EQ(test_layer->visible_rect_from_property_trees(), gfx::RectF(30, 30)); + EXPECT_EQ(gfx::RectF(30, 30), clip_node->data.combined_clip); + EXPECT_EQ(gfx::Rect(30, 30), test_layer->visible_rect_from_property_trees()); } TEST_F(LayerTreeHostCommonTest, @@ -7907,7 +7907,7 @@ TEST_F(LayerTreeHostCommonTest, ExecuteCalculateDrawProperties(root); - EXPECT_EQ(test_layer->clip_rect(), gfx::RectF(-4, -4, 30, 30)); + EXPECT_EQ(gfx::Rect(-4, -4, 30, 30), test_layer->clip_rect()); } } // namespace diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index e99f3cb..f9d115a 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -1378,8 +1378,8 @@ void LayerTreeHostImpl::SetExternalDrawConstraints( if (transform_for_tile_priority.GetInverse(&screen_to_view)) { // Convert from screen space to view space. viewport_rect_for_tile_priority_in_view_space = - gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( - screen_to_view, viewport_rect_for_tile_priority)); + MathUtil::ProjectEnclosingClippedRect( + screen_to_view, viewport_rect_for_tile_priority); } } @@ -2808,8 +2808,7 @@ float LayerTreeHostImpl::DeviceSpaceDistanceToLayer( gfx::Rect layer_impl_bounds(layer_impl->bounds()); gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( - layer_impl->screen_space_transform(), - layer_impl_bounds); + layer_impl->screen_space_transform(), gfx::RectF(layer_impl_bounds)); return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( device_viewport_point); diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 90ad5cf..74d0a9c 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -6123,7 +6123,7 @@ class LayerTreeHostImplTestWithDelegatingRenderer return FakeOutputSurface::CreateDelegating3d(); } - void DrawFrameAndTestDamage(const gfx::RectF& expected_damage) { + void DrawFrameAndTestDamage(const gfx::Rect& expected_damage) { bool expect_to_draw = !expected_damage.IsEmpty(); LayerTreeHostImpl::FrameData frame; @@ -6144,12 +6144,12 @@ class LayerTreeHostImplTestWithDelegatingRenderer ASSERT_EQ(2u, root_render_pass->quad_list.size()); LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0]; - gfx::RectF expected_child_visible_rect(child->bounds()); + gfx::Rect expected_child_visible_rect(child->bounds()); EXPECT_EQ(expected_child_visible_rect, root_render_pass->quad_list.front()->visible_rect); LayerImpl* root = host_impl_->active_tree()->root_layer(); - gfx::RectF expected_root_visible_rect(root->bounds()); + gfx::Rect expected_root_visible_rect(root->bounds()); EXPECT_EQ(expected_root_visible_rect, root_render_pass->quad_list.ElementAt(1)->visible_rect); } @@ -6284,7 +6284,8 @@ TEST_F(LayerTreeHostImplTest, FarAwayQuadsDontNeedAA) { bool clipped = false, force_aa = false; gfx::QuadF device_layer_quad = MathUtil::MapQuad( quad->shared_quad_state->quad_to_target_transform, - gfx::QuadF(quad->shared_quad_state->visible_quad_layer_rect), &clipped); + gfx::QuadF(gfx::RectF(quad->shared_quad_state->visible_quad_layer_rect)), + &clipped); EXPECT_FALSE(clipped); bool antialiased = GLRendererWithSetupQuadForAntialiasing::ShouldAntialiasQuad( diff --git a/cc/trees/layer_tree_host_pixeltest_synchronous.cc b/cc/trees/layer_tree_host_pixeltest_synchronous.cc index f61703f..1eb32ba 100644 --- a/cc/trees/layer_tree_host_pixeltest_synchronous.cc +++ b/cc/trees/layer_tree_host_pixeltest_synchronous.cc @@ -36,7 +36,7 @@ TEST_F(LayerTreeHostSynchronousPixelTest, OneContentLayer) { FakeContentLayerClient client; SkPaint green_paint; green_paint.setColor(SkColorSetARGB(255, 0, 255, 0)); - client.add_draw_rect(gfx::RectF(bounds), green_paint); + client.add_draw_rect(gfx::Rect(bounds), green_paint); scoped_refptr<PictureLayer> root = PictureLayer::Create(layer_settings(), &client); root->SetBounds(bounds); @@ -67,7 +67,7 @@ TEST_F(LayerTreeHostSynchronousGPUPixelTest, OneContentLayer) { FakeContentLayerClient client; SkPaint green_paint; green_paint.setColor(SkColorSetARGB(255, 0, 255, 0)); - client.add_draw_rect(gfx::RectF(bounds), green_paint); + client.add_draw_rect(gfx::Rect(bounds), green_paint); scoped_refptr<PictureLayer> root = PictureLayer::Create(layer_settings(), &client); root->SetBounds(bounds); diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 10d8e37..fd9d18b 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -735,7 +735,7 @@ class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { DrawResult draw_result) override { EXPECT_EQ(DRAW_SUCCESS, draw_result); - gfx::RectF root_damage_rect; + gfx::Rect root_damage_rect; if (!frame_data->render_passes.empty()) root_damage_rect = frame_data->render_passes.back()->damage_rect; @@ -981,7 +981,7 @@ class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { DrawResult draw_result) override { EXPECT_EQ(DRAW_SUCCESS, draw_result); - gfx::RectF root_damage_rect; + gfx::Rect root_damage_rect; if (!frame_data->render_passes.empty()) root_damage_rect = frame_data->render_passes.back()->damage_rect; @@ -1081,7 +1081,7 @@ class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest { DrawResult draw_result) override { EXPECT_EQ(DRAW_SUCCESS, draw_result); - gfx::RectF root_damage_rect; + gfx::Rect root_damage_rect; if (!frame_data->render_passes.empty()) root_damage_rect = frame_data->render_passes.back()->damage_rect; @@ -1185,7 +1185,7 @@ class LayerTreeHostTestDamageWithScale : public LayerTreeHostTest { DrawResult draw_result) override { EXPECT_EQ(DRAW_SUCCESS, draw_result); - gfx::RectF root_damage_rect; + gfx::Rect root_damage_rect; if (!frame_data->render_passes.empty()) root_damage_rect = frame_data->render_passes.back()->damage_rect; diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc index 7c766fe..717a2a6 100644 --- a/cc/trees/layer_tree_host_unittest_context.cc +++ b/cc/trees/layer_tree_host_unittest_context.cc @@ -561,7 +561,7 @@ class LayerTreeHostContextTestLostContextSucceedsWithContent // Paint non-solid color. SkPaint paint; paint.setColor(SkColorSetARGB(100, 80, 200, 200)); - client_.add_draw_rect(gfx::Rect(0, 0, 5, 5), paint); + client_.add_draw_rect(gfx::Rect(5, 5), paint); layer_ = FakePictureLayer::Create(layer_settings(), &client_); layer_->SetBounds(gfx::Size(10, 10)); @@ -639,7 +639,7 @@ class LayerTreeHostContextTestLostContextAndEvictTextures // Paint non-solid color. SkPaint paint; paint.setColor(SkColorSetARGB(100, 80, 200, 200)); - client_.add_draw_rect(gfx::Rect(0, 0, 5, 5), paint); + client_.add_draw_rect(gfx::Rect(5, 5), paint); scoped_refptr<FakePictureLayer> picture_layer = FakePictureLayer::Create(layer_settings(), &client_); diff --git a/cc/trees/layer_tree_host_unittest_damage.cc b/cc/trees/layer_tree_host_unittest_damage.cc index 32b92db..e2cccb5 100644 --- a/cc/trees/layer_tree_host_unittest_damage.cc +++ b/cc/trees/layer_tree_host_unittest_damage.cc @@ -55,17 +55,17 @@ class LayerTreeHostDamageTestSetNeedsRedraw RenderSurfaceImpl* root_surface = impl->active_tree()->root_layer()->render_surface(); - gfx::RectF root_damage = + gfx::Rect root_damage = root_surface->damage_tracker()->current_damage_rect(); switch (draw_count_) { case 0: // The first frame has full damage. - EXPECT_EQ(gfx::RectF(10.f, 10.f).ToString(), root_damage.ToString()); + EXPECT_EQ(gfx::Rect(10, 10), root_damage); break; case 1: // The second frame has full damage. - EXPECT_EQ(gfx::RectF(10.f, 10.f).ToString(), root_damage.ToString()); + EXPECT_EQ(gfx::Rect(10, 10), root_damage); EndTest(); break; case 2: @@ -117,17 +117,17 @@ class LayerTreeHostDamageTestSetViewportSize RenderSurfaceImpl* root_surface = impl->active_tree()->root_layer()->render_surface(); - gfx::RectF root_damage = + gfx::Rect root_damage = root_surface->damage_tracker()->current_damage_rect(); switch (draw_count_) { case 0: // The first frame has full damage. - EXPECT_EQ(gfx::RectF(10.f, 10.f).ToString(), root_damage.ToString()); + EXPECT_EQ(gfx::Rect(10, 10), root_damage); break; case 1: // The second frame has full damage. - EXPECT_EQ(gfx::RectF(15.f, 15.f).ToString(), root_damage.ToString()); + EXPECT_EQ(gfx::Rect(15, 15), root_damage); EndTest(); break; case 2: @@ -260,7 +260,7 @@ class LayerTreeHostDamageTestForcedFullDamage : public LayerTreeHostDamageTest { RenderSurfaceImpl* root_surface = host_impl->active_tree()->root_layer()->render_surface(); - gfx::RectF root_damage = + gfx::Rect root_damage = root_surface->damage_tracker()->current_damage_rect(); root_damage.Intersect(root_surface->content_rect()); @@ -268,13 +268,12 @@ class LayerTreeHostDamageTestForcedFullDamage : public LayerTreeHostDamageTest { switch (source_frame) { case 0: // The first frame draws and clears any damage. - EXPECT_EQ(gfx::RectF(root_surface->content_rect()).ToString(), - root_damage.ToString()); + EXPECT_EQ(root_surface->content_rect(), root_damage); EXPECT_FALSE(frame_data->has_no_damage); break; case 1: // If we get a frame without damage then we don't draw. - EXPECT_EQ(gfx::RectF().ToString(), root_damage.ToString()); + EXPECT_EQ(gfx::Rect(), root_damage); EXPECT_TRUE(frame_data->has_no_damage); // Then we set full damage for the next frame. @@ -282,8 +281,7 @@ class LayerTreeHostDamageTestForcedFullDamage : public LayerTreeHostDamageTest { break; case 2: // The whole frame should be damaged as requested. - EXPECT_EQ(gfx::RectF(root_surface->content_rect()).ToString(), - root_damage.ToString()); + EXPECT_EQ(root_surface->content_rect(), root_damage); EXPECT_FALSE(frame_data->has_no_damage); // Just a part of the next frame should be damaged. @@ -292,8 +290,7 @@ class LayerTreeHostDamageTestForcedFullDamage : public LayerTreeHostDamageTest { case 3: // The update rect in the child should be damaged and the damaged area // should match the invalidation. - EXPECT_EQ(gfx::RectF(100+10, 100+11, 12, 13).ToString(), - root_damage.ToString()); + EXPECT_EQ(gfx::Rect(100 + 10, 100 + 11, 12, 13), root_damage); EXPECT_FALSE(frame_data->has_no_damage); // If we damage part of the frame, but also damage the full @@ -303,8 +300,7 @@ class LayerTreeHostDamageTestForcedFullDamage : public LayerTreeHostDamageTest { break; case 4: // The whole frame is damaged. - EXPECT_EQ(gfx::RectF(root_surface->content_rect()).ToString(), - root_damage.ToString()); + EXPECT_EQ(root_surface->content_rect(), root_damage); EXPECT_FALSE(frame_data->has_no_damage); EndTest(); @@ -387,7 +383,7 @@ class LayerTreeHostDamageTestScrollbarDoesDamage EXPECT_EQ(DRAW_SUCCESS, draw_result); RenderSurfaceImpl* root_surface = host_impl->active_tree()->root_layer()->render_surface(); - gfx::RectF root_damage = + gfx::Rect root_damage = root_surface->damage_tracker()->current_damage_rect(); root_damage.Intersect(root_surface->content_rect()); switch (did_swaps_) { @@ -478,7 +474,7 @@ class LayerTreeHostDamageTestScrollbarCommitDoesNoDamage EXPECT_EQ(DRAW_SUCCESS, draw_result); RenderSurfaceImpl* root_surface = host_impl->active_tree()->root_layer()->render_surface(); - gfx::RectF root_damage = + gfx::Rect root_damage = root_surface->damage_tracker()->current_damage_rect(); root_damage.Intersect(root_surface->content_rect()); int frame = host_impl->active_tree()->source_frame_number(); diff --git a/cc/trees/layer_tree_host_unittest_video.cc b/cc/trees/layer_tree_host_unittest_video.cc index 31854ac..2ae61bd 100644 --- a/cc/trees/layer_tree_host_unittest_video.cc +++ b/cc/trees/layer_tree_host_unittest_video.cc @@ -49,19 +49,17 @@ class LayerTreeHostVideoTestSetNeedsDisplay DrawResult draw_result) override { LayerImpl* root_layer = host_impl->active_tree()->root_layer(); RenderSurfaceImpl* root_surface = root_layer->render_surface(); - gfx::RectF damage_rect = + gfx::Rect damage_rect = root_surface->damage_tracker()->current_damage_rect(); switch (num_draws_) { case 0: // First frame the whole viewport is damaged. - EXPECT_EQ(gfx::RectF(0.f, 0.f, 20.f, 20.f).ToString(), - damage_rect.ToString()); + EXPECT_EQ(gfx::Rect(0, 0, 20, 20), damage_rect); break; case 1: // Second frame the video layer is damaged. - EXPECT_EQ(gfx::RectF(6.f, 6.f, 8.f, 10.f).ToString(), - damage_rect.ToString()); + EXPECT_EQ(gfx::Rect(6, 6, 8, 10), damage_rect); EndTest(); break; } diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index 8fe74d0..b3e72ab 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc @@ -1245,7 +1245,7 @@ static inline bool LayerClipsSubtree(LayerType* layer) { static bool PointHitsRect( const gfx::PointF& screen_space_point, const gfx::Transform& local_space_to_screen_space_transform, - const gfx::RectF& local_space_rect, + const gfx::Rect& local_space_rect, float* distance_to_camera) { // If the transform is not invertible, then assume that this point doesn't hit // this rect. @@ -1268,7 +1268,7 @@ static bool PointHitsRect( if (clipped) return false; - if (!local_space_rect.Contains(hit_test_point_in_local_space)) + if (!gfx::RectF(local_space_rect).Contains(hit_test_point_in_local_space)) return false; if (distance_to_camera) { @@ -1344,7 +1344,7 @@ static bool PointIsClippedBySurfaceOrClipRect( static bool PointHitsLayer(const LayerImpl* layer, const gfx::PointF& screen_space_point, float* distance_to_intersection) { - gfx::RectF content_rect(layer->bounds()); + gfx::Rect content_rect(layer->bounds()); if (!PointHitsRect(screen_space_point, layer->screen_space_transform(), content_rect, diff --git a/cc/trees/property_tree.h b/cc/trees/property_tree.h index 04e5aef..0abd34b 100644 --- a/cc/trees/property_tree.h +++ b/cc/trees/property_tree.h @@ -9,7 +9,7 @@ #include "base/basictypes.h" #include "cc/base/cc_export.h" -#include "ui/gfx/geometry/rect.h" +#include "ui/gfx/geometry/rect_f.h" #include "ui/gfx/geometry/scroll_offset.h" #include "ui/gfx/transform.h" diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc index ae258ff..5795030 100644 --- a/cc/trees/property_tree_builder.cc +++ b/cc/trees/property_tree_builder.cc @@ -493,7 +493,7 @@ void BuildPropertyTreesTopLevelInternal( data_for_recursion.sequence_number = property_trees->sequence_number; ClipNode root_clip; - root_clip.data.clip = viewport; + root_clip.data.clip = gfx::RectF(viewport); root_clip.data.transform_id = kRootPropertyTreeNodeId; data_for_recursion.clip_tree_parent = data_for_recursion.clip_tree->Insert( root_clip, kUnclippedRootClipTreeNodeId); |