diff options
201 files changed, 689 insertions, 625 deletions
diff --git a/cc/base/invalidation_region.cc b/cc/base/invalidation_region.cc index 6a8f97f..5fbca8d 100644 --- a/cc/base/invalidation_region.cc +++ b/cc/base/invalidation_region.cc @@ -26,7 +26,7 @@ void InvalidationRegion::Clear() { region_.Clear(); } -void InvalidationRegion::Union(gfx::Rect rect) { +void InvalidationRegion::Union(const gfx::Rect& rect) { region_.Union(rect); SimplifyIfNeeded(); } diff --git a/cc/base/invalidation_region.h b/cc/base/invalidation_region.h index 33be803..9cb2fe3 100644 --- a/cc/base/invalidation_region.h +++ b/cc/base/invalidation_region.h @@ -21,7 +21,7 @@ class CC_EXPORT InvalidationRegion { void Swap(Region* region); void Clear(); - void Union(gfx::Rect rect); + void Union(const gfx::Rect& rect); bool IsEmpty() const { return region_.IsEmpty(); } private: diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc index 7a1bc1a..0cc120d 100644 --- a/cc/base/math_util.cc +++ b/cc/base/math_util.cc @@ -102,7 +102,7 @@ static inline void AddVertexToClippedQuad(gfx::PointF new_vertex, } gfx::Rect MathUtil::MapClippedRect(const gfx::Transform& transform, - gfx::Rect src_rect) { + const gfx::Rect& src_rect) { return gfx::ToEnclosingRect(MapClippedRect(transform, gfx::RectF(src_rect))); } @@ -521,7 +521,7 @@ scoped_ptr<base::Value> MathUtil::AsValue(gfx::SizeF s) { return res.PassAs<base::Value>(); } -scoped_ptr<base::Value> MathUtil::AsValue(gfx::Rect r) { +scoped_ptr<base::Value> MathUtil::AsValue(const gfx::Rect& r) { scoped_ptr<base::ListValue> res(new base::ListValue()); res->AppendInteger(r.x()); res->AppendInteger(r.y()); diff --git a/cc/base/math_util.h b/cc/base/math_util.h index baceb70..fd6f033 100644 --- a/cc/base/math_util.h +++ b/cc/base/math_util.h @@ -100,7 +100,7 @@ class CC_EXPORT MathUtil { // These functions return the axis-aligned rect that encloses the correctly // clipped, transformed polygon. static gfx::Rect MapClippedRect(const gfx::Transform& transform, - gfx::Rect rect); + const gfx::Rect& rect); static gfx::RectF MapClippedRect(const gfx::Transform& transform, const gfx::RectF& rect); static gfx::RectF ProjectClippedRect(const gfx::Transform& transform, @@ -167,7 +167,7 @@ class CC_EXPORT MathUtil { // Conversion to value. static scoped_ptr<base::Value> AsValue(gfx::Size s); static scoped_ptr<base::Value> AsValue(gfx::SizeF s); - static scoped_ptr<base::Value> AsValue(gfx::Rect r); + static scoped_ptr<base::Value> AsValue(const gfx::Rect& r); static bool FromValue(const base::Value*, gfx::Rect* out_rect); static scoped_ptr<base::Value> AsValue(gfx::PointF q); static scoped_ptr<base::Value> AsValue(const gfx::QuadF& q); diff --git a/cc/base/region.cc b/cc/base/region.cc index 1cda32d..4b89f99 100644 --- a/cc/base/region.cc +++ b/cc/base/region.cc @@ -14,14 +14,14 @@ Region::Region(const Region& region) : skregion_(region.skregion_) { } -Region::Region(gfx::Rect rect) +Region::Region(const gfx::Rect& rect) : skregion_(gfx::RectToSkIRect(rect)) { } Region::~Region() { } -const Region& Region::operator=(gfx::Rect rect) { +const Region& Region::operator=(const gfx::Rect& rect) { skregion_ = SkRegion(gfx::RectToSkIRect(rect)); return *this; } @@ -51,7 +51,7 @@ bool Region::Contains(gfx::Point point) const { return skregion_.contains(point.x(), point.y()); } -bool Region::Contains(gfx::Rect rect) const { +bool Region::Contains(const gfx::Rect& rect) const { if (rect.IsEmpty()) return true; return skregion_.contains(gfx::RectToSkIRect(rect)); @@ -63,7 +63,7 @@ bool Region::Contains(const Region& region) const { return skregion_.contains(region.skregion_); } -bool Region::Intersects(gfx::Rect rect) const { +bool Region::Intersects(const gfx::Rect& rect) const { return skregion_.intersects(gfx::RectToSkIRect(rect)); } @@ -71,7 +71,7 @@ bool Region::Intersects(const Region& region) const { return skregion_.intersects(region.skregion_); } -void Region::Subtract(gfx::Rect rect) { +void Region::Subtract(const gfx::Rect& rect) { skregion_.op(gfx::RectToSkIRect(rect), SkRegion::kDifference_Op); } @@ -79,7 +79,7 @@ void Region::Subtract(const Region& region) { skregion_.op(region.skregion_, SkRegion::kDifference_Op); } -void Region::Union(gfx::Rect rect) { +void Region::Union(const gfx::Rect& rect) { skregion_.op(gfx::RectToSkIRect(rect), SkRegion::kUnion_Op); } @@ -87,7 +87,7 @@ void Region::Union(const Region& region) { skregion_.op(region.skregion_, SkRegion::kUnion_Op); } -void Region::Intersect(gfx::Rect rect) { +void Region::Intersect(const gfx::Rect& rect) { skregion_.op(gfx::RectToSkIRect(rect), SkRegion::kIntersect_Op); } diff --git a/cc/base/region.h b/cc/base/region.h index 26c1d2b..f3f5cb8 100644 --- a/cc/base/region.h +++ b/cc/base/region.h @@ -24,10 +24,10 @@ class CC_EXPORT Region { public: Region(); Region(const Region& region); - Region(gfx::Rect rect); // NOLINT(runtime/explicit) + Region(const gfx::Rect& rect); // NOLINT(runtime/explicit) ~Region(); - const Region& operator=(gfx::Rect rect); + const Region& operator=(const gfx::Rect& rect); const Region& operator=(const Region& region); void Swap(Region* region); @@ -36,17 +36,17 @@ class CC_EXPORT Region { int GetRegionComplexity() const; bool Contains(gfx::Point point) const; - bool Contains(gfx::Rect rect) const; + bool Contains(const gfx::Rect& rect) const; bool Contains(const Region& region) const; - bool Intersects(gfx::Rect rect) const; + bool Intersects(const gfx::Rect& rect) const; bool Intersects(const Region& region) const; - void Subtract(gfx::Rect rect); + void Subtract(const gfx::Rect& rect); void Subtract(const Region& region); - void Union(gfx::Rect rect); + void Union(const gfx::Rect& rect); void Union(const Region& region); - void Intersect(gfx::Rect rect); + void Intersect(const gfx::Rect& rect); void Intersect(const Region& region); bool Equals(const Region& other) const { @@ -100,7 +100,7 @@ inline Region SubtractRegions(const Region& a, const Region& b) { return result; } -inline Region SubtractRegions(const Region& a, gfx::Rect b) { +inline Region SubtractRegions(const Region& a, const gfx::Rect& b) { Region result = a; result.Subtract(b); return result; @@ -112,7 +112,7 @@ inline Region IntersectRegions(const Region& a, const Region& b) { return result; } -inline Region IntersectRegions(const Region& a, gfx::Rect b) { +inline Region IntersectRegions(const Region& a, const gfx::Rect& b) { Region result = a; result.Intersect(b); return result; @@ -124,7 +124,7 @@ inline Region UnionRegions(const Region& a, const Region& b) { return result; } -inline Region UnionRegions(const Region& a, gfx::Rect b) { +inline Region UnionRegions(const Region& a, const gfx::Rect& b) { Region result = a; result.Union(b); return result; diff --git a/cc/base/tiling_data.cc b/cc/base/tiling_data.cc index 1045d89..9cdf027 100644 --- a/cc/base/tiling_data.cc +++ b/cc/base/tiling_data.cc @@ -272,7 +272,8 @@ TilingData::BaseIterator::BaseIterator(const TilingData* tiling_data) index_y_(-1) { } -TilingData::Iterator::Iterator(const TilingData* tiling_data, gfx::Rect rect) +TilingData::Iterator::Iterator(const TilingData* tiling_data, + const gfx::Rect& tiling_rect) : BaseIterator(tiling_data), left_(-1), right_(-1), @@ -282,6 +283,7 @@ TilingData::Iterator::Iterator(const TilingData* tiling_data, gfx::Rect rect) return; } + gfx::Rect rect(tiling_rect); rect.Intersect(gfx::Rect(tiling_data_->total_size())); index_x_ = tiling_data_->FirstBorderTileXIndexFromSrcCoord(rect.x()); index_y_ = tiling_data_->FirstBorderTileYIndexFromSrcCoord(rect.y()); @@ -313,8 +315,8 @@ TilingData::Iterator& TilingData::Iterator::operator++() { TilingData::DifferenceIterator::DifferenceIterator( const TilingData* tiling_data, - gfx::Rect consider, - gfx::Rect ignore) + const gfx::Rect& consider_rect, + const gfx::Rect& ignore_rect) : BaseIterator(tiling_data), consider_left_(-1), consider_top_(-1), @@ -330,6 +332,8 @@ TilingData::DifferenceIterator::DifferenceIterator( } gfx::Rect bounds(tiling_data_->total_size()); + gfx::Rect consider(consider_rect); + gfx::Rect ignore(ignore_rect); consider.Intersect(bounds); ignore.Intersect(bounds); if (consider.IsEmpty()) { diff --git a/cc/base/tiling_data.h b/cc/base/tiling_data.h index 3bf9809..96e6ae0 100644 --- a/cc/base/tiling_data.h +++ b/cc/base/tiling_data.h @@ -89,7 +89,7 @@ class CC_EXPORT TilingData { // Iterate through all indices whose bounds + border intersect with |rect|. class CC_EXPORT Iterator : public BaseIterator { public: - Iterator(const TilingData* tiling_data, gfx::Rect rect); + Iterator(const TilingData* tiling_data, const gfx::Rect& tiling_rect); Iterator& operator++(); private: @@ -104,8 +104,8 @@ class CC_EXPORT TilingData { public: DifferenceIterator( const TilingData* tiling_data, - gfx::Rect consider, - gfx::Rect ignore); + const gfx::Rect& consider_rect, + const gfx::Rect& ignore_rect); DifferenceIterator& operator++(); private: diff --git a/cc/debug/debug_rect_history.h b/cc/debug/debug_rect_history.h index 0dae431..33b74a2 100644 --- a/cc/debug/debug_rect_history.h +++ b/cc/debug/debug_rect_history.h @@ -57,7 +57,7 @@ enum DebugRectType { }; struct DebugRect { - DebugRect(DebugRectType new_type, gfx::RectF new_rect) + DebugRect(DebugRectType new_type, const gfx::RectF& new_rect) : type(new_type), rect(new_rect) {} DebugRectType type; diff --git a/cc/debug/overdraw_metrics.cc b/cc/debug/overdraw_metrics.cc index a14284d..f707db0 100644 --- a/cc/debug/overdraw_metrics.cc +++ b/cc/debug/overdraw_metrics.cc @@ -55,7 +55,7 @@ static inline float AreaOfMappedQuad(const gfx::Transform& transform, return PolygonArea(clipped_quad, num_vertices_in_clipped_quad); } -void OverdrawMetrics::DidPaint(gfx::Rect painted_rect) { +void OverdrawMetrics::DidPaint(const gfx::Rect& painted_rect) { if (!record_metrics_for_frame_) return; @@ -69,8 +69,8 @@ void OverdrawMetrics::DidCullTilesForUpload(int count) { } void OverdrawMetrics::DidUpload(const gfx::Transform& transform_to_target, - gfx::Rect upload_rect, - gfx::Rect opaque_rect) { + const gfx::Rect& upload_rect, + const gfx::Rect& opaque_rect) { if (!record_metrics_for_frame_) return; @@ -103,8 +103,8 @@ void OverdrawMetrics::DidUseRenderSurfaceTextureMemoryBytes( void OverdrawMetrics::DidCullForDrawing( const gfx::Transform& transform_to_target, - gfx::Rect before_cull_rect, - gfx::Rect after_cull_rect) { + const gfx::Rect& before_cull_rect, + const gfx::Rect& after_cull_rect) { if (!record_metrics_for_frame_) return; @@ -117,8 +117,8 @@ void OverdrawMetrics::DidCullForDrawing( } void OverdrawMetrics::DidDraw(const gfx::Transform& transform_to_target, - gfx::Rect after_cull_rect, - gfx::Rect opaque_rect) { + const gfx::Rect& after_cull_rect, + const gfx::Rect& opaque_rect) { if (!record_metrics_for_frame_) return; diff --git a/cc/debug/overdraw_metrics.h b/cc/debug/overdraw_metrics.h index 43bd19ba..c53b2aa 100644 --- a/cc/debug/overdraw_metrics.h +++ b/cc/debug/overdraw_metrics.h @@ -27,15 +27,15 @@ class OverdrawMetrics { // Record pixels painted by WebKit into the texture updater, but does not mean // the pixels were rasterized in main memory. - void DidPaint(gfx::Rect painted_rect); + void DidPaint(const gfx::Rect& painted_rect); // Records that an invalid tile was culled and did not need to be // painted/uploaded, and did not contribute to other tiles needing to be // painted. void DidCullTilesForUpload(int count); // Records pixels that were uploaded to texture memory. void DidUpload(const gfx::Transform& transform_to_target, - gfx::Rect upload_rect, - gfx::Rect opaque_rect); + const gfx::Rect& upload_rect, + const gfx::Rect& opaque_rect); // Record contents texture(s) behind present using the given number of bytes. void DidUseContentsTextureMemoryBytes(size_t contents_texture_use_bytes); // Record RenderSurfaceImpl texture(s) being present using the given number of @@ -46,12 +46,12 @@ class OverdrawMetrics { // Record pixels that were not drawn to screen. void DidCullForDrawing(const gfx::Transform& transform_to_target, - gfx::Rect before_cull_rect, - gfx::Rect after_cull_rect); + const gfx::Rect& before_cull_rect, + const gfx::Rect& after_cull_rect); // Record pixels that were drawn to screen. void DidDraw(const gfx::Transform& transform_to_target, - gfx::Rect after_cull_rect, - gfx::Rect opaque_rect); + const gfx::Rect& after_cull_rect, + const gfx::Rect& opaque_rect); void RecordMetrics(const LayerTreeHost* layer_tree_host) const; void RecordMetrics(const LayerTreeHostImpl* layer_tree_host_impl) const; diff --git a/cc/input/scrollbar.h b/cc/input/scrollbar.h index bfefd43..8321ae2 100644 --- a/cc/input/scrollbar.h +++ b/cc/input/scrollbar.h @@ -33,7 +33,7 @@ class Scrollbar { virtual gfx::Rect TrackRect() const = 0; virtual void PaintPart(SkCanvas* canvas, ScrollbarPart part, - gfx::Rect content_rect) = 0; + const gfx::Rect& content_rect) = 0; }; } // namespace cc diff --git a/cc/layers/content_layer.cc b/cc/layers/content_layer.cc index 24cb8b3..8585977 100644 --- a/cc/layers/content_layer.cc +++ b/cc/layers/content_layer.cc @@ -24,7 +24,7 @@ scoped_ptr<ContentLayerPainter> ContentLayerPainter::Create( } void ContentLayerPainter::Paint(SkCanvas* canvas, - gfx::Rect content_rect, + const gfx::Rect& content_rect, gfx::RectF* opaque) { base::TimeTicks paint_start = base::TimeTicks::HighResNow(); client_->PaintContents(canvas, content_rect, opaque); diff --git a/cc/layers/content_layer.h b/cc/layers/content_layer.h index 45de86c..783e094 100644 --- a/cc/layers/content_layer.h +++ b/cc/layers/content_layer.h @@ -22,7 +22,7 @@ class CC_EXPORT ContentLayerPainter : public LayerPainter { static scoped_ptr<ContentLayerPainter> Create(ContentLayerClient* client); virtual void Paint(SkCanvas* canvas, - gfx::Rect content_rect, + const gfx::Rect& content_rect, gfx::RectF* opaque) OVERRIDE; private: diff --git a/cc/layers/content_layer_client.h b/cc/layers/content_layer_client.h index e59c1d8..eac1a87 100644 --- a/cc/layers/content_layer_client.h +++ b/cc/layers/content_layer_client.h @@ -19,7 +19,7 @@ namespace cc { class CC_EXPORT ContentLayerClient { public: virtual void PaintContents(SkCanvas* canvas, - gfx::Rect clip, + const gfx::Rect& clip, gfx::RectF* opaque) = 0; // Called by the content layer during the update phase. diff --git a/cc/layers/content_layer_unittest.cc b/cc/layers/content_layer_unittest.cc index 7248458..17cf11b 100644 --- a/cc/layers/content_layer_unittest.cc +++ b/cc/layers/content_layer_unittest.cc @@ -17,11 +17,11 @@ namespace { class MockContentLayerClient : public ContentLayerClient { public: - explicit MockContentLayerClient(gfx::Rect opaque_layer_rect) + explicit MockContentLayerClient(const gfx::Rect& opaque_layer_rect) : opaque_layer_rect_(opaque_layer_rect) {} virtual void PaintContents(SkCanvas* canvas, - gfx::Rect clip, + const gfx::Rect& clip, gfx::RectF* opaque) OVERRIDE { *opaque = gfx::RectF(opaque_layer_rect_); } diff --git a/cc/layers/delegated_frame_provider_unittest.cc b/cc/layers/delegated_frame_provider_unittest.cc index 20b355c..2a4f564 100644 --- a/cc/layers/delegated_frame_provider_unittest.cc +++ b/cc/layers/delegated_frame_provider_unittest.cc @@ -20,8 +20,9 @@ class DelegatedFrameProviderTest protected: DelegatedFrameProviderTest() : resources_available_(false) {} - scoped_ptr<DelegatedFrameData> CreateFrameData(gfx::Rect root_output_rect, - gfx::Rect root_damage_rect) { + scoped_ptr<DelegatedFrameData> CreateFrameData( + const gfx::Rect& root_output_rect, + const gfx::Rect& root_damage_rect) { scoped_ptr<DelegatedFrameData> frame(new DelegatedFrameData); scoped_ptr<RenderPass> root_pass(RenderPass::Create()); diff --git a/cc/layers/delegated_renderer_layer_impl.cc b/cc/layers/delegated_renderer_layer_impl.cc index b2019c3..4b9d90f 100644 --- a/cc/layers/delegated_renderer_layer_impl.cc +++ b/cc/layers/delegated_renderer_layer_impl.cc @@ -100,7 +100,7 @@ void DelegatedRendererLayerImpl::CreateChildIdIfNeeded( void DelegatedRendererLayerImpl::SetFrameData( const DelegatedFrameData* frame_data, - gfx::RectF damage_in_frame) { + const gfx::RectF& damage_in_frame) { DCHECK(child_id_) << "CreateChildIdIfNeeded must be called first."; DCHECK(frame_data); DCHECK(!frame_data->render_pass_list.empty()); diff --git a/cc/layers/delegated_renderer_layer_impl.h b/cc/layers/delegated_renderer_layer_impl.h index 358b7b9..a25b160 100644 --- a/cc/layers/delegated_renderer_layer_impl.h +++ b/cc/layers/delegated_renderer_layer_impl.h @@ -46,7 +46,7 @@ class CC_EXPORT DelegatedRendererLayerImpl : public LayerImpl { void CreateChildIdIfNeeded(const ReturnCallback& return_callback); void SetFrameData(const DelegatedFrameData* frame_data, - gfx::RectF damage_in_frame); + const gfx::RectF& damage_in_frame); void SetDisplaySize(gfx::Size size); diff --git a/cc/layers/layer_perftest.cc b/cc/layers/layer_perftest.cc index 5a2de60..32e99fe 100644 --- a/cc/layers/layer_perftest.cc +++ b/cc/layers/layer_perftest.cc @@ -24,7 +24,7 @@ static const int kTimeCheckInterval = 10; class MockLayerPainter : public LayerPainter { public: virtual void Paint(SkCanvas* canvas, - gfx::Rect content_rect, + const gfx::Rect& content_rect, gfx::RectF* opaque) OVERRIDE {} }; diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc index a77a5fb..55f5616 100644 --- a/cc/layers/layer_unittest.cc +++ b/cc/layers/layer_unittest.cc @@ -51,7 +51,7 @@ class MockLayerTreeHost : public LayerTreeHost { class MockLayerPainter : public LayerPainter { public: virtual void Paint(SkCanvas* canvas, - gfx::Rect content_rect, + const gfx::Rect& content_rect, gfx::RectF* opaque) OVERRIDE {} }; diff --git a/cc/layers/nine_patch_layer.cc b/cc/layers/nine_patch_layer.cc index f676131..e63b000 100644 --- a/cc/layers/nine_patch_layer.cc +++ b/cc/layers/nine_patch_layer.cc @@ -27,14 +27,14 @@ scoped_ptr<LayerImpl> NinePatchLayer::CreateLayerImpl( return NinePatchLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); } -void NinePatchLayer::SetBorder(gfx::Rect border) { +void NinePatchLayer::SetBorder(const gfx::Rect& border) { if (border == border_) return; border_ = border; SetNeedsCommit(); } -void NinePatchLayer::SetAperture(gfx::Rect aperture) { +void NinePatchLayer::SetAperture(const gfx::Rect& aperture) { if (image_aperture_ == aperture) return; diff --git a/cc/layers/nine_patch_layer.h b/cc/layers/nine_patch_layer.h index dc9f81f..61d3e01 100644 --- a/cc/layers/nine_patch_layer.h +++ b/cc/layers/nine_patch_layer.h @@ -28,7 +28,7 @@ class CC_EXPORT NinePatchLayer : public UIResourceLayer { // size of the left and top boundary, respectively. // |border.width()-border.x()| and |border.height()-border.y()| are the size // of the right and bottom boundary, respectively. - void SetBorder(gfx::Rect border); + void SetBorder(const gfx::Rect& border); // aperture is in the pixel space of the bitmap resource and refers to // the center patch of the ninepatch (which is unused in this @@ -36,7 +36,7 @@ class CC_EXPORT NinePatchLayer : public UIResourceLayer { // on the edges of the layer. The corners are unscaled, the top and bottom // rects are x-stretched to fit, and the left and right rects are // y-stretched to fit. - void SetAperture(gfx::Rect aperture); + void SetAperture(const gfx::Rect& aperture); void SetFillCenter(bool fill_center); private: diff --git a/cc/layers/nine_patch_layer_impl.cc b/cc/layers/nine_patch_layer_impl.cc index 2987179..a053d5e1 100644 --- a/cc/layers/nine_patch_layer_impl.cc +++ b/cc/layers/nine_patch_layer_impl.cc @@ -44,8 +44,8 @@ static gfx::RectF NormalizedRect(float x, height / total_height); } -void NinePatchLayerImpl::SetLayout(gfx::Rect aperture, - gfx::Rect border, +void NinePatchLayerImpl::SetLayout(const gfx::Rect& aperture, + const gfx::Rect& border, bool fill_center) { // This check imposes an ordering on the call sequence. An UIResource must // exist before SetLayout can be called. diff --git a/cc/layers/nine_patch_layer_impl.h b/cc/layers/nine_patch_layer_impl.h index d85e40f..fb3e66e 100644 --- a/cc/layers/nine_patch_layer_impl.h +++ b/cc/layers/nine_patch_layer_impl.h @@ -53,8 +53,8 @@ class CC_EXPORT NinePatchLayerImpl : public UIResourceLayerImpl { // |image_aperture| = (X, Y, P, Q) // |border| = (A, C, A + B, C + D) // |fill_center| indicates whether to draw the center quad or not. - void SetLayout(gfx::Rect image_aperture, - gfx::Rect border, + void SetLayout(const gfx::Rect& image_aperture, + const gfx::Rect& border, bool fill_center); virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) diff --git a/cc/layers/nine_patch_layer_impl_unittest.cc b/cc/layers/nine_patch_layer_impl_unittest.cc index 6020111..22f2c94 100644 --- a/cc/layers/nine_patch_layer_impl_unittest.cc +++ b/cc/layers/nine_patch_layer_impl_unittest.cc @@ -23,7 +23,7 @@ namespace cc { namespace { -gfx::Rect ToRoundedIntRect(gfx::RectF rect_f) { +gfx::Rect ToRoundedIntRect(const gfx::RectF& rect_f) { return gfx::Rect(gfx::ToRoundedInt(rect_f.x()), gfx::ToRoundedInt(rect_f.y()), gfx::ToRoundedInt(rect_f.width()), @@ -31,9 +31,9 @@ gfx::Rect ToRoundedIntRect(gfx::RectF rect_f) { } void NinePatchLayerLayoutTest(gfx::Size bitmap_size, - gfx::Rect aperture_rect, + const gfx::Rect& aperture_rect, gfx::Size layer_size, - gfx::Rect border, + const gfx::Rect& border, bool fill_center, size_t expected_quad_size) { MockQuadCuller quad_culler; diff --git a/cc/layers/painted_scrollbar_layer.cc b/cc/layers/painted_scrollbar_layer.cc index 6bb7636..4466d58 100644 --- a/cc/layers/painted_scrollbar_layer.cc +++ b/cc/layers/painted_scrollbar_layer.cc @@ -148,7 +148,7 @@ void PaintedScrollbarLayer::SetLayerTreeHost(LayerTreeHost* host) { } gfx::Rect PaintedScrollbarLayer::ScrollbarLayerRectToContentRect( - gfx::Rect layer_rect) const { + const gfx::Rect& layer_rect) const { // Don't intersect with the bounds as in LayerRectToContentRect() because // layer_rect here might be in coordinates of the containing layer. gfx::Rect expanded_rect = gfx::ScaleToEnclosingRect( @@ -217,7 +217,7 @@ bool PaintedScrollbarLayer::Update(ResourceUpdateQueue* queue, } UIResourceBitmap PaintedScrollbarLayer::RasterizeScrollbarPart( - gfx::Rect rect, + const gfx::Rect& rect, ScrollbarPart part) { DCHECK(!rect.size().IsEmpty()); diff --git a/cc/layers/painted_scrollbar_layer.h b/cc/layers/painted_scrollbar_layer.h index 606ad69b..c24c0aa 100644 --- a/cc/layers/painted_scrollbar_layer.h +++ b/cc/layers/painted_scrollbar_layer.h @@ -62,7 +62,7 @@ class CC_EXPORT PaintedScrollbarLayer : public ScrollbarLayerInterface, void UpdateThumbAndTrackGeometry(); private: - gfx::Rect ScrollbarLayerRectToContentRect(gfx::Rect layer_rect) const; + gfx::Rect ScrollbarLayerRectToContentRect(const gfx::Rect& layer_rect) const; gfx::Rect OriginThumbRect() const; template<typename T> void UpdateProperty(T value, T* prop) { @@ -75,7 +75,7 @@ class CC_EXPORT PaintedScrollbarLayer : public ScrollbarLayerInterface, int MaxTextureSize(); float ClampScaleToMaxTextureSize(float scale); - UIResourceBitmap RasterizeScrollbarPart(gfx::Rect rect, + UIResourceBitmap RasterizeScrollbarPart(const gfx::Rect& rect, ScrollbarPart part); scoped_ptr<Scrollbar> scrollbar_; diff --git a/cc/layers/picture_image_layer.cc b/cc/layers/picture_image_layer.cc index 03e3a9e..127560d 100644 --- a/cc/layers/picture_image_layer.cc +++ b/cc/layers/picture_image_layer.cc @@ -41,7 +41,7 @@ void PictureImageLayer::SetBitmap(const SkBitmap& bitmap) { } void PictureImageLayer::PaintContents(SkCanvas* canvas, - gfx::Rect clip, + const gfx::Rect& clip, gfx::RectF* opaque) { if (!bitmap_.width() || !bitmap_.height()) return; diff --git a/cc/layers/picture_image_layer.h b/cc/layers/picture_image_layer.h index 09db1df..8066428 100644 --- a/cc/layers/picture_image_layer.h +++ b/cc/layers/picture_image_layer.h @@ -27,7 +27,7 @@ class CC_EXPORT PictureImageLayer : public PictureLayer, ContentLayerClient { // ContentLayerClient implementation. virtual void PaintContents( SkCanvas* canvas, - gfx::Rect clip, + const gfx::Rect& clip, gfx::RectF* opaque) OVERRIDE; virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc index 08b42c5..344a583 100644 --- a/cc/layers/picture_layer_impl.cc +++ b/cc/layers/picture_layer_impl.cc @@ -468,7 +468,7 @@ void PictureLayerImpl::SetShouldUseGpuRasterization( } scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, - gfx::Rect content_rect) { + const gfx::Rect& content_rect) { if (!pile_->CanRaster(tiling->contents_scale(), content_rect)) return scoped_refptr<Tile>(); @@ -779,7 +779,7 @@ bool PictureLayerImpl::MarkVisibleTilesAsRequired( PictureLayerTiling* tiling, const PictureLayerTiling* optional_twin_tiling, float contents_scale, - gfx::Rect rect, + const gfx::Rect& rect, const Region& missing_region) const { bool twin_had_missing_tile = false; for (PictureLayerTiling::CoverageIterator iter(tiling, diff --git a/cc/layers/picture_layer_impl.h b/cc/layers/picture_layer_impl.h index f9ac16d..4b9e3ac 100644 --- a/cc/layers/picture_layer_impl.h +++ b/cc/layers/picture_layer_impl.h @@ -53,8 +53,9 @@ class CC_EXPORT PictureLayerImpl virtual skia::RefPtr<SkPicture> GetPicture() OVERRIDE; // PictureLayerTilingClient overrides. - virtual scoped_refptr<Tile> CreateTile(PictureLayerTiling* tiling, - gfx::Rect content_rect) OVERRIDE; + virtual scoped_refptr<Tile> CreateTile( + PictureLayerTiling* tiling, + const gfx::Rect& content_rect) OVERRIDE; virtual void UpdatePile(Tile* tile) OVERRIDE; virtual gfx::Size CalculateTileSize( gfx::Size content_bounds) const OVERRIDE; @@ -100,7 +101,7 @@ class CC_EXPORT PictureLayerImpl PictureLayerTiling* tiling, const PictureLayerTiling* optional_twin_tiling, float contents_scale, - gfx::Rect rect, + const gfx::Rect& rect, const Region& missing_region) const; void DoPostCommitInitializationIfNeeded() { diff --git a/cc/layers/picture_layer_unittest.cc b/cc/layers/picture_layer_unittest.cc index c3dd244..8f13fd0 100644 --- a/cc/layers/picture_layer_unittest.cc +++ b/cc/layers/picture_layer_unittest.cc @@ -20,7 +20,7 @@ namespace { class MockContentLayerClient : public ContentLayerClient { public: virtual void PaintContents(SkCanvas* canvas, - gfx::Rect clip, + const gfx::Rect& clip, gfx::RectF* opaque) OVERRIDE {} virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} }; diff --git a/cc/layers/render_surface.h b/cc/layers/render_surface.h index ef9ba22..b0da4e9 100644 --- a/cc/layers/render_surface.h +++ b/cc/layers/render_surface.h @@ -29,7 +29,9 @@ class CC_EXPORT RenderSurface { // reflection. gfx::RectF DrawableContentRect() const; - void SetContentRect(gfx::Rect content_rect) { content_rect_ = content_rect; } + void SetContentRect(const gfx::Rect& content_rect) { + content_rect_ = content_rect; + } gfx::Rect content_rect() const { return content_rect_; } void SetDrawOpacity(float opacity) { draw_opacity_ = opacity; } @@ -84,7 +86,7 @@ class CC_EXPORT RenderSurface { void SetIsClipped(bool is_clipped) { is_clipped_ = is_clipped; } gfx::Rect clip_rect() const { return clip_rect_; } - void SetClipRect(gfx::Rect clip_rect) { clip_rect_ = clip_rect; } + void SetClipRect(const gfx::Rect& clip_rect) { clip_rect_ = clip_rect; } // When false, the RenderSurface does not contribute to another target // RenderSurface that is being drawn for the current frame. It could still be diff --git a/cc/layers/render_surface_impl.cc b/cc/layers/render_surface_impl.cc index a8336bc..c118f0e 100644 --- a/cc/layers/render_surface_impl.cc +++ b/cc/layers/render_surface_impl.cc @@ -64,7 +64,7 @@ int RenderSurfaceImpl::OwningLayerId() const { } -void RenderSurfaceImpl::SetClipRect(gfx::Rect clip_rect) { +void RenderSurfaceImpl::SetClipRect(const gfx::Rect& clip_rect) { if (clip_rect_ == clip_rect) return; @@ -76,7 +76,7 @@ bool RenderSurfaceImpl::ContentsChanged() const { return !damage_tracker_->current_damage_rect().IsEmpty(); } -void RenderSurfaceImpl::SetContentRect(gfx::Rect content_rect) { +void RenderSurfaceImpl::SetContentRect(const gfx::Rect& content_rect) { if (content_rect_ == content_rect) return; diff --git a/cc/layers/render_surface_impl.h b/cc/layers/render_surface_impl.h index c02a3194..7207dc0 100644 --- a/cc/layers/render_surface_impl.h +++ b/cc/layers/render_surface_impl.h @@ -101,7 +101,7 @@ class CC_EXPORT RenderSurfaceImpl { void SetIsClipped(bool is_clipped) { is_clipped_ = is_clipped; } bool is_clipped() const { return is_clipped_; } - void SetClipRect(gfx::Rect clip_rect); + void SetClipRect(const gfx::Rect& clip_rect); gfx::Rect clip_rect() const { return clip_rect_; } // When false, the RenderSurface does not contribute to another target @@ -117,7 +117,7 @@ class CC_EXPORT RenderSurfaceImpl { bool ContentsChanged() const; - void SetContentRect(gfx::Rect content_rect); + void SetContentRect(const gfx::Rect& content_rect); gfx::Rect content_rect() const { return content_rect_; } LayerImplList& layer_list() { return layer_list_; } diff --git a/cc/layers/scrollbar_layer_impl_base.cc b/cc/layers/scrollbar_layer_impl_base.cc index e9b9569..55f46f5 100644 --- a/cc/layers/scrollbar_layer_impl_base.cc +++ b/cc/layers/scrollbar_layer_impl_base.cc @@ -35,7 +35,7 @@ ScrollbarLayerImplBase* ScrollbarLayerImplBase::ToScrollbarLayer() { } gfx::Rect ScrollbarLayerImplBase::ScrollbarLayerRectToContentRect( - gfx::RectF layer_rect) const { + const gfx::RectF& layer_rect) const { // Don't intersect with the bounds as in LayerRectToContentRect() because // layer_rect here might be in coordinates of the containing layer. gfx::RectF content_rect = gfx::ScaleRect(layer_rect, diff --git a/cc/layers/scrollbar_layer_impl_base.h b/cc/layers/scrollbar_layer_impl_base.h index f75808e..6bba749 100644 --- a/cc/layers/scrollbar_layer_impl_base.h +++ b/cc/layers/scrollbar_layer_impl_base.h @@ -53,7 +53,7 @@ class CC_EXPORT ScrollbarLayerImplBase : public LayerImpl { bool is_left_side_vertical_scrollbar); virtual ~ScrollbarLayerImplBase() {} - gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const; + gfx::Rect ScrollbarLayerRectToContentRect(const gfx::RectF& layer_rect) const; float visible_to_total_length_ratio() const { return visible_to_total_length_ratio_; diff --git a/cc/layers/scrollbar_theme_painter.h b/cc/layers/scrollbar_theme_painter.h index f7553ac..8f3e68d 100644 --- a/cc/layers/scrollbar_theme_painter.h +++ b/cc/layers/scrollbar_theme_painter.h @@ -19,16 +19,24 @@ class CC_EXPORT ScrollbarThemePainter { public: virtual ~ScrollbarThemePainter() {} - virtual void PaintScrollbarBackground(SkCanvas* canvas, gfx::Rect rect) = 0; - virtual void PaintTrackBackground(SkCanvas* canvas, gfx::Rect rect) = 0; - virtual void PaintBackTrackPart(SkCanvas* canvas, gfx::Rect rect) = 0; - virtual void PaintForwardTrackPart(SkCanvas* canvas, gfx::Rect rect) = 0; - virtual void PaintBackButtonStart(SkCanvas* canvas, gfx::Rect rect) = 0; - virtual void PaintBackButtonEnd(SkCanvas* canvas, gfx::Rect rect) = 0; - virtual void PaintForwardButtonStart(SkCanvas* canvas, gfx::Rect rect) = 0; - virtual void PaintForwardButtonEnd(SkCanvas* canvas, gfx::Rect rect) = 0; - virtual void PaintTickmarks(SkCanvas* canvas, gfx::Rect rect) = 0; - virtual void PaintThumb(SkCanvas* canvas, gfx::Rect rect) = 0; + virtual void PaintScrollbarBackground(SkCanvas* canvas, + const gfx::Rect& rect) = 0; + virtual void PaintTrackBackground(SkCanvas* canvas, + const gfx::Rect& rect) = 0; + virtual void PaintBackTrackPart(SkCanvas* canvas, + const gfx::Rect& rect) = 0; + virtual void PaintForwardTrackPart(SkCanvas* canvas, + const gfx::Rect& rect) = 0; + virtual void PaintBackButtonStart(SkCanvas* canvas, + const gfx::Rect& rect) = 0; + virtual void PaintBackButtonEnd(SkCanvas* canvas, + const gfx::Rect& rect) = 0; + virtual void PaintForwardButtonStart(SkCanvas* canvas, + const gfx::Rect& rect) = 0; + virtual void PaintForwardButtonEnd(SkCanvas* canvas, + const gfx::Rect& rect) = 0; + virtual void PaintTickmarks(SkCanvas* canvas, const gfx::Rect& rect) = 0; + virtual void PaintThumb(SkCanvas* canvas, const gfx::Rect& rect) = 0; }; } // namespace cc diff --git a/cc/layers/tiled_layer.cc b/cc/layers/tiled_layer.cc index 24baef5..51bf212 100644 --- a/cc/layers/tiled_layer.cc +++ b/cc/layers/tiled_layer.cc @@ -294,7 +294,7 @@ void TiledLayer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) { ContentsScalingLayer::SetNeedsDisplayRect(dirty_rect); } -void TiledLayer::InvalidateContentRect(gfx::Rect content_rect) { +void TiledLayer::InvalidateContentRect(const gfx::Rect& content_rect) { UpdateBounds(); if (tiler_->is_empty() || content_rect.IsEmpty() || skips_draw_) return; @@ -468,8 +468,8 @@ void TiledLayer::MarkTilesForUpdate(gfx::Rect* update_rect, } } -void TiledLayer::UpdateTileTextures(gfx::Rect update_rect, - gfx::Rect paint_rect, +void TiledLayer::UpdateTileTextures(const gfx::Rect& update_rect, + const gfx::Rect& paint_rect, int left, int top, int right, @@ -593,8 +593,8 @@ namespace { // TODO(epenner): Remove this and make this based on distance once distance can // be calculated for offscreen layers. For now, prioritize all small animated // layers after 512 pixels of pre-painting. -void SetPriorityForTexture(gfx::Rect visible_rect, - gfx::Rect tile_rect, +void SetPriorityForTexture(const gfx::Rect& visible_rect, + const gfx::Rect& tile_rect, bool draws_to_root, bool is_small_animated_layer, PrioritizedResource* texture) { @@ -684,7 +684,7 @@ void TiledLayer::ResetUpdateState() { } namespace { -gfx::Rect ExpandRectByDelta(gfx::Rect rect, gfx::Vector2d delta) { +gfx::Rect ExpandRectByDelta(const gfx::Rect& rect, gfx::Vector2d delta) { int width = rect.width() + std::abs(delta.x()); int height = rect.height() + std::abs(delta.y()); int x = rect.x() + ((delta.x() < 0) ? delta.x() : 0); diff --git a/cc/layers/tiled_layer.h b/cc/layers/tiled_layer.h index 8206360..f2f7e96 100644 --- a/cc/layers/tiled_layer.h +++ b/cc/layers/tiled_layer.h @@ -57,7 +57,7 @@ class CC_EXPORT TiledLayer : public ContentsScalingLayer { virtual void CreateUpdaterIfNeeded() = 0; // Set invalidations to be potentially repainted during Update(). - void InvalidateContentRect(gfx::Rect content_rect); + void InvalidateContentRect(const gfx::Rect& content_rect); // Reset state on tiles that will be used for updating the layer. void ResetUpdateState(); @@ -110,8 +110,8 @@ class CC_EXPORT TiledLayer : public ContentsScalingLayer { int right, int bottom, bool ignore_occlusions); - void UpdateTileTextures(gfx::Rect update_rect, - gfx::Rect paint_rect, + void UpdateTileTextures(const gfx::Rect& update_rect, + const gfx::Rect& paint_rect, int left, int top, int right, diff --git a/cc/layers/tiled_layer_impl.cc b/cc/layers/tiled_layer_impl.cc index 88797c2..765ec05 100644 --- a/cc/layers/tiled_layer_impl.cc +++ b/cc/layers/tiled_layer_impl.cc @@ -263,7 +263,7 @@ void TiledLayerImpl::PushTileProperties( int i, int j, ResourceProvider::ResourceId resource_id, - gfx::Rect opaque_rect, + const gfx::Rect& opaque_rect, bool contents_swizzled) { DrawableTile* tile = TileAt(i, j); if (!tile) diff --git a/cc/layers/tiled_layer_impl.h b/cc/layers/tiled_layer_impl.h index 939842b..f704823 100644 --- a/cc/layers/tiled_layer_impl.h +++ b/cc/layers/tiled_layer_impl.h @@ -38,7 +38,7 @@ class CC_EXPORT TiledLayerImpl : public LayerImpl { void PushTileProperties(int i, int j, ResourceProvider::ResourceId resource, - gfx::Rect opaque_rect, + const gfx::Rect& opaque_rect, bool contents_swizzled); void PushInvalidTile(int i, int j); diff --git a/cc/layers/tiled_layer_impl_unittest.cc b/cc/layers/tiled_layer_impl_unittest.cc index 801cbf4..deb2769 100644 --- a/cc/layers/tiled_layer_impl_unittest.cc +++ b/cc/layers/tiled_layer_impl_unittest.cc @@ -72,7 +72,7 @@ class TiledLayerImplTest : public testing::Test { gfx::Size tile_size, gfx::Size layer_size, LayerTilingData::BorderTexelOption border_texel_option, - gfx::Rect visible_content_rect) { + const gfx::Rect& visible_content_rect) { scoped_ptr<TiledLayerImpl> layer = CreateLayer(tile_size, layer_size, border_texel_option); layer->draw_properties().visible_content_rect = visible_content_rect; diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc index 42ef29c..b700ebf 100644 --- a/cc/layers/tiled_layer_unittest.cc +++ b/cc/layers/tiled_layer_unittest.cc @@ -1843,7 +1843,7 @@ class TrackingLayerPainter : public LayerPainter { } virtual void Paint(SkCanvas* canvas, - gfx::Rect content_rect, + const gfx::Rect& content_rect, gfx::RectF* opaque) OVERRIDE { painted_rect_ = content_rect; } diff --git a/cc/layers/ui_resource_layer_impl_unittest.cc b/cc/layers/ui_resource_layer_impl_unittest.cc index 4a2a116..4c55f1d 100644 --- a/cc/layers/ui_resource_layer_impl_unittest.cc +++ b/cc/layers/ui_resource_layer_impl_unittest.cc @@ -89,7 +89,7 @@ TEST(UIResourceLayerImplTest, VerifyDrawQuads) { } void OpaqueBoundsTest(scoped_ptr<UIResourceLayerImpl> layer, - gfx::Rect expected_opaque_bounds) { + const gfx::Rect& expected_opaque_bounds) { MockQuadCuller quad_culler; AppendQuadsData data; layer->AppendQuads(&quad_culler, &data); diff --git a/cc/output/copy_output_request.h b/cc/output/copy_output_request.h index 4b74b41..6d8870d 100644 --- a/cc/output/copy_output_request.h +++ b/cc/output/copy_output_request.h @@ -46,7 +46,7 @@ class CC_EXPORT CopyOutputRequest { // By default copy requests copy the entire layer's subtree output. If an // area is given, then the intersection of this rect (in layer space) with // the layer's subtree output will be returned. - void set_area(gfx::Rect area) { + void set_area(const gfx::Rect& area) { has_area_ = true; area_ = area; } diff --git a/cc/output/delegating_renderer.cc b/cc/output/delegating_renderer.cc index 3a16568..b75d097 100644 --- a/cc/output/delegating_renderer.cc +++ b/cc/output/delegating_renderer.cc @@ -96,8 +96,8 @@ static ResourceProvider::ResourceId AppendToArray( void DelegatingRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, ContextProvider* offscreen_context_provider, float device_scale_factor, - gfx::Rect device_viewport_rect, - gfx::Rect device_clip_rect, + const gfx::Rect& device_viewport_rect, + const gfx::Rect& device_clip_rect, bool allow_partial_swap, bool disable_picture_quad_image_filtering) { TRACE_EVENT0("cc", "DelegatingRenderer::DrawFrame"); @@ -129,7 +129,8 @@ void DelegatingRenderer::SwapBuffers(const CompositorFrameMetadata& metadata) { output_surface_->SwapBuffers(&compositor_frame); } -void DelegatingRenderer::GetFramebufferPixels(void* pixels, gfx::Rect rect) { +void DelegatingRenderer::GetFramebufferPixels(void* pixels, + const gfx::Rect& rect) { NOTREACHED(); } diff --git a/cc/output/delegating_renderer.h b/cc/output/delegating_renderer.h index c18bfa7..3de65f7 100644 --- a/cc/output/delegating_renderer.h +++ b/cc/output/delegating_renderer.h @@ -31,8 +31,8 @@ class CC_EXPORT DelegatingRenderer : public Renderer { virtual void DrawFrame(RenderPassList* render_passes_in_draw_order, ContextProvider* offscreen_context_provider, float device_scale_factor, - gfx::Rect device_viewport_rect, - gfx::Rect device_clip_rect, + const gfx::Rect& device_viewport_rect, + const gfx::Rect& device_clip_rect, bool allow_partial_swap, bool disable_picture_quad_image_filtering) OVERRIDE; @@ -41,7 +41,8 @@ class CC_EXPORT DelegatingRenderer : public Renderer { virtual void SwapBuffers(const CompositorFrameMetadata& metadata) OVERRIDE; virtual void ReceiveSwapBuffersAck(const CompositorFrameAck&) OVERRIDE; - virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; + virtual void GetFramebufferPixels(void* pixels, + const gfx::Rect& rect) OVERRIDE; virtual bool IsContextLost() OVERRIDE; diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc index 84788c5..f90789d 100644 --- a/cc/output/direct_renderer.cc +++ b/cc/output/direct_renderer.cc @@ -81,8 +81,8 @@ void DirectRenderer::QuadRectTransform(gfx::Transform* quad_rect_transform, } void DirectRenderer::InitializeViewport(DrawingFrame* frame, - gfx::Rect draw_rect, - gfx::Rect viewport_rect, + const gfx::Rect& draw_rect, + const gfx::Rect& viewport_rect, gfx::Size surface_size) { bool flip_y = FlippedFramebuffer(); @@ -195,8 +195,8 @@ void DirectRenderer::DecideRenderPassAllocationsForFrame( void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, ContextProvider* offscreen_context_provider, float device_scale_factor, - gfx::Rect device_viewport_rect, - gfx::Rect device_clip_rect, + const gfx::Rect& device_viewport_rect, + const gfx::Rect& device_clip_rect, bool allow_partial_swap, bool disable_picture_quad_image_filtering) { TRACE_EVENT0("cc", "DirectRenderer::DrawFrame"); @@ -317,8 +317,9 @@ void DirectRenderer::SetScissorStateForQuadWithRenderPassScissor( SetScissorTestRectInDrawSpace(frame, quad_scissor_rect); } -void DirectRenderer::SetScissorTestRectInDrawSpace(const DrawingFrame* frame, - gfx::RectF draw_space_rect) { +void DirectRenderer::SetScissorTestRectInDrawSpace( + const DrawingFrame* frame, + const gfx::RectF& draw_space_rect) { gfx::Rect window_space_rect = MoveFromDrawToWindowSpace(draw_space_rect); if (NeedDeviceClip(frame)) window_space_rect.Intersect(DeviceClipRectInWindowSpace(frame)); diff --git a/cc/output/direct_renderer.h b/cc/output/direct_renderer.h index 5c4dc7e..4a447aa 100644 --- a/cc/output/direct_renderer.h +++ b/cc/output/direct_renderer.h @@ -34,8 +34,8 @@ class CC_EXPORT DirectRenderer : public Renderer { virtual void DrawFrame(RenderPassList* render_passes_in_draw_order, ContextProvider* offscreen_context_provider, float device_scale_factor, - gfx::Rect device_viewport_rect, - gfx::Rect device_clip_rect, + const gfx::Rect& device_viewport_rect, + const gfx::Rect& device_clip_rect, bool allow_partial_swap, bool disable_picture_quad_image_filtering) OVERRIDE; @@ -72,8 +72,8 @@ class CC_EXPORT DirectRenderer : public Renderer { const gfx::Transform& quad_transform, const gfx::RectF& quad_rect); void InitializeViewport(DrawingFrame* frame, - gfx::Rect draw_rect, - gfx::Rect viewport_rect, + const gfx::Rect& draw_rect, + const gfx::Rect& viewport_rect, gfx::Size surface_size); gfx::Rect MoveFromDrawToWindowSpace(const gfx::RectF& draw_rect) const; @@ -87,7 +87,7 @@ class CC_EXPORT DirectRenderer : public Renderer { const gfx::RectF& render_pass_scissor, bool* should_skip_quad); void SetScissorTestRectInDrawSpace(const DrawingFrame* frame, - gfx::RectF draw_space_rect); + const gfx::RectF& draw_space_rect); static gfx::Size RenderPassTextureSize(const RenderPass* render_pass); @@ -99,9 +99,9 @@ class CC_EXPORT DirectRenderer : public Renderer { virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; virtual bool BindFramebufferToTexture(DrawingFrame* frame, const ScopedResource* resource, - gfx::Rect target_rect) = 0; - virtual void SetDrawViewport(gfx::Rect window_space_viewport) = 0; - virtual void SetScissorTestRect(gfx::Rect scissor_rect) = 0; + const gfx::Rect& target_rect) = 0; + virtual void SetDrawViewport(const gfx::Rect& window_space_viewport) = 0; + virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) = 0; virtual void DiscardPixels(bool has_external_stencil_test, bool draw_rect_covers_full_surface) = 0; virtual void ClearFramebuffer(DrawingFrame* frame, diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 896028d..65dc0da 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -2061,7 +2061,7 @@ void GLRenderer::DrawQuadGeometry(const DrawingFrame* frame, void GLRenderer::CopyTextureToFramebuffer(const DrawingFrame* frame, int texture_id, - gfx::Rect rect, + const gfx::Rect& rect, const gfx::Transform& draw_matrix, bool flip_vertically) { TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( @@ -2171,7 +2171,7 @@ void GLRenderer::EnsureBackbuffer() { is_backbuffer_discarded_ = false; } -void GLRenderer::GetFramebufferPixels(void* pixels, gfx::Rect rect) { +void GLRenderer::GetFramebufferPixels(void* pixels, const gfx::Rect& rect) { if (!pixels || rect.IsEmpty()) return; @@ -2190,7 +2190,7 @@ void GLRenderer::GetFramebufferPixels(void* pixels, gfx::Rect rect) { } void GLRenderer::GetFramebufferPixelsAsync( - gfx::Rect rect, + const gfx::Rect& rect, scoped_ptr<CopyOutputRequest> request) { DCHECK(!request->IsEmpty()); if (request->IsEmpty()) @@ -2288,7 +2288,7 @@ void GLRenderer::GetFramebufferPixelsAsync( void GLRenderer::DoGetFramebufferPixels( uint8* dest_pixels, - gfx::Rect window_rect, + const gfx::Rect& window_rect, const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback) { DCHECK_GE(window_rect.x(), 0); DCHECK_GE(window_rect.y(), 0); @@ -2471,7 +2471,7 @@ void GLRenderer::PassOnSkBitmap(scoped_ptr<SkBitmap> bitmap, void GLRenderer::GetFramebufferTexture(unsigned texture_id, ResourceFormat texture_format, - gfx::Rect window_rect) { + const gfx::Rect& window_rect) { DCHECK(texture_id); DCHECK_GE(window_rect.x(), 0); DCHECK_GE(window_rect.y(), 0); @@ -2493,7 +2493,7 @@ void GLRenderer::GetFramebufferTexture(unsigned texture_id, bool GLRenderer::UseScopedTexture(DrawingFrame* frame, const ScopedResource* texture, - gfx::Rect viewport_rect) { + const gfx::Rect& viewport_rect) { DCHECK(texture->id()); frame->current_render_pass = NULL; frame->current_texture = texture; @@ -2515,7 +2515,7 @@ void GLRenderer::BindFramebufferToOutputSurface(DrawingFrame* frame) { bool GLRenderer::BindFramebufferToTexture(DrawingFrame* frame, const ScopedResource* texture, - gfx::Rect target_rect) { + const gfx::Rect& target_rect) { DCHECK(texture->id()); current_framebuffer_lock_.reset(); @@ -2539,7 +2539,7 @@ bool GLRenderer::BindFramebufferToTexture(DrawingFrame* frame, return true; } -void GLRenderer::SetScissorTestRect(gfx::Rect scissor_rect) { +void GLRenderer::SetScissorTestRect(const gfx::Rect& scissor_rect) { EnsureScissorTestEnabled(); // Don't unnecessarily ask the context to change the scissor, because it @@ -2558,7 +2558,7 @@ void GLRenderer::SetScissorTestRect(gfx::Rect scissor_rect) { scissor_rect_needs_reset_ = false; } -void GLRenderer::SetDrawViewport(gfx::Rect window_space_viewport) { +void GLRenderer::SetDrawViewport(const gfx::Rect& window_space_viewport) { viewport_ = window_space_viewport; GLC(gl_, gl_->Viewport(window_space_viewport.x(), diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h index 0484c05..b25d672 100644 --- a/cc/output/gl_renderer.h +++ b/cc/output/gl_renderer.h @@ -64,7 +64,8 @@ class CC_EXPORT GLRenderer : public DirectRenderer { virtual void DoNoOp() OVERRIDE; virtual void SwapBuffers(const CompositorFrameMetadata& metadata) OVERRIDE; - virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; + virtual void GetFramebufferPixels(void* pixels, + const gfx::Rect& rect) OVERRIDE; virtual bool IsContextLost() OVERRIDE; @@ -95,11 +96,11 @@ class CC_EXPORT GLRenderer : public DirectRenderer { return shared_geometry_.get(); } - void GetFramebufferPixelsAsync(gfx::Rect rect, + void GetFramebufferPixelsAsync(const gfx::Rect& rect, scoped_ptr<CopyOutputRequest> request); void GetFramebufferTexture(unsigned texture_id, ResourceFormat texture_format, - gfx::Rect device_rect); + const gfx::Rect& device_rect); void ReleaseRenderPassTextures(); void SetStencilEnabled(bool enabled); @@ -110,9 +111,9 @@ class CC_EXPORT GLRenderer : public DirectRenderer { virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) OVERRIDE; virtual bool BindFramebufferToTexture(DrawingFrame* frame, const ScopedResource* resource, - gfx::Rect target_rect) OVERRIDE; - virtual void SetDrawViewport(gfx::Rect window_space_viewport) OVERRIDE; - virtual void SetScissorTestRect(gfx::Rect scissor_rect) OVERRIDE; + const gfx::Rect& target_rect) OVERRIDE; + virtual void SetDrawViewport(const gfx::Rect& window_space_viewport) OVERRIDE; + virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) OVERRIDE; virtual void DiscardPixels(bool has_external_stencil_test, bool draw_rect_covers_full_surface) OVERRIDE; virtual void ClearFramebuffer(DrawingFrame* frame, @@ -184,13 +185,13 @@ class CC_EXPORT GLRenderer : public DirectRenderer { void CopyTextureToFramebuffer(const DrawingFrame* frame, int texture_id, - gfx::Rect rect, + const gfx::Rect& rect, const gfx::Transform& draw_matrix, bool flip_vertically); bool UseScopedTexture(DrawingFrame* frame, const ScopedResource* resource, - gfx::Rect viewport_rect); + const gfx::Rect& viewport_rect); bool MakeContextCurrent(); @@ -202,7 +203,7 @@ class CC_EXPORT GLRenderer : public DirectRenderer { AsyncGetFramebufferPixelsCleanupCallback; void DoGetFramebufferPixels( uint8* pixels, - gfx::Rect window_rect, + const gfx::Rect& window_rect, const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback); void FinishedReadback( const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback, diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc index e0dcc29..7c5741f 100644 --- a/cc/output/gl_renderer_unittest.cc +++ b/cc/output/gl_renderer_unittest.cc @@ -1754,7 +1754,8 @@ class MockOutputSurfaceTest : public GLRendererTest { void SwapBuffers() { renderer_->SwapBuffers(CompositorFrameMetadata()); } - void DrawFrame(float device_scale_factor, gfx::Rect device_viewport_rect) { + void DrawFrame(float device_scale_factor, + const gfx::Rect& device_viewport_rect) { RenderPass::Id render_pass_id(1, 0); TestRenderPass* render_pass = AddRenderPass(&render_passes_in_draw_order_, render_pass_id, diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc index 349cb34..f3952d5 100644 --- a/cc/output/output_surface.cc +++ b/cc/output/output_surface.cc @@ -136,7 +136,7 @@ void OutputSurface::FrameRateControllerTick(bool throttled, } // Forwarded to OutputSurfaceClient -void OutputSurface::SetNeedsRedrawRect(gfx::Rect damage_rect) { +void OutputSurface::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { TRACE_EVENT0("cc", "OutputSurface::SetNeedsRedrawRect"); client_->SetNeedsRedrawRect(damage_rect); } @@ -242,8 +242,8 @@ void OutputSurface::SetExternalStencilTest(bool enabled) { } void OutputSurface::SetExternalDrawConstraints(const gfx::Transform& transform, - gfx::Rect viewport, - gfx::Rect clip, + const gfx::Rect& viewport, + const gfx::Rect& clip, bool valid_for_tile_management) { client_->SetExternalDrawConstraints( transform, viewport, clip, valid_for_tile_management); diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h index 0d7d4e7..aae3b8c 100644 --- a/cc/output/output_surface.h +++ b/cc/output/output_surface.h @@ -175,7 +175,7 @@ class CC_EXPORT OutputSurface : public FrameRateControllerClient { // Forwarded to OutputSurfaceClient but threaded through OutputSurface // first so OutputSurface has a chance to update the FrameRateController - void SetNeedsRedrawRect(gfx::Rect damage_rect); + void SetNeedsRedrawRect(const gfx::Rect& damage_rect); void BeginImplFrame(const BeginFrameArgs& args); void DidSwapBuffers(); void OnSwapBuffersComplete(); @@ -183,8 +183,8 @@ class CC_EXPORT OutputSurface : public FrameRateControllerClient { void DidLoseOutputSurface(); void SetExternalStencilTest(bool enabled); void SetExternalDrawConstraints(const gfx::Transform& transform, - gfx::Rect viewport, - gfx::Rect clip, + const gfx::Rect& viewport, + const gfx::Rect& clip, bool valid_for_tile_management); // virtual for testing. diff --git a/cc/output/output_surface_client.h b/cc/output/output_surface_client.h index d82f30d..7e509a8 100644 --- a/cc/output/output_surface_client.h +++ b/cc/output/output_surface_client.h @@ -30,15 +30,15 @@ class CC_EXPORT OutputSurfaceClient { virtual bool DeferredInitialize( scoped_refptr<ContextProvider> offscreen_context_provider) = 0; virtual void ReleaseGL() = 0; - virtual void SetNeedsRedrawRect(gfx::Rect damage_rect) = 0; + virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) = 0; virtual void BeginImplFrame(const BeginFrameArgs& args) = 0; virtual void DidSwapBuffers() = 0; virtual void OnSwapBuffersComplete() = 0; virtual void ReclaimResources(const CompositorFrameAck* ack) = 0; virtual void DidLoseOutputSurface() = 0; virtual void SetExternalDrawConstraints(const gfx::Transform& transform, - gfx::Rect viewport, - gfx::Rect clip, + const gfx::Rect& viewport, + const gfx::Rect& clip, bool valid_for_tile_management) = 0; virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) = 0; // If set, |callback| will be called subsequent to each new tree activation, diff --git a/cc/output/renderer.h b/cc/output/renderer.h index 147b535f..412f8d1 100644 --- a/cc/output/renderer.h +++ b/cc/output/renderer.h @@ -41,8 +41,8 @@ class CC_EXPORT Renderer { virtual void DrawFrame(RenderPassList* render_passes_in_draw_order, ContextProvider* offscreen_context_provider, float device_scale_factor, - gfx::Rect device_viewport_rect, - gfx::Rect device_clip_rect, + const gfx::Rect& device_viewport_rect, + const gfx::Rect& device_clip_rect, bool allow_partial_swap, bool disable_picture_quad_image_filtering) = 0; @@ -55,7 +55,7 @@ class CC_EXPORT Renderer { virtual void SwapBuffers(const CompositorFrameMetadata& metadata) = 0; virtual void ReceiveSwapBuffersAck(const CompositorFrameAck& ack) {} - virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) = 0; + virtual void GetFramebufferPixels(void* pixels, const gfx::Rect& rect) = 0; virtual bool IsContextLost(); diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc index 8ab93aa..68bd855 100644 --- a/cc/output/renderer_pixeltest.cc +++ b/cc/output/renderer_pixeltest.cc @@ -25,7 +25,7 @@ namespace { #if !defined(OS_ANDROID) scoped_ptr<RenderPass> CreateTestRootRenderPass(RenderPass::Id id, - gfx::Rect rect) { + const gfx::Rect& rect) { scoped_ptr<RenderPass> pass = RenderPass::Create(); const gfx::Rect output_rect = rect; const gfx::RectF damage_rect = rect; @@ -36,7 +36,7 @@ scoped_ptr<RenderPass> CreateTestRootRenderPass(RenderPass::Id id, scoped_ptr<RenderPass> CreateTestRenderPass( RenderPass::Id id, - gfx::Rect rect, + const gfx::Rect& rect, const gfx::Transform& transform_to_root_target) { scoped_ptr<RenderPass> pass = RenderPass::Create(); const gfx::Rect output_rect = rect; @@ -46,7 +46,7 @@ scoped_ptr<RenderPass> CreateTestRenderPass( } scoped_ptr<SharedQuadState> CreateTestSharedQuadState( - gfx::Transform content_to_target_transform, gfx::Rect rect) { + gfx::Transform content_to_target_transform, const gfx::Rect& rect) { const gfx::Size content_bounds = rect.size(); const gfx::Rect visible_content_rect = rect; const gfx::Rect clip_rect = rect; @@ -66,8 +66,8 @@ scoped_ptr<SharedQuadState> CreateTestSharedQuadState( scoped_ptr<SharedQuadState> CreateTestSharedQuadStateClipped( gfx::Transform content_to_target_transform, - gfx::Rect rect, - gfx::Rect clip_rect) { + const gfx::Rect& rect, + const gfx::Rect& clip_rect) { const gfx::Size content_bounds = rect.size(); const gfx::Rect visible_content_rect = clip_rect; const bool is_clipped = true; @@ -85,7 +85,9 @@ scoped_ptr<SharedQuadState> CreateTestSharedQuadStateClipped( } scoped_ptr<DrawQuad> CreateTestRenderPassDrawQuad( - SharedQuadState* shared_state, gfx::Rect rect, RenderPass::Id pass_id) { + SharedQuadState* shared_state, + const gfx::Rect& rect, + RenderPass::Id pass_id) { scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create(); quad->SetNew(shared_state, rect, @@ -101,7 +103,7 @@ scoped_ptr<DrawQuad> CreateTestRenderPassDrawQuad( } scoped_ptr<TextureDrawQuad> CreateTestTextureDrawQuad( - gfx::Rect rect, + const gfx::Rect& rect, SkColor texel_color, SkColor background_color, bool premultiplied_alpha, diff --git a/cc/output/software_output_device.cc b/cc/output/software_output_device.cc index 17ef63f..3e75e06 100644 --- a/cc/output/software_output_device.cc +++ b/cc/output/software_output_device.cc @@ -27,7 +27,7 @@ void SoftwareOutputDevice::Resize(gfx::Size viewport_size) { canvas_ = skia::AdoptRef(new SkCanvas(device_.get())); } -SkCanvas* SoftwareOutputDevice::BeginPaint(gfx::Rect damage_rect) { +SkCanvas* SoftwareOutputDevice::BeginPaint(const gfx::Rect& damage_rect) { DCHECK(device_); damage_rect_ = damage_rect; return canvas_.get(); @@ -42,14 +42,14 @@ void SoftwareOutputDevice::EndPaint(SoftwareFrameData* frame_data) { } void SoftwareOutputDevice::CopyToBitmap( - gfx::Rect rect, SkBitmap* output) { + const gfx::Rect& rect, SkBitmap* output) { DCHECK(device_); const SkBitmap& bitmap = device_->accessBitmap(false); bitmap.extractSubset(output, gfx::RectToSkIRect(rect)); } void SoftwareOutputDevice::Scroll( - gfx::Vector2d delta, gfx::Rect clip_rect) { + gfx::Vector2d delta, const gfx::Rect& clip_rect) { NOTIMPLEMENTED(); } diff --git a/cc/output/software_output_device.h b/cc/output/software_output_device.h index 4ecf1fe..e203902 100644 --- a/cc/output/software_output_device.h +++ b/cc/output/software_output_device.h @@ -42,7 +42,7 @@ class CC_EXPORT SoftwareOutputDevice { // SkCanvas. The |SoftwareOutputDevice| implementation needs to provide a // valid SkCanvas of at least size |damage_rect|. This class retains ownership // of the SkCanvas. - virtual SkCanvas* BeginPaint(gfx::Rect damage_rect); + virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect); // Called on FinishDrawingFrame. The compositor will no longer mutate the the // SkCanvas instance returned by |BeginPaint| and should discard any reference @@ -51,12 +51,12 @@ class CC_EXPORT SoftwareOutputDevice { // Copies pixels inside |rect| from the current software framebuffer to // |output|. Fails if there is no current softwareframebuffer. - virtual void CopyToBitmap(gfx::Rect rect, SkBitmap* output); + virtual void CopyToBitmap(const gfx::Rect& rect, SkBitmap* output); // Blit the pixel content of the SoftwareOutputDevice by |delta| with the // write clipped to |clip_rect|. virtual void Scroll(gfx::Vector2d delta, - gfx::Rect clip_rect); + const gfx::Rect& clip_rect); // Discard the backing buffer in the surface provided by this instance. virtual void DiscardBackbuffer() {} diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc index 84f6f1e..7a0593d 100644 --- a/cc/output/software_renderer.cc +++ b/cc/output/software_renderer.cc @@ -157,7 +157,7 @@ void SoftwareRenderer::BindFramebufferToOutputSurface(DrawingFrame* frame) { bool SoftwareRenderer::BindFramebufferToTexture( DrawingFrame* frame, const ScopedResource* texture, - gfx::Rect target_rect) { + const gfx::Rect& target_rect) { current_framebuffer_lock_.reset(); current_framebuffer_lock_ = make_scoped_ptr( new ResourceProvider::ScopedWriteLockSoftware( @@ -170,13 +170,13 @@ bool SoftwareRenderer::BindFramebufferToTexture( return true; } -void SoftwareRenderer::SetScissorTestRect(gfx::Rect scissor_rect) { +void SoftwareRenderer::SetScissorTestRect(const gfx::Rect& scissor_rect) { is_scissor_enabled_ = true; scissor_rect_ = scissor_rect; SetClipRect(scissor_rect); } -void SoftwareRenderer::SetClipRect(gfx::Rect rect) { +void SoftwareRenderer::SetClipRect(const gfx::Rect& rect) { // Skia applies the current matrix to clip rects so we reset it temporary. SkMatrix current_matrix = current_canvas_->getTotalMatrix(); current_canvas_->resetMatrix(); @@ -209,7 +209,8 @@ void SoftwareRenderer::ClearFramebuffer(DrawingFrame* frame, } } -void SoftwareRenderer::SetDrawViewport(gfx::Rect window_space_viewport) {} +void SoftwareRenderer::SetDrawViewport( + const gfx::Rect& window_space_viewport) {} bool SoftwareRenderer::IsSoftwareResource( ResourceProvider::ResourceId resource_id) const { @@ -587,14 +588,16 @@ void SoftwareRenderer::EnsureBackbuffer() { is_backbuffer_discarded_ = false; } -void SoftwareRenderer::GetFramebufferPixels(void* pixels, gfx::Rect rect) { +void SoftwareRenderer::GetFramebufferPixels(void* pixels, + const gfx::Rect& rect) { TRACE_EVENT0("cc", "SoftwareRenderer::GetFramebufferPixels"); SkBitmap subset_bitmap; - rect += current_viewport_rect_.OffsetFromOrigin(); - output_device_->CopyToBitmap(rect, &subset_bitmap); + gfx::Rect frame_rect(rect); + frame_rect += current_viewport_rect_.OffsetFromOrigin(); + output_device_->CopyToBitmap(frame_rect, &subset_bitmap); subset_bitmap.copyPixelsTo(pixels, - 4 * rect.width() * rect.height(), - 4 * rect.width()); + 4 * frame_rect.width() * frame_rect.height(), + 4 * frame_rect.width()); } void SoftwareRenderer::SetVisible(bool visible) { diff --git a/cc/output/software_renderer.h b/cc/output/software_renderer.h index 18fb2a3..1da90ee 100644 --- a/cc/output/software_renderer.h +++ b/cc/output/software_renderer.h @@ -37,7 +37,8 @@ class CC_EXPORT SoftwareRenderer : public DirectRenderer { virtual const RendererCapabilities& Capabilities() const OVERRIDE; virtual void Finish() OVERRIDE; virtual void SwapBuffers(const CompositorFrameMetadata& metadata) OVERRIDE; - virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; + virtual void GetFramebufferPixels(void* pixels, + const gfx::Rect& rect) OVERRIDE; virtual void SetVisible(bool visible) OVERRIDE; virtual void SendManagedMemoryStats( size_t bytes_visible, @@ -53,9 +54,9 @@ class CC_EXPORT SoftwareRenderer : public DirectRenderer { virtual bool BindFramebufferToTexture( DrawingFrame* frame, const ScopedResource* texture, - gfx::Rect target_rect) OVERRIDE; - virtual void SetDrawViewport(gfx::Rect window_space_viewport) OVERRIDE; - virtual void SetScissorTestRect(gfx::Rect scissor_rect) OVERRIDE; + const gfx::Rect& target_rect) OVERRIDE; + virtual void SetDrawViewport(const gfx::Rect& window_space_viewport) OVERRIDE; + virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) OVERRIDE; virtual void DiscardPixels(bool has_external_stencil_test, bool draw_rect_covers_full_surface) OVERRIDE; virtual void ClearFramebuffer(DrawingFrame* frame, @@ -77,7 +78,7 @@ class CC_EXPORT SoftwareRenderer : public DirectRenderer { private: void ClearCanvas(SkColor color); - void SetClipRect(gfx::Rect rect); + void SetClipRect(const gfx::Rect& rect); bool IsSoftwareResource(ResourceProvider::ResourceId resource_id) const; void DrawCheckerboardQuad(const DrawingFrame* frame, diff --git a/cc/quads/checkerboard_draw_quad.cc b/cc/quads/checkerboard_draw_quad.cc index 5e17d88..57f776d 100644 --- a/cc/quads/checkerboard_draw_quad.cc +++ b/cc/quads/checkerboard_draw_quad.cc @@ -16,7 +16,7 @@ scoped_ptr<CheckerboardDrawQuad> CheckerboardDrawQuad::Create() { } void CheckerboardDrawQuad::SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, + const gfx::Rect& rect, SkColor color) { gfx::Rect opaque_rect = SkColorGetA(color) == 255 ? rect : gfx::Rect(); gfx::Rect visible_rect = rect; @@ -27,9 +27,9 @@ void CheckerboardDrawQuad::SetNew(const SharedQuadState* shared_quad_state, } void CheckerboardDrawQuad::SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, SkColor color) { DrawQuad::SetAll(shared_quad_state, DrawQuad::CHECKERBOARD, rect, opaque_rect, diff --git a/cc/quads/checkerboard_draw_quad.h b/cc/quads/checkerboard_draw_quad.h index 4f7452eb..ffa016f 100644 --- a/cc/quads/checkerboard_draw_quad.h +++ b/cc/quads/checkerboard_draw_quad.h @@ -17,13 +17,13 @@ class CC_EXPORT CheckerboardDrawQuad : public DrawQuad { static scoped_ptr<CheckerboardDrawQuad> Create(); void SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, + const gfx::Rect& rect, SkColor color); void SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, SkColor color); diff --git a/cc/quads/content_draw_quad_base.cc b/cc/quads/content_draw_quad_base.cc index 947af0b..ca81cf4 100644 --- a/cc/quads/content_draw_quad_base.cc +++ b/cc/quads/content_draw_quad_base.cc @@ -19,8 +19,8 @@ ContentDrawQuadBase::~ContentDrawQuadBase() { void ContentDrawQuadBase::SetNew(const SharedQuadState* shared_quad_state, DrawQuad::Material material, - gfx::Rect rect, - gfx::Rect opaque_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, const gfx::RectF& tex_coord_rect, gfx::Size texture_size, bool swizzle_contents) { @@ -35,9 +35,9 @@ void ContentDrawQuadBase::SetNew(const SharedQuadState* shared_quad_state, void ContentDrawQuadBase::SetAll(const SharedQuadState* shared_quad_state, DrawQuad::Material material, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, const gfx::RectF& tex_coord_rect, gfx::Size texture_size, diff --git a/cc/quads/content_draw_quad_base.h b/cc/quads/content_draw_quad_base.h index cbf18ca..d07bd36 100644 --- a/cc/quads/content_draw_quad_base.h +++ b/cc/quads/content_draw_quad_base.h @@ -18,17 +18,17 @@ class CC_EXPORT ContentDrawQuadBase : public DrawQuad { public: void SetNew(const SharedQuadState* shared_quad_state, DrawQuad::Material material, - gfx::Rect rect, - gfx::Rect opaque_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, const gfx::RectF& tex_coord_rect, gfx::Size texture_size, bool swizzle_contents); void SetAll(const SharedQuadState* shared_quad_state, DrawQuad::Material material, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, const gfx::RectF& tex_coord_rect, gfx::Size texture_size, diff --git a/cc/quads/debug_border_draw_quad.cc b/cc/quads/debug_border_draw_quad.cc index 89ee8e0..dc79a22 100644 --- a/cc/quads/debug_border_draw_quad.cc +++ b/cc/quads/debug_border_draw_quad.cc @@ -19,7 +19,7 @@ scoped_ptr<DebugBorderDrawQuad> DebugBorderDrawQuad::Create() { } void DebugBorderDrawQuad::SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, + const gfx::Rect& rect, SkColor color, int width) { gfx::Rect opaque_rect; @@ -32,9 +32,9 @@ void DebugBorderDrawQuad::SetNew(const SharedQuadState* shared_quad_state, } void DebugBorderDrawQuad::SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, SkColor color, int width) { diff --git a/cc/quads/debug_border_draw_quad.h b/cc/quads/debug_border_draw_quad.h index 5b36951..bcdaff9 100644 --- a/cc/quads/debug_border_draw_quad.h +++ b/cc/quads/debug_border_draw_quad.h @@ -17,14 +17,14 @@ class CC_EXPORT DebugBorderDrawQuad : public DrawQuad { static scoped_ptr<DebugBorderDrawQuad> Create(); void SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, + const gfx::Rect& rect, SkColor color, int width); void SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, SkColor color, int width); diff --git a/cc/quads/draw_quad.cc b/cc/quads/draw_quad.cc index f3cd818..df19d5d 100644 --- a/cc/quads/draw_quad.cc +++ b/cc/quads/draw_quad.cc @@ -36,9 +36,9 @@ DrawQuad::DrawQuad() void DrawQuad::SetAll(const SharedQuadState* shared_quad_state, Material material, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending) { DCHECK(rect.Contains(visible_rect)) << "rect: " << rect.ToString() << " visible_rect: " diff --git a/cc/quads/draw_quad.h b/cc/quads/draw_quad.h index c3696d6..2f15bfd 100644 --- a/cc/quads/draw_quad.h +++ b/cc/quads/draw_quad.h @@ -131,9 +131,9 @@ class CC_EXPORT DrawQuad { void SetAll(const SharedQuadState* shared_quad_state, Material material, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending); virtual void ExtendValue(base::DictionaryValue* value) const = 0; }; diff --git a/cc/quads/io_surface_draw_quad.cc b/cc/quads/io_surface_draw_quad.cc index 2c986dd..a415d06 100644 --- a/cc/quads/io_surface_draw_quad.cc +++ b/cc/quads/io_surface_draw_quad.cc @@ -20,8 +20,8 @@ scoped_ptr<IOSurfaceDrawQuad> IOSurfaceDrawQuad::Create() { } void IOSurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, gfx::Size io_surface_size, unsigned io_surface_resource_id, Orientation orientation) { @@ -35,9 +35,9 @@ void IOSurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state, } void IOSurfaceDrawQuad::SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, gfx::Size io_surface_size, unsigned io_surface_resource_id, diff --git a/cc/quads/io_surface_draw_quad.h b/cc/quads/io_surface_draw_quad.h index fc8b501..c2307ce 100644 --- a/cc/quads/io_surface_draw_quad.h +++ b/cc/quads/io_surface_draw_quad.h @@ -22,16 +22,16 @@ class CC_EXPORT IOSurfaceDrawQuad : public DrawQuad { static scoped_ptr<IOSurfaceDrawQuad> Create(); void SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, gfx::Size io_surface_size, unsigned io_surface_resource_id, Orientation orientation); void SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, gfx::Size io_surface_size, unsigned io_surface_resource_id, diff --git a/cc/quads/picture_draw_quad.cc b/cc/quads/picture_draw_quad.cc index bdb12e6..f51b65b 100644 --- a/cc/quads/picture_draw_quad.cc +++ b/cc/quads/picture_draw_quad.cc @@ -21,12 +21,12 @@ scoped_ptr<PictureDrawQuad> PictureDrawQuad::Create() { } void PictureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, const gfx::RectF& tex_coord_rect, gfx::Size texture_size, ResourceFormat texture_format, - gfx::Rect content_rect, + const gfx::Rect& content_rect, float contents_scale, scoped_refptr<PicturePileImpl> picture_pile) { ContentDrawQuadBase::SetNew(shared_quad_state, @@ -44,14 +44,14 @@ void PictureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, } void PictureDrawQuad::SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, const gfx::RectF& tex_coord_rect, gfx::Size texture_size, ResourceFormat texture_format, - gfx::Rect content_rect, + const gfx::Rect& content_rect, float contents_scale, scoped_refptr<PicturePileImpl> picture_pile) { ContentDrawQuadBase::SetAll(shared_quad_state, diff --git a/cc/quads/picture_draw_quad.h b/cc/quads/picture_draw_quad.h index 9bea70b..8f72353 100644 --- a/cc/quads/picture_draw_quad.h +++ b/cc/quads/picture_draw_quad.h @@ -23,24 +23,24 @@ class CC_EXPORT PictureDrawQuad : public ContentDrawQuadBase { virtual ~PictureDrawQuad(); void SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, const gfx::RectF& tex_coord_rect, gfx::Size texture_size, ResourceFormat texture_format, - gfx::Rect content_rect, + const gfx::Rect& content_rect, float contents_scale, scoped_refptr<PicturePileImpl> picture_pile); void SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, const gfx::RectF& tex_coord_rect, gfx::Size texture_size, ResourceFormat texture_format, - gfx::Rect content_rect, + const gfx::Rect& content_rect, float contents_scale, scoped_refptr<PicturePileImpl> picture_pile); diff --git a/cc/quads/render_pass.cc b/cc/quads/render_pass.cc index 53cb837..cdf3b94 100644 --- a/cc/quads/render_pass.cc +++ b/cc/quads/render_pass.cc @@ -112,8 +112,8 @@ void RenderPass::CopyAll(const ScopedPtrVector<RenderPass>& in, } void RenderPass::SetNew(Id id, - gfx::Rect output_rect, - gfx::RectF damage_rect, + const gfx::Rect& output_rect, + const gfx::RectF& damage_rect, const gfx::Transform& transform_to_root_target) { DCHECK_GT(id.layer_id, 0); DCHECK_GE(id.index, 0); @@ -128,8 +128,8 @@ void RenderPass::SetNew(Id id, } void RenderPass::SetAll(Id id, - gfx::Rect output_rect, - gfx::RectF damage_rect, + const gfx::Rect& output_rect, + const gfx::RectF& damage_rect, const gfx::Transform& transform_to_root_target, bool has_transparent_background) { DCHECK_GT(id.layer_id, 0); diff --git a/cc/quads/render_pass.h b/cc/quads/render_pass.h index 407381f..4285e53 100644 --- a/cc/quads/render_pass.h +++ b/cc/quads/render_pass.h @@ -76,13 +76,13 @@ class CC_EXPORT RenderPass { ScopedPtrVector<RenderPass>* out); void SetNew(Id id, - gfx::Rect output_rect, - gfx::RectF damage_rect, + const gfx::Rect& output_rect, + const gfx::RectF& damage_rect, const gfx::Transform& transform_to_root_target); void SetAll(Id id, - gfx::Rect output_rect, - gfx::RectF damage_rect, + const gfx::Rect& output_rect, + const gfx::RectF& damage_rect, const gfx::Transform& transform_to_root_target, bool has_transparent_background); diff --git a/cc/quads/render_pass_draw_quad.cc b/cc/quads/render_pass_draw_quad.cc index af8cd8c..b26eaf9 100644 --- a/cc/quads/render_pass_draw_quad.cc +++ b/cc/quads/render_pass_draw_quad.cc @@ -36,12 +36,12 @@ scoped_ptr<RenderPassDrawQuad> RenderPassDrawQuad::Copy( void RenderPassDrawQuad::SetNew( const SharedQuadState* shared_quad_state, - gfx::Rect rect, + const gfx::Rect& rect, RenderPass::Id render_pass_id, bool is_replica, ResourceProvider::ResourceId mask_resource_id, - gfx::Rect contents_changed_since_last_frame, - gfx::RectF mask_uv_rect, + const gfx::Rect& contents_changed_since_last_frame, + const gfx::RectF& mask_uv_rect, const FilterOperations& filters, const FilterOperations& background_filters) { DCHECK_GT(render_pass_id.layer_id, 0); @@ -58,15 +58,15 @@ void RenderPassDrawQuad::SetNew( void RenderPassDrawQuad::SetAll( const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, RenderPass::Id render_pass_id, bool is_replica, ResourceProvider::ResourceId mask_resource_id, - gfx::Rect contents_changed_since_last_frame, - gfx::RectF mask_uv_rect, + const gfx::Rect& contents_changed_since_last_frame, + const gfx::RectF& mask_uv_rect, const FilterOperations& filters, const FilterOperations& background_filters) { DCHECK_GT(render_pass_id.layer_id, 0); diff --git a/cc/quads/render_pass_draw_quad.h b/cc/quads/render_pass_draw_quad.h index 8546c45..28b58db 100644 --- a/cc/quads/render_pass_draw_quad.h +++ b/cc/quads/render_pass_draw_quad.h @@ -21,25 +21,25 @@ class CC_EXPORT RenderPassDrawQuad : public DrawQuad { virtual ~RenderPassDrawQuad(); void SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, + const gfx::Rect& rect, RenderPass::Id render_pass_id, bool is_replica, ResourceProvider::ResourceId mask_resource_id, - gfx::Rect contents_changed_since_last_frame, - gfx::RectF mask_uv_rect, + const gfx::Rect& contents_changed_since_last_frame, + const gfx::RectF& mask_uv_rect, const FilterOperations& filters, const FilterOperations& background_filters); void SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, RenderPass::Id render_pass_id, bool is_replica, ResourceProvider::ResourceId mask_resource_id, - gfx::Rect contents_changed_since_last_frame, - gfx::RectF mask_uv_rect, + const gfx::Rect& contents_changed_since_last_frame, + const gfx::RectF& mask_uv_rect, const FilterOperations& filters, const FilterOperations& background_filters); diff --git a/cc/quads/shared_quad_state.cc b/cc/quads/shared_quad_state.cc index 56584577..66d0607 100644 --- a/cc/quads/shared_quad_state.cc +++ b/cc/quads/shared_quad_state.cc @@ -29,8 +29,8 @@ scoped_ptr<SharedQuadState> SharedQuadState::Copy() const { void SharedQuadState::SetAll(const gfx::Transform& content_to_target_transform, gfx::Size content_bounds, - gfx::Rect visible_content_rect, - gfx::Rect clip_rect, + const gfx::Rect& visible_content_rect, + const gfx::Rect& clip_rect, bool is_clipped, float opacity, SkXfermode::Mode blend_mode) { diff --git a/cc/quads/shared_quad_state.h b/cc/quads/shared_quad_state.h index b70d4a1..9098bfb 100644 --- a/cc/quads/shared_quad_state.h +++ b/cc/quads/shared_quad_state.h @@ -26,8 +26,8 @@ class CC_EXPORT SharedQuadState { void SetAll(const gfx::Transform& content_to_target_transform, gfx::Size content_bounds, - gfx::Rect visible_content_rect, - gfx::Rect clip_rect, + const gfx::Rect& visible_content_rect, + const gfx::Rect& clip_rect, bool is_clipped, float opacity, SkXfermode::Mode blend_mode); diff --git a/cc/quads/solid_color_draw_quad.cc b/cc/quads/solid_color_draw_quad.cc index ae3b914..d0b9ec8 100644 --- a/cc/quads/solid_color_draw_quad.cc +++ b/cc/quads/solid_color_draw_quad.cc @@ -17,7 +17,7 @@ scoped_ptr<SolidColorDrawQuad> SolidColorDrawQuad::Create() { } void SolidColorDrawQuad::SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, + const gfx::Rect& rect, SkColor color, bool force_anti_aliasing_off) { gfx::Rect opaque_rect = SkColorGetA(color) == 255 ? rect : gfx::Rect(); @@ -30,9 +30,9 @@ void SolidColorDrawQuad::SetNew(const SharedQuadState* shared_quad_state, } void SolidColorDrawQuad::SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, SkColor color, bool force_anti_aliasing_off) { diff --git a/cc/quads/solid_color_draw_quad.h b/cc/quads/solid_color_draw_quad.h index 2c41243..a13e8ee 100644 --- a/cc/quads/solid_color_draw_quad.h +++ b/cc/quads/solid_color_draw_quad.h @@ -17,14 +17,14 @@ class CC_EXPORT SolidColorDrawQuad : public DrawQuad { static scoped_ptr<SolidColorDrawQuad> Create(); void SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, + const gfx::Rect& rect, SkColor color, bool force_anti_aliasing_off); void SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, SkColor color, bool force_anti_aliasing_off); diff --git a/cc/quads/stream_video_draw_quad.cc b/cc/quads/stream_video_draw_quad.cc index c239256..0ae3962 100644 --- a/cc/quads/stream_video_draw_quad.cc +++ b/cc/quads/stream_video_draw_quad.cc @@ -17,8 +17,8 @@ scoped_ptr<StreamVideoDrawQuad> StreamVideoDrawQuad::Create() { } void StreamVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, unsigned resource_id, const gfx::Transform& matrix) { gfx::Rect visible_rect = rect; @@ -30,9 +30,9 @@ void StreamVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, } void StreamVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, unsigned resource_id, const gfx::Transform& matrix) { diff --git a/cc/quads/stream_video_draw_quad.h b/cc/quads/stream_video_draw_quad.h index e610f43..27a6765 100644 --- a/cc/quads/stream_video_draw_quad.h +++ b/cc/quads/stream_video_draw_quad.h @@ -17,15 +17,15 @@ class CC_EXPORT StreamVideoDrawQuad : public DrawQuad { static scoped_ptr<StreamVideoDrawQuad> Create(); void SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, unsigned resource_id, const gfx::Transform& matrix); void SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, unsigned resource_id, const gfx::Transform& matrix); diff --git a/cc/quads/texture_draw_quad.cc b/cc/quads/texture_draw_quad.cc index 244f479..8a713d4 100644 --- a/cc/quads/texture_draw_quad.cc +++ b/cc/quads/texture_draw_quad.cc @@ -27,7 +27,8 @@ scoped_ptr<TextureDrawQuad> TextureDrawQuad::Create() { } void TextureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, gfx::Rect opaque_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, unsigned resource_id, bool premultiplied_alpha, gfx::PointF uv_top_left, gfx::PointF uv_bottom_right, @@ -52,8 +53,9 @@ void TextureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, } void TextureDrawQuad::SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, gfx::Rect opaque_rect, - gfx::Rect visible_rect, bool needs_blending, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, unsigned resource_id, bool premultiplied_alpha, gfx::PointF uv_top_left, gfx::PointF uv_bottom_right, diff --git a/cc/quads/texture_draw_quad.h b/cc/quads/texture_draw_quad.h index 4aa4d7a..5104407 100644 --- a/cc/quads/texture_draw_quad.h +++ b/cc/quads/texture_draw_quad.h @@ -17,8 +17,8 @@ class CC_EXPORT TextureDrawQuad : public DrawQuad { static scoped_ptr<TextureDrawQuad> Create(); void SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, unsigned resource_id, bool premultiplied_alpha, gfx::PointF uv_top_left, @@ -28,9 +28,9 @@ class CC_EXPORT TextureDrawQuad : public DrawQuad { bool flipped); void SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, unsigned resource_id, bool premultiplied_alpha, diff --git a/cc/quads/tile_draw_quad.cc b/cc/quads/tile_draw_quad.cc index 3ff9809..60116cc 100644 --- a/cc/quads/tile_draw_quad.cc +++ b/cc/quads/tile_draw_quad.cc @@ -22,8 +22,8 @@ scoped_ptr<TileDrawQuad> TileDrawQuad::Create() { } void TileDrawQuad::SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, unsigned resource_id, const gfx::RectF& tex_coord_rect, gfx::Size texture_size, @@ -35,9 +35,9 @@ void TileDrawQuad::SetNew(const SharedQuadState* shared_quad_state, } void TileDrawQuad::SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, unsigned resource_id, const gfx::RectF& tex_coord_rect, diff --git a/cc/quads/tile_draw_quad.h b/cc/quads/tile_draw_quad.h index 6da1e54..f4053c5 100644 --- a/cc/quads/tile_draw_quad.h +++ b/cc/quads/tile_draw_quad.h @@ -15,17 +15,17 @@ class CC_EXPORT TileDrawQuad : public ContentDrawQuadBase { virtual ~TileDrawQuad(); void SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, unsigned resource_id, const gfx::RectF& tex_coord_rect, gfx::Size texture_size, bool swizzle_contents); void SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, unsigned resource_id, const gfx::RectF& tex_coord_rect, diff --git a/cc/quads/yuv_video_draw_quad.cc b/cc/quads/yuv_video_draw_quad.cc index ecdc78f..dc323e4 100644 --- a/cc/quads/yuv_video_draw_quad.cc +++ b/cc/quads/yuv_video_draw_quad.cc @@ -22,8 +22,8 @@ scoped_ptr<YUVVideoDrawQuad> YUVVideoDrawQuad::Create() { } void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, gfx::SizeF tex_scale, unsigned y_plane_resource_id, unsigned u_plane_resource_id, @@ -41,9 +41,9 @@ void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, } void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, gfx::SizeF tex_scale, unsigned y_plane_resource_id, diff --git a/cc/quads/yuv_video_draw_quad.h b/cc/quads/yuv_video_draw_quad.h index aa750fa..02d307f 100644 --- a/cc/quads/yuv_video_draw_quad.h +++ b/cc/quads/yuv_video_draw_quad.h @@ -20,8 +20,8 @@ class CC_EXPORT YUVVideoDrawQuad : public DrawQuad { static scoped_ptr<YUVVideoDrawQuad> Create(); void SetNew(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, gfx::SizeF tex_scale, unsigned y_plane_resource_id, unsigned u_plane_resource_id, @@ -29,9 +29,9 @@ class CC_EXPORT YUVVideoDrawQuad : public DrawQuad { unsigned a_plane_resource_id); void SetAll(const SharedQuadState* shared_quad_state, - gfx::Rect rect, - gfx::Rect opaque_rect, - gfx::Rect visible_rect, + const gfx::Rect& rect, + const gfx::Rect& opaque_rect, + const gfx::Rect& visible_rect, bool needs_blending, gfx::SizeF tex_scale, unsigned y_plane_resource_id, diff --git a/cc/resources/bitmap_content_layer_updater.cc b/cc/resources/bitmap_content_layer_updater.cc index f2af583..312b5a5 100644 --- a/cc/resources/bitmap_content_layer_updater.cc +++ b/cc/resources/bitmap_content_layer_updater.cc @@ -22,7 +22,7 @@ BitmapContentLayerUpdater::Resource::Resource( BitmapContentLayerUpdater::Resource::~Resource() {} void BitmapContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, - gfx::Rect source_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, bool partial_update) { updater_->UpdateTexture( @@ -54,7 +54,7 @@ scoped_ptr<LayerUpdater::Resource> BitmapContentLayerUpdater::CreateResource( } void BitmapContentLayerUpdater::PrepareToUpdate( - gfx::Rect content_rect, + const gfx::Rect& content_rect, gfx::Size tile_size, float contents_width_scale, float contents_height_scale, @@ -87,7 +87,7 @@ void BitmapContentLayerUpdater::PrepareToUpdate( void BitmapContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue, PrioritizedResource* texture, - gfx::Rect source_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, bool partial_update) { CHECK(canvas_); diff --git a/cc/resources/bitmap_content_layer_updater.h b/cc/resources/bitmap_content_layer_updater.h index f618655..d4909fa 100644 --- a/cc/resources/bitmap_content_layer_updater.h +++ b/cc/resources/bitmap_content_layer_updater.h @@ -30,7 +30,7 @@ class CC_EXPORT BitmapContentLayerUpdater : public ContentLayerUpdater { virtual ~Resource(); virtual void Update(ResourceUpdateQueue* queue, - gfx::Rect source_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, bool partial_update) OVERRIDE; @@ -47,14 +47,14 @@ class CC_EXPORT BitmapContentLayerUpdater : public ContentLayerUpdater { virtual scoped_ptr<LayerUpdater::Resource> CreateResource( PrioritizedResourceManager* manager) OVERRIDE; - virtual void PrepareToUpdate(gfx::Rect content_rect, + virtual void PrepareToUpdate(const gfx::Rect& content_rect, gfx::Size tile_size, float contents_width_scale, float contents_height_scale, gfx::Rect* resulting_opaque_rect) OVERRIDE; void UpdateTexture(ResourceUpdateQueue* queue, PrioritizedResource* resource, - gfx::Rect source_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, bool partial_update); virtual void SetOpaque(bool opaque) OVERRIDE; diff --git a/cc/resources/bitmap_skpicture_content_layer_updater.cc b/cc/resources/bitmap_skpicture_content_layer_updater.cc index cc839a6..0ca48b4 100644 --- a/cc/resources/bitmap_skpicture_content_layer_updater.cc +++ b/cc/resources/bitmap_skpicture_content_layer_updater.cc @@ -21,7 +21,7 @@ BitmapSkPictureContentLayerUpdater::Resource::Resource( void BitmapSkPictureContentLayerUpdater::Resource::Update( ResourceUpdateQueue* queue, - gfx::Rect source_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, bool partial_update) { bitmap_.setConfig( @@ -70,7 +70,7 @@ BitmapSkPictureContentLayerUpdater::CreateResource( void BitmapSkPictureContentLayerUpdater::PaintContentsRect( SkCanvas* canvas, - gfx::Rect source_rect) { + const gfx::Rect& source_rect) { // Translate the origin of content_rect to that of source_rect. canvas->translate(content_rect().x() - source_rect.x(), content_rect().y() - source_rect.y()); diff --git a/cc/resources/bitmap_skpicture_content_layer_updater.h b/cc/resources/bitmap_skpicture_content_layer_updater.h index e03f56d..6bdebcf 100644 --- a/cc/resources/bitmap_skpicture_content_layer_updater.h +++ b/cc/resources/bitmap_skpicture_content_layer_updater.h @@ -21,7 +21,7 @@ class BitmapSkPictureContentLayerUpdater : public SkPictureContentLayerUpdater { scoped_ptr<PrioritizedResource> texture); virtual void Update(ResourceUpdateQueue* queue, - gfx::Rect source_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, bool partial_update) OVERRIDE; @@ -40,7 +40,7 @@ class BitmapSkPictureContentLayerUpdater : public SkPictureContentLayerUpdater { virtual scoped_ptr<LayerUpdater::Resource> CreateResource( PrioritizedResourceManager* manager) OVERRIDE; void PaintContentsRect(SkCanvas* canvas, - gfx::Rect source_rect); + const gfx::Rect& source_rect); private: BitmapSkPictureContentLayerUpdater( diff --git a/cc/resources/image_layer_updater.cc b/cc/resources/image_layer_updater.cc index 470f518..e6900b7 100644 --- a/cc/resources/image_layer_updater.cc +++ b/cc/resources/image_layer_updater.cc @@ -15,7 +15,7 @@ ImageLayerUpdater::Resource::Resource(ImageLayerUpdater* updater, ImageLayerUpdater::Resource::~Resource() {} void ImageLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, - gfx::Rect source_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, bool partial_update) { updater_->UpdateTexture( @@ -35,7 +35,7 @@ scoped_ptr<LayerUpdater::Resource> ImageLayerUpdater::CreateResource( void ImageLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue, PrioritizedResource* texture, - gfx::Rect source_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, bool partial_update) { // Source rect should never go outside the image pixels, even if this diff --git a/cc/resources/image_layer_updater.h b/cc/resources/image_layer_updater.h index 44e541d..1b92a6f 100644 --- a/cc/resources/image_layer_updater.h +++ b/cc/resources/image_layer_updater.h @@ -22,7 +22,7 @@ class CC_EXPORT ImageLayerUpdater : public LayerUpdater { virtual ~Resource(); virtual void Update(ResourceUpdateQueue* queue, - gfx::Rect source_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, bool partial_update) OVERRIDE; @@ -39,7 +39,7 @@ class CC_EXPORT ImageLayerUpdater : public LayerUpdater { void UpdateTexture(ResourceUpdateQueue* queue, PrioritizedResource* texture, - gfx::Rect source_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, bool partial_update); diff --git a/cc/resources/layer_painter.h b/cc/resources/layer_painter.h index 89a1424..4cb2527 100644 --- a/cc/resources/layer_painter.h +++ b/cc/resources/layer_painter.h @@ -20,7 +20,7 @@ class CC_EXPORT LayerPainter { public: virtual ~LayerPainter() {} virtual void Paint(SkCanvas* canvas, - gfx::Rect content_rect, + const gfx::Rect& content_rect, gfx::RectF* opaque) = 0; }; diff --git a/cc/resources/layer_tiling_data.cc b/cc/resources/layer_tiling_data.cc index 6b33234..e9caf9b 100644 --- a/cc/resources/layer_tiling_data.cc +++ b/cc/resources/layer_tiling_data.cc @@ -66,7 +66,7 @@ LayerTilingData::Tile* LayerTilingData::TileAt(int i, int j) const { return tiles_.get(std::make_pair(i, j)); } -void LayerTilingData::ContentRectToTileIndices(gfx::Rect content_rect, +void LayerTilingData::ContentRectToTileIndices(const gfx::Rect& content_rect, int* left, int* top, int* right, @@ -90,7 +90,7 @@ gfx::Rect LayerTilingData::TileRect(const Tile* tile) const { } Region LayerTilingData::OpaqueRegionInContentRect( - gfx::Rect content_rect) const { + const gfx::Rect& content_rect) const { if (content_rect.IsEmpty()) return Region(); diff --git a/cc/resources/layer_tiling_data.h b/cc/resources/layer_tiling_data.h index c5c9a74..500c753 100644 --- a/cc/resources/layer_tiling_data.h +++ b/cc/resources/layer_tiling_data.h @@ -64,7 +64,9 @@ class CC_EXPORT LayerTilingData { } gfx::Rect opaque_rect() const { return opaque_rect_; } - void set_opaque_rect(gfx::Rect opaque_rect) { opaque_rect_ = opaque_rect; } + void set_opaque_rect(const gfx::Rect& opaque_rect) { + opaque_rect_ = opaque_rect; + } private: int i_; int j_; @@ -82,14 +84,14 @@ class CC_EXPORT LayerTilingData { void SetBounds(gfx::Size size); gfx::Size bounds() const { return tiling_data_.total_size(); } - void ContentRectToTileIndices(gfx::Rect rect, + void ContentRectToTileIndices(const gfx::Rect& rect, int* left, int* top, int* right, int* bottom) const; gfx::Rect TileRect(const Tile* tile) const; - Region OpaqueRegionInContentRect(gfx::Rect rect) const; + Region OpaqueRegionInContentRect(const gfx::Rect& rect) const; void reset() { tiles_.clear(); } diff --git a/cc/resources/layer_updater.h b/cc/resources/layer_updater.h index 5d8eb89..730773f 100644 --- a/cc/resources/layer_updater.h +++ b/cc/resources/layer_updater.h @@ -29,7 +29,7 @@ class CC_EXPORT LayerUpdater : public base::RefCounted<LayerUpdater> { // TODO(reveman): partial_update should be a property of this class // instead of an argument passed to Update(). virtual void Update(ResourceUpdateQueue* queue, - gfx::Rect source_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, bool partial_update) = 0; protected: @@ -48,7 +48,7 @@ class CC_EXPORT LayerUpdater : public base::RefCounted<LayerUpdater> { // The |resulting_opaque_rect| gives back a region of the layer that was // painted opaque. If the layer is marked opaque in the updater, then this // region should be ignored in preference for the entire layer's area. - virtual void PrepareToUpdate(gfx::Rect content_rect, + virtual void PrepareToUpdate(const gfx::Rect& content_rect, gfx::Size tile_size, float contents_width_scale, float contents_height_scale, diff --git a/cc/resources/picture.cc b/cc/resources/picture.cc index f01772b..bfb905f 100644 --- a/cc/resources/picture.cc +++ b/cc/resources/picture.cc @@ -81,11 +81,11 @@ bool DecodeBitmap(const void* buffer, size_t size, SkBitmap* bm) { } // namespace -scoped_refptr<Picture> Picture::Create(gfx::Rect layer_rect) { +scoped_refptr<Picture> Picture::Create(const gfx::Rect& layer_rect) { return make_scoped_refptr(new Picture(layer_rect)); } -Picture::Picture(gfx::Rect layer_rect) +Picture::Picture(const gfx::Rect& layer_rect) : layer_rect_(layer_rect), cell_size_(layer_rect.size()) { // Instead of recording a trace event for object creation here, we wait for @@ -152,8 +152,8 @@ scoped_refptr<Picture> Picture::CreateFromValue(const base::Value* raw_value) { } Picture::Picture(SkPicture* picture, - gfx::Rect layer_rect, - gfx::Rect opaque_rect) : + const gfx::Rect& layer_rect, + const gfx::Rect& opaque_rect) : layer_rect_(layer_rect), opaque_rect_(opaque_rect), picture_(skia::AdoptRef(picture)), @@ -161,8 +161,8 @@ Picture::Picture(SkPicture* picture, } Picture::Picture(const skia::RefPtr<SkPicture>& picture, - gfx::Rect layer_rect, - gfx::Rect opaque_rect, + const gfx::Rect& layer_rect, + const gfx::Rect& opaque_rect, const PixelRefMap& pixel_refs) : layer_rect_(layer_rect), opaque_rect_(opaque_rect), @@ -385,7 +385,7 @@ Picture::PixelRefIterator::PixelRefIterator() } Picture::PixelRefIterator::PixelRefIterator( - gfx::Rect query_rect, + const gfx::Rect& rect, const Picture* picture) : picture_(picture), current_pixel_refs_(empty_pixel_refs_.Pointer()), @@ -394,6 +394,7 @@ Picture::PixelRefIterator::PixelRefIterator( gfx::Size cell_size = picture->cell_size_; DCHECK(!cell_size.IsEmpty()); + gfx::Rect query_rect(rect); // Early out if the query rect doesn't intersect this picture. if (!query_rect.Intersects(layer_rect)) { min_point_ = gfx::Point(0, 0); diff --git a/cc/resources/picture.h b/cc/resources/picture.h index 9facb43..92afccd 100644 --- a/cc/resources/picture.h +++ b/cc/resources/picture.h @@ -43,7 +43,7 @@ class CC_EXPORT Picture typedef std::vector<SkPixelRef*> PixelRefs; typedef base::hash_map<PixelRefMapKey, PixelRefs> PixelRefMap; - static scoped_refptr<Picture> Create(gfx::Rect layer_rect); + static scoped_refptr<Picture> Create(const gfx::Rect& layer_rect); static scoped_refptr<Picture> CreateFromValue(const base::Value* value); static scoped_refptr<Picture> CreateFromSkpValue(const base::Value* value); @@ -84,7 +84,7 @@ class CC_EXPORT Picture class CC_EXPORT PixelRefIterator { public: PixelRefIterator(); - PixelRefIterator(gfx::Rect layer_rect, const Picture* picture); + PixelRefIterator(const gfx::Rect& layer_rect, const Picture* picture); ~PixelRefIterator(); SkPixelRef* operator->() const { @@ -120,17 +120,17 @@ class CC_EXPORT Picture bool WillPlayBackBitmaps() const { return picture_->willPlayBackBitmaps(); } private: - explicit Picture(gfx::Rect layer_rect); + explicit Picture(const gfx::Rect& layer_rect); // This constructor assumes SkPicture is already ref'd and transfers // ownership to this picture. Picture(const skia::RefPtr<SkPicture>&, - gfx::Rect layer_rect, - gfx::Rect opaque_rect, + const gfx::Rect& layer_rect, + const gfx::Rect& opaque_rect, const PixelRefMap& pixel_refs); // This constructor will call AdoptRef on the SkPicture. Picture(SkPicture*, - gfx::Rect layer_rect, - gfx::Rect opaque_rect); + const gfx::Rect& layer_rect, + const gfx::Rect& opaque_rect); ~Picture(); gfx::Rect layer_rect_; diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc index 1aa3567..5304127 100644 --- a/cc/resources/picture_layer_tiling.cc +++ b/cc/resources/picture_layer_tiling.cc @@ -102,7 +102,7 @@ void PictureLayerTiling::CreateTile(int i, } Region PictureLayerTiling::OpaqueRegionInContentRect( - gfx::Rect content_rect) const { + const gfx::Rect& content_rect) const { Region opaque_region; // TODO(enne): implement me return opaque_region; @@ -195,7 +195,7 @@ PictureLayerTiling::CoverageIterator::CoverageIterator() PictureLayerTiling::CoverageIterator::CoverageIterator( const PictureLayerTiling* tiling, float dest_scale, - gfx::Rect dest_rect) + const gfx::Rect& dest_rect) : tiling_(tiling), dest_rect_(dest_rect), dest_to_content_scale_(0), @@ -342,8 +342,8 @@ void PictureLayerTiling::Reset() { void PictureLayerTiling::UpdateTilePriorities( WhichTree tree, gfx::Size device_viewport, - gfx::Rect viewport_in_layer_space, - gfx::Rect visible_layer_rect, + const gfx::Rect& viewport_in_layer_space, + const gfx::Rect& visible_layer_rect, gfx::Size last_layer_bounds, gfx::Size current_layer_bounds, float last_layer_contents_scale, @@ -559,7 +559,7 @@ void PictureLayerTiling::UpdateTilePriorities( } void PictureLayerTiling::SetLiveTilesRect( - gfx::Rect new_live_tiles_rect) { + const gfx::Rect& new_live_tiles_rect) { DCHECK(new_live_tiles_rect.IsEmpty() || ContentRect().Contains(new_live_tiles_rect)); if (live_tiles_rect_ == new_live_tiles_rect) @@ -676,9 +676,9 @@ int ComputeExpansionDelta(int num_x_edges, int num_y_edges, } // namespace gfx::Rect PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( - gfx::Rect starting_rect, + const gfx::Rect& starting_rect, int64 target_area, - gfx::Rect bounding_rect, + const gfx::Rect& bounding_rect, RectExpansionCache* cache) { if (starting_rect.IsEmpty()) return starting_rect; diff --git a/cc/resources/picture_layer_tiling.h b/cc/resources/picture_layer_tiling.h index dae6272..0c194be 100644 --- a/cc/resources/picture_layer_tiling.h +++ b/cc/resources/picture_layer_tiling.h @@ -28,7 +28,7 @@ class CC_EXPORT PictureLayerTilingClient { // tiling) This might return null if the client cannot create such a tile. virtual scoped_refptr<Tile> CreateTile( PictureLayerTiling* tiling, - gfx::Rect content_rect) = 0; + const gfx::Rect& content_rect) = 0; virtual void UpdatePile(Tile* tile) = 0; virtual gfx::Size CalculateTileSize( gfx::Size content_bounds) const = 0; @@ -89,7 +89,7 @@ class CC_EXPORT PictureLayerTiling { CoverageIterator(); CoverageIterator(const PictureLayerTiling* tiling, float dest_scale, - gfx::Rect rect); + const gfx::Rect& rect); ~CoverageIterator(); // Visible rect (no borders), always in the space of content_rect, @@ -129,15 +129,15 @@ class CC_EXPORT PictureLayerTiling { friend class PictureLayerTiling; }; - Region OpaqueRegionInContentRect(gfx::Rect content_rect) const; + Region OpaqueRegionInContentRect(const gfx::Rect& content_rect) const; void Reset(); void UpdateTilePriorities( WhichTree tree, gfx::Size device_viewport, - gfx::Rect viewport_in_layer_space, - gfx::Rect visible_layer_rect, + const gfx::Rect& viewport_in_layer_space, + const gfx::Rect& visible_layer_rect, gfx::Size last_layer_bounds, gfx::Size current_layer_bounds, float last_layer_contents_scale, @@ -179,9 +179,9 @@ class CC_EXPORT PictureLayerTiling { static gfx::Rect ExpandRectEquallyToAreaBoundedBy( - gfx::Rect starting_rect, + const gfx::Rect& starting_rect, int64 target_area, - gfx::Rect bounding_rect, + const gfx::Rect& bounding_rect, RectExpansionCache* cache); bool has_ever_been_updated() const { @@ -195,7 +195,7 @@ class CC_EXPORT PictureLayerTiling { PictureLayerTiling(float contents_scale, gfx::Size layer_bounds, PictureLayerTilingClient* client); - void SetLiveTilesRect(gfx::Rect live_tiles_rect); + void SetLiveTilesRect(const gfx::Rect& live_tiles_rect); void CreateTile(int i, int j, const PictureLayerTiling* twin_tiling); // Given properties. diff --git a/cc/resources/picture_layer_tiling_set.cc b/cc/resources/picture_layer_tiling_set.cc index 5ad2650..2047c3a 100644 --- a/cc/resources/picture_layer_tiling_set.cc +++ b/cc/resources/picture_layer_tiling_set.cc @@ -147,7 +147,7 @@ void PictureLayerTilingSet::RemoveAllTiles() { PictureLayerTilingSet::CoverageIterator::CoverageIterator( const PictureLayerTilingSet* set, float contents_scale, - gfx::Rect content_rect, + const gfx::Rect& content_rect, float ideal_contents_scale) : set_(set), contents_scale_(contents_scale), @@ -304,8 +304,8 @@ PictureLayerTilingSet::CoverageIterator::operator bool() const { void PictureLayerTilingSet::UpdateTilePriorities( WhichTree tree, gfx::Size device_viewport, - gfx::Rect viewport_in_content_space, - gfx::Rect visible_content_rect, + const gfx::Rect& viewport_in_content_space, + const gfx::Rect& visible_content_rect, gfx::Size last_layer_bounds, gfx::Size current_layer_bounds, float last_layer_contents_scale, diff --git a/cc/resources/picture_layer_tiling_set.h b/cc/resources/picture_layer_tiling_set.h index 29e6bf4..fe19d76 100644 --- a/cc/resources/picture_layer_tiling_set.h +++ b/cc/resources/picture_layer_tiling_set.h @@ -57,8 +57,8 @@ class CC_EXPORT PictureLayerTilingSet { void UpdateTilePriorities( WhichTree tree, gfx::Size device_viewport, - gfx::Rect viewport_in_content_space, - gfx::Rect visible_content_rect, + const gfx::Rect& viewport_in_content_space, + const gfx::Rect& visible_content_rect, gfx::Size last_layer_bounds, gfx::Size current_layer_bounds, float last_layer_contents_scale, @@ -80,7 +80,7 @@ class CC_EXPORT PictureLayerTilingSet { public: CoverageIterator(const PictureLayerTilingSet* set, float contents_scale, - gfx::Rect content_rect, + const gfx::Rect& content_rect, float ideal_contents_scale); ~CoverageIterator(); diff --git a/cc/resources/picture_layer_tiling_unittest.cc b/cc/resources/picture_layer_tiling_unittest.cc index 6adc611..002e9aad 100644 --- a/cc/resources/picture_layer_tiling_unittest.cc +++ b/cc/resources/picture_layer_tiling_unittest.cc @@ -66,7 +66,7 @@ class PictureLayerTilingIteratorTest : public testing::Test { &client_); } - void SetLiveRectAndVerifyTiles(gfx::Rect live_tiles_rect) { + void SetLiveRectAndVerifyTiles(const gfx::Rect& live_tiles_rect) { tiling_->SetLiveTilesRect(live_tiles_rect); std::vector<Tile*> tiles = tiling_->AllTilesForTesting(); @@ -79,8 +79,8 @@ class PictureLayerTilingIteratorTest : public testing::Test { void VerifyTilesExactlyCoverRect( float rect_scale, - gfx::Rect request_rect, - gfx::Rect expect_rect) { + const gfx::Rect& request_rect, + const gfx::Rect& expect_rect) { EXPECT_TRUE(request_rect.Contains(expect_rect)); // Iterators are not valid if this ratio is too large (i.e. the @@ -115,14 +115,15 @@ class PictureLayerTilingIteratorTest : public testing::Test { EXPECT_TRUE(remaining.IsEmpty()); } - void VerifyTilesExactlyCoverRect(float rect_scale, gfx::Rect rect) { + void VerifyTilesExactlyCoverRect(float rect_scale, const gfx::Rect& rect) { VerifyTilesExactlyCoverRect(rect_scale, rect, rect); } void VerifyTiles( float rect_scale, - gfx::Rect rect, - base::Callback<void(Tile* tile, gfx::Rect geometry_rect)> callback) { + const gfx::Rect& rect, + base::Callback<void(Tile* tile, + const gfx::Rect& geometry_rect)> callback) { VerifyTiles(tiling_.get(), rect_scale, rect, @@ -132,8 +133,9 @@ class PictureLayerTilingIteratorTest : public testing::Test { void VerifyTiles( PictureLayerTiling* tiling, float rect_scale, - gfx::Rect rect, - base::Callback<void(Tile* tile, gfx::Rect geometry_rect)> callback) { + const gfx::Rect& rect, + base::Callback<void(Tile* tile, + const gfx::Rect& geometry_rect)> callback) { Region remaining = rect; for (PictureLayerTiling::CoverageIterator iter(tiling, rect_scale, rect); iter; @@ -144,7 +146,8 @@ class PictureLayerTilingIteratorTest : public testing::Test { EXPECT_TRUE(remaining.IsEmpty()); } - void VerifyTilesCoverNonContainedRect(float rect_scale, gfx::Rect dest_rect) { + void VerifyTilesCoverNonContainedRect(float rect_scale, + const gfx::Rect& dest_rect) { float dest_to_contents_scale = tiling_->contents_scale() / rect_scale; gfx::Rect clamped_rect = gfx::ScaleToEnclosingRect( tiling_->ContentRect(), 1.f / dest_to_contents_scale); @@ -479,7 +482,8 @@ TEST(PictureLayerTilingTest, EmptyStartingRect) { EXPECT_TRUE(out.IsEmpty()); } -static void TileExists(bool exists, Tile* tile, gfx::Rect geometry_rect) { +static void TileExists(bool exists, Tile* tile, + const gfx::Rect& geometry_rect) { EXPECT_EQ(exists, tile != NULL) << geometry_rect.ToString(); } @@ -588,10 +592,10 @@ TEST_F(PictureLayerTilingIteratorTest, TilesExistOutsideViewport) { VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true)); } -static void TilesIntersectingRectExist(gfx::Rect rect, +static void TilesIntersectingRectExist(const gfx::Rect& rect, bool intersect_exists, Tile* tile, - gfx::Rect geometry_rect) { + const gfx::Rect& geometry_rect) { bool intersects = rect.Intersects(geometry_rect); bool expected_exists = intersect_exists ? intersects : !intersects; EXPECT_EQ(expected_exists, tile != NULL) @@ -628,7 +632,7 @@ TEST_F(PictureLayerTilingIteratorTest, static void CountExistingTiles(int *count, Tile* tile, - gfx::Rect geometry_rect) { + const gfx::Rect& geometry_rect) { if (tile != NULL) ++(*count); } diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc index 68d75d7..d5c7715 100644 --- a/cc/resources/picture_pile.cc +++ b/cc/resources/picture_pile.cc @@ -151,7 +151,7 @@ bool PicturePile::Update( SkColor background_color, bool contents_opaque, const Region& invalidation, - gfx::Rect visible_layer_rect, + const gfx::Rect& visible_layer_rect, int frame_number, RenderingStatsInstrumentation* stats_instrumentation) { background_color_ = background_color; diff --git a/cc/resources/picture_pile.h b/cc/resources/picture_pile.h index 7860e7f..c7df1d9 100644 --- a/cc/resources/picture_pile.h +++ b/cc/resources/picture_pile.h @@ -25,7 +25,7 @@ class CC_EXPORT PicturePile : public PicturePileBase { SkColor background_color, bool contents_opaque, const Region& invalidation, - gfx::Rect visible_layer_rect, + const gfx::Rect& visible_layer_rect, int frame_number, RenderingStatsInstrumentation* stats_instrumentation); diff --git a/cc/resources/picture_pile_base.cc b/cc/resources/picture_pile_base.cc index 7d60dca..03f4210 100644 --- a/cc/resources/picture_pile_base.cc +++ b/cc/resources/picture_pile_base.cc @@ -188,7 +188,8 @@ bool PicturePileBase::HasRecordingAt(int x, int y) { return !!found->second.GetPicture(); } -bool PicturePileBase::CanRaster(float contents_scale, gfx::Rect content_rect) { +bool PicturePileBase::CanRaster(float contents_scale, + const gfx::Rect& content_rect) { if (tiling_.total_size().IsEmpty()) return false; gfx::Rect layer_rect = gfx::ScaleToEnclosingRect( @@ -202,7 +203,7 @@ gfx::Rect PicturePileBase::PaddedRect(const PictureMapKey& key) { return PadRect(tile); } -gfx::Rect PicturePileBase::PadRect(gfx::Rect rect) { +gfx::Rect PicturePileBase::PadRect(const gfx::Rect& rect) { gfx::Rect padded_rect = rect; padded_rect.Inset( -buffer_pixels(), -buffer_pixels(), -buffer_pixels(), -buffer_pixels()); diff --git a/cc/resources/picture_pile_base.h b/cc/resources/picture_pile_base.h index 274c865..e893427 100644 --- a/cc/resources/picture_pile_base.h +++ b/cc/resources/picture_pile_base.h @@ -40,7 +40,7 @@ class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> { int num_tiles_y() const { return tiling_.num_tiles_y(); } gfx::Rect tile_bounds(int x, int y) const { return tiling_.TileBounds(x, y); } bool HasRecordingAt(int x, int y); - bool CanRaster(float contents_scale, gfx::Rect content_rect); + bool CanRaster(float contents_scale, const gfx::Rect& content_rect); static void ComputeTileGridInfo(gfx::Size tile_grid_size, SkTileGridPicture::TileGridInfo* info); @@ -93,7 +93,7 @@ class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> { void Clear(); gfx::Rect PaddedRect(const PictureMapKey& key); - gfx::Rect PadRect(gfx::Rect rect); + gfx::Rect PadRect(const gfx::Rect& rect); // A picture pile is a tiled set of pictures. The picture map is a map of tile // indices to picture infos. diff --git a/cc/resources/picture_pile_impl.cc b/cc/resources/picture_pile_impl.cc index b6f4d77..e553168 100644 --- a/cc/resources/picture_pile_impl.cc +++ b/cc/resources/picture_pile_impl.cc @@ -70,7 +70,7 @@ PicturePileImpl* PicturePileImpl::GetCloneForDrawingOnThread( void PicturePileImpl::RasterDirect( SkCanvas* canvas, - gfx::Rect canvas_rect, + const gfx::Rect& canvas_rect, float contents_scale, RenderingStatsInstrumentation* rendering_stats_instrumentation) { RasterCommon(canvas, @@ -83,7 +83,7 @@ void PicturePileImpl::RasterDirect( void PicturePileImpl::RasterForAnalysis( skia::AnalysisCanvas* canvas, - gfx::Rect canvas_rect, + const gfx::Rect& canvas_rect, float contents_scale, RenderingStatsInstrumentation* stats_instrumentation) { RasterCommon( @@ -92,7 +92,7 @@ void PicturePileImpl::RasterForAnalysis( void PicturePileImpl::RasterToBitmap( SkCanvas* canvas, - gfx::Rect canvas_rect, + const gfx::Rect& canvas_rect, float contents_scale, RenderingStatsInstrumentation* rendering_stats_instrumentation) { if (clear_canvas_with_debug_color_) { @@ -145,8 +145,8 @@ void PicturePileImpl::RasterToBitmap( false); } -void PicturePileImpl::CoalesceRasters(gfx::Rect canvas_rect, - gfx::Rect content_rect, +void PicturePileImpl::CoalesceRasters(const gfx::Rect& canvas_rect, + const gfx::Rect& content_rect, float contents_scale, PictureRegionMap* results) { DCHECK(results); @@ -207,7 +207,7 @@ void PicturePileImpl::CoalesceRasters(gfx::Rect canvas_rect, void PicturePileImpl::RasterCommon( SkCanvas* canvas, SkDrawPictureCallback* callback, - gfx::Rect canvas_rect, + const gfx::Rect& canvas_rect, float contents_scale, RenderingStatsInstrumentation* rendering_stats_instrumentation, bool is_analysis) { @@ -309,14 +309,14 @@ skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { } void PicturePileImpl::AnalyzeInRect( - gfx::Rect content_rect, + const gfx::Rect& content_rect, float contents_scale, PicturePileImpl::Analysis* analysis) { AnalyzeInRect(content_rect, contents_scale, analysis, NULL); } void PicturePileImpl::AnalyzeInRect( - gfx::Rect content_rect, + const gfx::Rect& content_rect, float contents_scale, PicturePileImpl::Analysis* analysis, RenderingStatsInstrumentation* stats_instrumentation) { @@ -350,7 +350,7 @@ PicturePileImpl::Analysis::~Analysis() { } PicturePileImpl::PixelRefIterator::PixelRefIterator( - gfx::Rect content_rect, + const gfx::Rect& content_rect, float contents_scale, const PicturePileImpl* picture_pile) : picture_pile_(picture_pile), diff --git a/cc/resources/picture_pile_impl.h b/cc/resources/picture_pile_impl.h index 2bc9da8..54a6988 100644 --- a/cc/resources/picture_pile_impl.h +++ b/cc/resources/picture_pile_impl.h @@ -39,7 +39,7 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase { // measured value over all runs. void RasterDirect( SkCanvas* canvas, - gfx::Rect canvas_rect, + const gfx::Rect& canvas_rect, float contents_scale, RenderingStatsInstrumentation* rendering_stats_instrumentation); @@ -48,7 +48,7 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase { // that itself will then be blended and thus that a canvas clear is required. void RasterToBitmap( SkCanvas* canvas, - gfx::Rect canvas_rect, + const gfx::Rect& canvas_rect, float contents_scale, RenderingStatsInstrumentation* stats_instrumentation); @@ -56,7 +56,7 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase { // SkDrawPictureCallback, which allows us to early out from analysis. void RasterForAnalysis( skia::AnalysisCanvas* canvas, - gfx::Rect canvas_rect, + const gfx::Rect& canvas_rect, float contents_scale, RenderingStatsInstrumentation* stats_instrumentation); @@ -71,18 +71,18 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase { SkColor solid_color; }; - void AnalyzeInRect(gfx::Rect content_rect, + void AnalyzeInRect(const gfx::Rect& content_rect, float contents_scale, Analysis* analysis); - void AnalyzeInRect(gfx::Rect content_rect, + void AnalyzeInRect(const gfx::Rect& content_rect, float contents_scale, Analysis* analysis, RenderingStatsInstrumentation* stats_instrumentation); class CC_EXPORT PixelRefIterator { public: - PixelRefIterator(gfx::Rect content_rect, + PixelRefIterator(const gfx::Rect& content_rect, float contents_scale, const PicturePileImpl* picture_pile); ~PixelRefIterator(); @@ -129,15 +129,15 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase { private: typedef std::map<Picture*, Region> PictureRegionMap; - void CoalesceRasters(gfx::Rect canvas_rect, - gfx::Rect content_rect, + void CoalesceRasters(const gfx::Rect& canvas_rect, + const gfx::Rect& content_rect, float contents_scale, PictureRegionMap* result); void RasterCommon( SkCanvas* canvas, SkDrawPictureCallback* callback, - gfx::Rect canvas_rect, + const gfx::Rect& canvas_rect, float contents_scale, RenderingStatsInstrumentation* rendering_stats_instrumentation, bool is_analysis); diff --git a/cc/resources/prioritized_resource.cc b/cc/resources/prioritized_resource.cc index f62ee40..25415f5 100644 --- a/cc/resources/prioritized_resource.cc +++ b/cc/resources/prioritized_resource.cc @@ -76,8 +76,8 @@ void PrioritizedResource::AcquireBackingTexture( void PrioritizedResource::SetPixels(ResourceProvider* resource_provider, const uint8_t* image, - gfx::Rect image_rect, - gfx::Rect source_rect, + const gfx::Rect& image_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset) { DCHECK(is_above_priority_cutoff_); if (is_above_priority_cutoff_) diff --git a/cc/resources/prioritized_resource.h b/cc/resources/prioritized_resource.h index ee90024..641782e 100644 --- a/cc/resources/prioritized_resource.h +++ b/cc/resources/prioritized_resource.h @@ -79,8 +79,8 @@ class CC_EXPORT PrioritizedResource { // the backing if needed. void SetPixels(ResourceProvider* resource_provider, const uint8_t* image, - gfx::Rect image_rect, - gfx::Rect source_rect, + const gfx::Rect& image_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset); ResourceProvider::ResourceId resource_id() const { diff --git a/cc/resources/priority_calculator.cc b/cc/resources/priority_calculator.cc index fe5741c..2a0cd18 100644 --- a/cc/resources/priority_calculator.cc +++ b/cc/resources/priority_calculator.cc @@ -69,8 +69,8 @@ int PriorityCalculator::LingeringPriority(int previous_priority) { } // static -int PriorityCalculator::PriorityFromDistance(gfx::Rect visible_rect, - gfx::Rect texture_rect, +int PriorityCalculator::PriorityFromDistance(const gfx::Rect& visible_rect, + const gfx::Rect& texture_rect, bool draws_to_root_surface) { int distance = visible_rect.ManhattanInternalDistance(texture_rect); if (!distance) diff --git a/cc/resources/priority_calculator.h b/cc/resources/priority_calculator.h index 8778961..502bd27 100644 --- a/cc/resources/priority_calculator.h +++ b/cc/resources/priority_calculator.h @@ -20,8 +20,8 @@ class CC_EXPORT PriorityCalculator { static int VisiblePriority(bool draws_to_root_surface); static int RenderSurfacePriority(); static int LingeringPriority(int previous_priority); - static int PriorityFromDistance(gfx::Rect visible_rect, - gfx::Rect texture_rect, + static int PriorityFromDistance(const gfx::Rect& visible_rect, + const gfx::Rect& texture_rect, bool draws_to_root_surface); static int SmallAnimatedLayerMinPriority(); diff --git a/cc/resources/raster_worker_pool.cc b/cc/resources/raster_worker_pool.cc index 1b2f950..d6f0507 100644 --- a/cc/resources/raster_worker_pool.cc +++ b/cc/resources/raster_worker_pool.cc @@ -66,7 +66,7 @@ class RasterWorkerPoolTaskImpl : public internal::RasterWorkerPoolTask { public: RasterWorkerPoolTaskImpl(const Resource* resource, PicturePileImpl* picture_pile, - gfx::Rect content_rect, + const gfx::Rect& content_rect, float contents_scale, RasterMode raster_mode, TileResolution tile_resolution, @@ -518,7 +518,7 @@ RasterWorkerPool::RasterTask::~RasterTask() { RasterWorkerPool::RasterTask RasterWorkerPool::CreateRasterTask( const Resource* resource, PicturePileImpl* picture_pile, - gfx::Rect content_rect, + const gfx::Rect& content_rect, float contents_scale, RasterMode raster_mode, TileResolution tile_resolution, diff --git a/cc/resources/raster_worker_pool.h b/cc/resources/raster_worker_pool.h index b2cbee3..07d47d7 100644 --- a/cc/resources/raster_worker_pool.h +++ b/cc/resources/raster_worker_pool.h @@ -200,7 +200,7 @@ class CC_EXPORT RasterWorkerPool : public WorkerPool { static RasterTask CreateRasterTask( const Resource* resource, PicturePileImpl* picture_pile, - gfx::Rect content_rect, + const gfx::Rect& content_rect, float contents_scale, RasterMode raster_mode, TileResolution tile_resolution, diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc index 3973fb8..464d0a9 100644 --- a/cc/resources/resource_provider.cc +++ b/cc/resources/resource_provider.cc @@ -584,8 +584,8 @@ ResourceProvider::ResourceType ResourceProvider::GetResourceType( void ResourceProvider::SetPixels(ResourceId id, const uint8_t* image, - gfx::Rect image_rect, - gfx::Rect source_rect, + const gfx::Rect& image_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset) { Resource* resource = GetResource(id); DCHECK(!resource->locked_for_write); diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h index 6e5c61a..22ce8a8 100644 --- a/cc/resources/resource_provider.h +++ b/cc/resources/resource_provider.h @@ -135,8 +135,8 @@ class CC_EXPORT ResourceProvider { // the resource). void SetPixels(ResourceId id, const uint8_t* image, - gfx::Rect image_rect, - gfx::Rect source_rect, + const gfx::Rect& image_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset); // Check upload status. diff --git a/cc/resources/resource_update.cc b/cc/resources/resource_update.cc index 7f89d8c..f24962a 100644 --- a/cc/resources/resource_update.cc +++ b/cc/resources/resource_update.cc @@ -10,8 +10,8 @@ namespace cc { ResourceUpdate ResourceUpdate::Create(PrioritizedResource* resource, const SkBitmap* bitmap, - gfx::Rect content_rect, - gfx::Rect source_rect, + const gfx::Rect& content_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset) { CHECK(content_rect.Contains(source_rect)); ResourceUpdate update; diff --git a/cc/resources/resource_update.h b/cc/resources/resource_update.h index cbf20aa..fefceb8 100644 --- a/cc/resources/resource_update.h +++ b/cc/resources/resource_update.h @@ -18,8 +18,8 @@ class PrioritizedResource; struct CC_EXPORT ResourceUpdate { static ResourceUpdate Create(PrioritizedResource* resource, const SkBitmap* bitmap, - gfx::Rect content_rect, - gfx::Rect source_rect, + const gfx::Rect& content_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset); ResourceUpdate(); diff --git a/cc/resources/skpicture_content_layer_updater.cc b/cc/resources/skpicture_content_layer_updater.cc index 79769bc..5242686 100644 --- a/cc/resources/skpicture_content_layer_updater.cc +++ b/cc/resources/skpicture_content_layer_updater.cc @@ -22,7 +22,7 @@ SkPictureContentLayerUpdater::SkPictureContentLayerUpdater( SkPictureContentLayerUpdater::~SkPictureContentLayerUpdater() {} void SkPictureContentLayerUpdater::PrepareToUpdate( - gfx::Rect content_rect, + const gfx::Rect& content_rect, gfx::Size, float contents_width_scale, float contents_height_scale, diff --git a/cc/resources/skpicture_content_layer_updater.h b/cc/resources/skpicture_content_layer_updater.h index 640dd5d..0e83d42 100644 --- a/cc/resources/skpicture_content_layer_updater.h +++ b/cc/resources/skpicture_content_layer_updater.h @@ -24,7 +24,7 @@ class SkPictureContentLayerUpdater : public ContentLayerUpdater { int layer_id); virtual ~SkPictureContentLayerUpdater(); - virtual void PrepareToUpdate(gfx::Rect content_rect, + virtual void PrepareToUpdate(const gfx::Rect& content_rect, gfx::Size tile_size, float contents_width_scale, float contents_height_scale, diff --git a/cc/resources/tile.cc b/cc/resources/tile.cc index 2097806..0c407e5 100644 --- a/cc/resources/tile.cc +++ b/cc/resources/tile.cc @@ -16,8 +16,8 @@ Tile::Id Tile::s_next_id_ = 0; Tile::Tile(TileManager* tile_manager, PicturePileImpl* picture_pile, gfx::Size tile_size, - gfx::Rect content_rect, - gfx::Rect opaque_rect, + const gfx::Rect& content_rect, + const gfx::Rect& opaque_rect, float contents_scale, int layer_id, int source_frame_number, diff --git a/cc/resources/tile.h b/cc/resources/tile.h index e7c9636..621a2e2 100644 --- a/cc/resources/tile.h +++ b/cc/resources/tile.h @@ -136,8 +136,8 @@ class CC_EXPORT Tile : public RefCountedManaged<Tile> { Tile(TileManager* tile_manager, PicturePileImpl* picture_pile, gfx::Size tile_size, - gfx::Rect content_rect, - gfx::Rect opaque_rect, + const gfx::Rect& content_rect, + const gfx::Rect& opaque_rect, float contents_scale, int layer_id, int source_frame_number, diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc index d6f9eca..89cee4a 100644 --- a/cc/resources/tile_manager.cc +++ b/cc/resources/tile_manager.cc @@ -969,8 +969,8 @@ void TileManager::OnRasterTaskCompleted( scoped_refptr<Tile> TileManager::CreateTile(PicturePileImpl* picture_pile, gfx::Size tile_size, - gfx::Rect content_rect, - gfx::Rect opaque_rect, + const gfx::Rect& content_rect, + const gfx::Rect& opaque_rect, float contents_scale, int layer_id, int source_frame_number, diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h index fe0c46e..e051ee5 100644 --- a/cc/resources/tile_manager.h +++ b/cc/resources/tile_manager.h @@ -68,8 +68,8 @@ class CC_EXPORT TileManager : public RasterWorkerPoolClient, scoped_refptr<Tile> CreateTile(PicturePileImpl* picture_pile, gfx::Size tile_size, - gfx::Rect content_rect, - gfx::Rect opaque_rect, + const gfx::Rect& content_rect, + const gfx::Rect& opaque_rect, float contents_scale, int layer_id, int source_frame_number, diff --git a/cc/scheduler/texture_uploader.cc b/cc/scheduler/texture_uploader.cc index 6758f11..e194ede 100644 --- a/cc/scheduler/texture_uploader.cc +++ b/cc/scheduler/texture_uploader.cc @@ -129,8 +129,8 @@ void TextureUploader::EndQuery() { } void TextureUploader::Upload(const uint8* image, - gfx::Rect image_rect, - gfx::Rect source_rect, + const gfx::Rect& image_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, ResourceFormat format, gfx::Size size) { @@ -173,8 +173,8 @@ void TextureUploader::ReleaseCachedQueries() { } void TextureUploader::UploadWithTexSubImage(const uint8* image, - gfx::Rect image_rect, - gfx::Rect source_rect, + const gfx::Rect& image_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, ResourceFormat format) { TRACE_EVENT0("cc", "TextureUploader::UploadWithTexSubImage"); @@ -227,8 +227,8 @@ void TextureUploader::UploadWithTexSubImage(const uint8* image, } void TextureUploader::UploadWithMapTexSubImage(const uint8* image, - gfx::Rect image_rect, - gfx::Rect source_rect, + const gfx::Rect& image_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, ResourceFormat format) { TRACE_EVENT0("cc", "TextureUploader::UploadWithMapTexSubImage"); diff --git a/cc/scheduler/texture_uploader.h b/cc/scheduler/texture_uploader.h index 815282e..362f001 100644 --- a/cc/scheduler/texture_uploader.h +++ b/cc/scheduler/texture_uploader.h @@ -43,8 +43,8 @@ class CC_EXPORT TextureUploader { // image be a buffer for content_rect. This function will copy the region // corresponding to source_rect to dest_offset in this sub-image. void Upload(const uint8* image, - gfx::Rect content_rect, - gfx::Rect source_rect, + const gfx::Rect& content_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, ResourceFormat format, gfx::Size size); @@ -92,13 +92,13 @@ class CC_EXPORT TextureUploader { void ProcessQueries(); void UploadWithTexSubImage(const uint8* image, - gfx::Rect image_rect, - gfx::Rect source_rect, + const gfx::Rect& image_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, ResourceFormat format); void UploadWithMapTexSubImage(const uint8* image, - gfx::Rect image_rect, - gfx::Rect source_rect, + const gfx::Rect& image_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, ResourceFormat format); void UploadWithTexImageETC1(const uint8* image, gfx::Size size); diff --git a/cc/test/fake_content_layer_client.cc b/cc/test/fake_content_layer_client.cc index af70c0c..563e945 100644 --- a/cc/test/fake_content_layer_client.cc +++ b/cc/test/fake_content_layer_client.cc @@ -17,7 +17,7 @@ FakeContentLayerClient::~FakeContentLayerClient() { } void FakeContentLayerClient::PaintContents(SkCanvas* canvas, - gfx::Rect paint_rect, gfx::RectF* opaque_rect) { + const gfx::Rect& paint_rect, gfx::RectF* opaque_rect) { if (paint_all_opaque_) *opaque_rect = paint_rect; diff --git a/cc/test/fake_content_layer_client.h b/cc/test/fake_content_layer_client.h index fbbebd8..135eda8 100644 --- a/cc/test/fake_content_layer_client.h +++ b/cc/test/fake_content_layer_client.h @@ -28,7 +28,7 @@ class FakeContentLayerClient : public ContentLayerClient { virtual ~FakeContentLayerClient(); virtual void PaintContents(SkCanvas* canvas, - gfx::Rect rect, + const gfx::Rect& rect, gfx::RectF* opaque_rect) OVERRIDE; virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} diff --git a/cc/test/fake_layer_tree_host_impl_client.h b/cc/test/fake_layer_tree_host_impl_client.h index 17c50b9..42897d3 100644 --- a/cc/test/fake_layer_tree_host_impl_client.h +++ b/cc/test/fake_layer_tree_host_impl_client.h @@ -21,7 +21,8 @@ class FakeLayerTreeHostImplClient : public LayerTreeHostImplClient { virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE {} virtual void NotifyReadyToActivate() OVERRIDE {} virtual void SetNeedsRedrawOnImplThread() OVERRIDE {} - virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) OVERRIDE {} + virtual void SetNeedsRedrawRectOnImplThread( + const gfx::Rect& damage_rect) OVERRIDE {} virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE {} virtual void SetNeedsCommitOnImplThread() OVERRIDE {} virtual void SetNeedsManageTilesOnImplThread() OVERRIDE {} diff --git a/cc/test/fake_output_surface_client.h b/cc/test/fake_output_surface_client.h index c0bf359..b944d09 100644 --- a/cc/test/fake_output_surface_client.h +++ b/cc/test/fake_output_surface_client.h @@ -22,7 +22,7 @@ class FakeOutputSurfaceClient : public OutputSurfaceClient { virtual bool DeferredInitialize( scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE; virtual void ReleaseGL() OVERRIDE {} - virtual void SetNeedsRedrawRect(gfx::Rect damage_rect) OVERRIDE {} + virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) OVERRIDE {} virtual void BeginImplFrame(const BeginFrameArgs& args) OVERRIDE; virtual void DidSwapBuffers() OVERRIDE {} virtual void OnSwapBuffersComplete() OVERRIDE {} @@ -30,8 +30,8 @@ class FakeOutputSurfaceClient : public OutputSurfaceClient { virtual void DidLoseOutputSurface() OVERRIDE; virtual void SetExternalDrawConstraints( const gfx::Transform& transform, - gfx::Rect viewport, - gfx::Rect clip, + const gfx::Rect& viewport, + const gfx::Rect& clip, bool valid_for_tile_management) OVERRIDE {} virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE; virtual void SetTreeActivationCallback(const base::Closure&) OVERRIDE {} diff --git a/cc/test/fake_picture_layer_tiling_client.cc b/cc/test/fake_picture_layer_tiling_client.cc index e217336..acbd791 100644 --- a/cc/test/fake_picture_layer_tiling_client.cc +++ b/cc/test/fake_picture_layer_tiling_client.cc @@ -42,7 +42,7 @@ FakePictureLayerTilingClient::~FakePictureLayerTilingClient() { scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile( PictureLayerTiling*, - gfx::Rect rect) { + const gfx::Rect& rect) { if (!allow_create_tile_) return scoped_refptr<Tile>(); return tile_manager_->CreateTile( diff --git a/cc/test/fake_picture_layer_tiling_client.h b/cc/test/fake_picture_layer_tiling_client.h index 4b092e8..2e4e9d6 100644 --- a/cc/test/fake_picture_layer_tiling_client.h +++ b/cc/test/fake_picture_layer_tiling_client.h @@ -22,7 +22,7 @@ class FakePictureLayerTilingClient : public PictureLayerTilingClient { // PictureLayerTilingClient implementation. virtual scoped_refptr<Tile> CreateTile( - PictureLayerTiling* tiling, gfx::Rect rect) OVERRIDE; + PictureLayerTiling* tiling, const gfx::Rect& rect) OVERRIDE; virtual void UpdatePile(Tile* tile) OVERRIDE {} virtual gfx::Size CalculateTileSize( gfx::Size content_bounds) const OVERRIDE; @@ -37,7 +37,7 @@ class FakePictureLayerTilingClient : public PictureLayerTilingClient { const PictureLayerTiling* tiling) const OVERRIDE; void set_twin_tiling(PictureLayerTiling* tiling) { twin_tiling_ = tiling; } - void set_text_rect(gfx::Rect rect) { text_rect_ = rect; } + void set_text_rect(const gfx::Rect& rect) { text_rect_ = rect; } void set_allow_create_tile(bool allow) { allow_create_tile_ = allow; } void set_invalidation(const Region& region) { invalidation_ = region; } diff --git a/cc/test/fake_proxy.cc b/cc/test/fake_proxy.cc index 90c5b1c..23e8d21 100644 --- a/cc/test/fake_proxy.cc +++ b/cc/test/fake_proxy.cc @@ -10,7 +10,7 @@ void FakeProxy::SetLayerTreeHost(LayerTreeHost* host) { layer_tree_host_ = host; } -bool FakeProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) { +bool FakeProxy::CompositeAndReadback(void* pixels, const gfx::Rect& rect) { return true; } diff --git a/cc/test/fake_proxy.h b/cc/test/fake_proxy.h index 295cd9d..cda4e72 100644 --- a/cc/test/fake_proxy.h +++ b/cc/test/fake_proxy.h @@ -21,7 +21,8 @@ class FakeProxy : public Proxy { void SetLayerTreeHost(LayerTreeHost* host); - virtual bool CompositeAndReadback(void* pixels, gfx::Rect rect) OVERRIDE; + virtual bool CompositeAndReadback(void* pixels, + const gfx::Rect& rect) OVERRIDE; virtual void FinishAllRendering() OVERRIDE {} virtual bool IsStarted() const OVERRIDE; virtual void SetLayerTreeHostClientReady() OVERRIDE {} @@ -31,7 +32,7 @@ class FakeProxy : public Proxy { virtual void SetNeedsAnimate() OVERRIDE {} virtual void SetNeedsUpdateLayers() OVERRIDE {} virtual void SetNeedsCommit() OVERRIDE {} - virtual void SetNeedsRedraw(gfx::Rect damage_rect) OVERRIDE {} + virtual void SetNeedsRedraw(const gfx::Rect& damage_rect) OVERRIDE {} virtual void SetNextCommitWaitsForActivation() OVERRIDE {} virtual void NotifyInputThrottledUntilCommit() OVERRIDE {} virtual void SetDeferCommits(bool defer_commits) OVERRIDE {} diff --git a/cc/test/fake_scrollbar.cc b/cc/test/fake_scrollbar.cc index b1566fb..7285660 100644 --- a/cc/test/fake_scrollbar.cc +++ b/cc/test/fake_scrollbar.cc @@ -56,7 +56,7 @@ gfx::Rect FakeScrollbar::TrackRect() const { void FakeScrollbar::PaintPart(SkCanvas* canvas, ScrollbarPart part, - gfx::Rect content_rect) { + const gfx::Rect& content_rect) { if (!paint_) return; diff --git a/cc/test/fake_scrollbar.h b/cc/test/fake_scrollbar.h index e1ac147..41152f6 100644 --- a/cc/test/fake_scrollbar.h +++ b/cc/test/fake_scrollbar.h @@ -28,10 +28,10 @@ class FakeScrollbar : public Scrollbar { virtual gfx::Rect TrackRect() const OVERRIDE; virtual void PaintPart(SkCanvas* canvas, ScrollbarPart part, - gfx::Rect content_rect) OVERRIDE; + const gfx::Rect& content_rect) OVERRIDE; void set_location(gfx::Point location) { location_ = location; } - void set_track_rect(gfx::Rect track_rect) { track_rect_ = track_rect; } + void set_track_rect(const gfx::Rect& track_rect) { track_rect_ = track_rect; } void set_thumb_thickness(int thumb_thickness) { thumb_thickness_ = thumb_thickness; } diff --git a/cc/test/layer_test_common.cc b/cc/test/layer_test_common.cc index 3ccd0a4..0171999 100644 --- a/cc/test/layer_test_common.cc +++ b/cc/test/layer_test_common.cc @@ -19,7 +19,7 @@ namespace cc { // Align with expected and actual output. const char* LayerTestCommon::quad_string = " Quad: "; -static bool CanRectFBeSafelyRoundedToRect(gfx::RectF r) { +static bool CanRectFBeSafelyRoundedToRect(const gfx::RectF& r) { // Ensure that range of float values is not beyond integer range. if (!r.IsExpressibleAsRect()) return false; @@ -33,7 +33,7 @@ static bool CanRectFBeSafelyRoundedToRect(gfx::RectF r) { } void LayerTestCommon::VerifyQuadsExactlyCoverRect(const QuadList& quads, - gfx::Rect rect) { + const gfx::Rect& rect) { Region remaining = rect; for (size_t i = 0; i < quads.size(); ++i) { diff --git a/cc/test/layer_test_common.h b/cc/test/layer_test_common.h index cc7a18e..2bab8c7 100644 --- a/cc/test/layer_test_common.h +++ b/cc/test/layer_test_common.h @@ -29,7 +29,7 @@ class LayerTestCommon { static const char* quad_string; static void VerifyQuadsExactlyCoverRect(const QuadList& quads, - gfx::Rect rect); + const gfx::Rect& rect); }; } // namespace cc diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc index d0635a7..fb54ce2 100644 --- a/cc/test/layer_tree_pixel_test.cc +++ b/cc/test/layer_tree_pixel_test.cc @@ -119,7 +119,7 @@ void LayerTreePixelTest::AfterTest() { } scoped_refptr<SolidColorLayer> LayerTreePixelTest::CreateSolidColorLayer( - gfx::Rect rect, SkColor color) { + const gfx::Rect& rect, SkColor color) { scoped_refptr<SolidColorLayer> layer = SolidColorLayer::Create(); layer->SetIsDrawable(true); layer->SetAnchorPoint(gfx::PointF()); @@ -150,7 +150,8 @@ void LayerTreePixelTest::TryEndTest() { scoped_refptr<SolidColorLayer> LayerTreePixelTest:: CreateSolidColorLayerWithBorder( - gfx::Rect rect, SkColor color, int border_width, SkColor border_color) { + const gfx::Rect& rect, SkColor color, + int border_width, SkColor border_color) { scoped_refptr<SolidColorLayer> layer = CreateSolidColorLayer(rect, color); scoped_refptr<SolidColorLayer> border_top = CreateSolidColorLayer( gfx::Rect(0, 0, rect.width(), border_width), border_color); @@ -177,7 +178,7 @@ scoped_refptr<SolidColorLayer> LayerTreePixelTest:: } scoped_refptr<TextureLayer> LayerTreePixelTest::CreateTextureLayer( - gfx::Rect rect, const SkBitmap& bitmap) { + const gfx::Rect& rect, const SkBitmap& bitmap) { scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(NULL); layer->SetIsDrawable(true); layer->SetAnchorPoint(gfx::PointF()); diff --git a/cc/test/layer_tree_pixel_test.h b/cc/test/layer_tree_pixel_test.h index d905d53..a72f1db 100644 --- a/cc/test/layer_tree_pixel_test.h +++ b/cc/test/layer_tree_pixel_test.h @@ -48,14 +48,14 @@ class LayerTreePixelTest : public LayerTreeTest { void TryEndTest(); - scoped_refptr<SolidColorLayer> CreateSolidColorLayer(gfx::Rect rect, + scoped_refptr<SolidColorLayer> CreateSolidColorLayer(const gfx::Rect& rect, SkColor color); scoped_refptr<SolidColorLayer> CreateSolidColorLayerWithBorder( - gfx::Rect rect, + const gfx::Rect& rect, SkColor color, int border_width, SkColor border_color); - scoped_refptr<TextureLayer> CreateTextureLayer(gfx::Rect rect, + scoped_refptr<TextureLayer> CreateTextureLayer(const gfx::Rect& rect, const SkBitmap& bitmap); enum PixelTestType { diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index 95758c2..8e2906b 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc @@ -104,7 +104,8 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { } } - virtual bool PrepareToDraw(FrameData* frame, gfx::Rect damage_rect) OVERRIDE { + virtual bool PrepareToDraw(FrameData* frame, + const gfx::Rect& damage_rect) OVERRIDE { bool result = LayerTreeHostImpl::PrepareToDraw(frame, damage_rect); if (!test_hooks_->PrepareToDrawOnThread(this, frame, result)) result = false; @@ -439,7 +440,8 @@ void LayerTreeTest::PostSetNeedsRedrawToMainThread() { main_thread_weak_ptr_)); } -void LayerTreeTest::PostSetNeedsRedrawRectToMainThread(gfx::Rect damage_rect) { +void LayerTreeTest::PostSetNeedsRedrawRectToMainThread( + const gfx::Rect& damage_rect) { main_task_runner_->PostTask( FROM_HERE, base::Bind(&LayerTreeTest::DispatchSetNeedsRedrawRect, @@ -583,7 +585,7 @@ void LayerTreeTest::DispatchSetNeedsRedraw() { layer_tree_host_->SetNeedsRedraw(); } -void LayerTreeTest::DispatchSetNeedsRedrawRect(gfx::Rect damage_rect) { +void LayerTreeTest::DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect) { DCHECK(!proxy() || proxy()->IsMainThread()); if (layer_tree_host_) diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h index f774d98..7a9efd3 100644 --- a/cc/test/layer_tree_test.h +++ b/cc/test/layer_tree_test.h @@ -122,7 +122,7 @@ class LayerTreeTest : public testing::Test, public TestHooks { void PostReadbackToMainThread(); void PostAcquireLayerTextures(); void PostSetNeedsRedrawToMainThread(); - void PostSetNeedsRedrawRectToMainThread(gfx::Rect damage_rect); + void PostSetNeedsRedrawRectToMainThread(const gfx::Rect& damage_rect); void PostSetVisibleToMainThread(bool visible); void PostSetNextCommitForcesRedrawToMainThread(); @@ -145,7 +145,7 @@ class LayerTreeTest : public testing::Test, public TestHooks { void DispatchReadback(); void DispatchAcquireLayerTextures(); void DispatchSetNeedsRedraw(); - void DispatchSetNeedsRedrawRect(gfx::Rect damage_rect); + void DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect); void DispatchSetVisible(bool visible); void DispatchSetNextCommitForcesRedraw(); void DispatchComposite(); diff --git a/cc/test/occlusion_tracker_test_common.h b/cc/test/occlusion_tracker_test_common.h index af8ed3c..5468b99 100644 --- a/cc/test/occlusion_tracker_test_common.h +++ b/cc/test/occlusion_tracker_test_common.h @@ -16,7 +16,7 @@ template <typename LayerType, typename RenderSurfaceType> class TestOcclusionTrackerBase : public OcclusionTrackerBase<LayerType, RenderSurfaceType> { public: - TestOcclusionTrackerBase(gfx::Rect screen_scissor_rect, + TestOcclusionTrackerBase(const gfx::Rect& screen_scissor_rect, bool record_metrics_for_frame) : OcclusionTrackerBase<LayerType, RenderSurfaceType>( screen_scissor_rect, diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc index 713f09e..79824c0 100644 --- a/cc/test/pixel_test.cc +++ b/cc/test/pixel_test.cc @@ -151,7 +151,7 @@ void PixelTest::ForceViewportOffset(gfx::Vector2d viewport_offset) { external_device_viewport_offset_ = viewport_offset; } -void PixelTest::ForceDeviceClip(gfx::Rect clip) { +void PixelTest::ForceDeviceClip(const gfx::Rect& clip) { external_device_clip_rect_ = clip; } diff --git a/cc/test/pixel_test.h b/cc/test/pixel_test.h index 0835cdc..b6e0242 100644 --- a/cc/test/pixel_test.h +++ b/cc/test/pixel_test.h @@ -61,7 +61,7 @@ class PixelTest : public testing::Test, RendererClient { void ForceExpandedViewport(gfx::Size surface_expansion); void ForceViewportOffset(gfx::Vector2d viewport_offset); - void ForceDeviceClip(gfx::Rect clip); + void ForceDeviceClip(const gfx::Rect& clip); void EnableExternalStencilTest(); // RendererClient implementation. diff --git a/cc/test/render_pass_test_utils.cc b/cc/test/render_pass_test_utils.cc index 32e6f48..8b018cf 100644 --- a/cc/test/render_pass_test_utils.cc +++ b/cc/test/render_pass_test_utils.cc @@ -20,7 +20,7 @@ namespace cc { TestRenderPass* AddRenderPass(RenderPassList* pass_list, RenderPass::Id id, - gfx::Rect output_rect, + const gfx::Rect& output_rect, const gfx::Transform& root_transform) { scoped_ptr<TestRenderPass> pass(TestRenderPass::Create()); pass->SetNew(id, output_rect, output_rect, root_transform); @@ -30,7 +30,7 @@ TestRenderPass* AddRenderPass(RenderPassList* pass_list, } SolidColorDrawQuad* AddQuad(TestRenderPass* pass, - gfx::Rect rect, + const gfx::Rect& rect, SkColor color) { MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); AppendQuadsData data(pass->id); @@ -51,7 +51,7 @@ SolidColorDrawQuad* AddQuad(TestRenderPass* pass, } SolidColorDrawQuad* AddClippedQuad(TestRenderPass* pass, - gfx::Rect rect, + const gfx::Rect& rect, SkColor color) { MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); AppendQuadsData data(pass->id); @@ -72,7 +72,7 @@ SolidColorDrawQuad* AddClippedQuad(TestRenderPass* pass, } SolidColorDrawQuad* AddTransformedQuad(TestRenderPass* pass, - gfx::Rect rect, + const gfx::Rect& rect, SkColor color, const gfx::Transform& transform) { MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); diff --git a/cc/test/render_pass_test_utils.h b/cc/test/render_pass_test_utils.h index 650cbc0..db739b9 100644 --- a/cc/test/render_pass_test_utils.h +++ b/cc/test/render_pass_test_utils.h @@ -26,22 +26,22 @@ class TestRenderPass; TestRenderPass* AddRenderPass( RenderPassList* pass_list, RenderPass::Id id, - gfx::Rect output_rect, + const gfx::Rect& output_rect, const gfx::Transform& root_transform); // Adds a solid quad to a given render pass. SolidColorDrawQuad* AddQuad(TestRenderPass* pass, - gfx::Rect rect, + const gfx::Rect& rect, SkColor color); // Adds a solid quad to a given render pass and sets is_clipped=true. SolidColorDrawQuad* AddClippedQuad(TestRenderPass* pass, - gfx::Rect rect, + const gfx::Rect& rect, SkColor color); // Adds a solid quad with a transform to a given render pass. SolidColorDrawQuad* AddTransformedQuad(TestRenderPass* pass, - gfx::Rect rect, + const gfx::Rect& rect, SkColor color, const gfx::Transform& transform); diff --git a/cc/test/skia_common.cc b/cc/test/skia_common.cc index de2733d..27cc3c6 100644 --- a/cc/test/skia_common.cc +++ b/cc/test/skia_common.cc @@ -32,7 +32,7 @@ SkPixelRef* TestPixelRef::deepCopy( void DrawPicture(unsigned char* buffer, - gfx::Rect layer_rect, + const gfx::Rect& layer_rect, scoped_refptr<Picture> picture) { SkBitmap bitmap; bitmap.setConfig(SkBitmap::kARGB_8888_Config, diff --git a/cc/test/skia_common.h b/cc/test/skia_common.h index 853fb5d..0d3833e 100644 --- a/cc/test/skia_common.h +++ b/cc/test/skia_common.h @@ -35,7 +35,7 @@ class TestPixelRef : public SkPixelRef { }; void DrawPicture(unsigned char* buffer, - gfx::Rect layer_rect, + const gfx::Rect& layer_rect, scoped_refptr<Picture> picture); void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap); diff --git a/cc/test/solid_color_content_layer_client.cc b/cc/test/solid_color_content_layer_client.cc index 2d84947..2f0d1df 100644 --- a/cc/test/solid_color_content_layer_client.cc +++ b/cc/test/solid_color_content_layer_client.cc @@ -12,7 +12,7 @@ namespace cc { void SolidColorContentLayerClient::PaintContents( - SkCanvas* canvas, gfx::Rect rect, gfx::RectF* opaque_rect) { + SkCanvas* canvas, const gfx::Rect& rect, gfx::RectF* opaque_rect) { SkPaint paint; paint.setStyle(SkPaint::kFill_Style); paint.setColor(color_); diff --git a/cc/test/solid_color_content_layer_client.h b/cc/test/solid_color_content_layer_client.h index 38d32b4..eaca9e7 100644 --- a/cc/test/solid_color_content_layer_client.h +++ b/cc/test/solid_color_content_layer_client.h @@ -18,7 +18,7 @@ class SolidColorContentLayerClient : public ContentLayerClient { // ContentLayerClient implementation. virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} virtual void PaintContents(SkCanvas* canvas, - gfx::Rect rect, + const gfx::Rect& rect, gfx::RectF* opaque_rect) OVERRIDE; private: diff --git a/cc/test/test_context_support.cc b/cc/test/test_context_support.cc index 9558042..3c2e31a 100644 --- a/cc/test/test_context_support.cc +++ b/cc/test/test_context_support.cc @@ -63,7 +63,7 @@ void TestContextSupport::Swap() { weak_ptr_factory_.GetWeakPtr())); } -void TestContextSupport::PartialSwapBuffers(gfx::Rect sub_buffer) { +void TestContextSupport::PartialSwapBuffers(const gfx::Rect& sub_buffer) { last_swap_type_ = PARTIAL_SWAP; last_partial_swap_rect_ = sub_buffer; base::MessageLoop::current()->PostTask( diff --git a/cc/test/test_context_support.h b/cc/test/test_context_support.h index 225ab7a..7ae657c1 100644 --- a/cc/test/test_context_support.h +++ b/cc/test/test_context_support.h @@ -26,7 +26,7 @@ class TestContextSupport : public gpu::ContextSupport { virtual void SendManagedMemoryStats(const gpu::ManagedMemoryStats& stats) OVERRIDE; virtual void Swap() OVERRIDE; - virtual void PartialSwapBuffers(gfx::Rect sub_buffer) OVERRIDE; + virtual void PartialSwapBuffers(const gfx::Rect& sub_buffer) OVERRIDE; virtual void SetSwapBuffersCompleteCallback( const base::Closure& callback) OVERRIDE; diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc index 4db79e8..6dddfd3 100644 --- a/cc/test/tiled_layer_test_common.cc +++ b/cc/test/tiled_layer_test_common.cc @@ -16,7 +16,7 @@ FakeLayerUpdater::Resource::Resource(FakeLayerUpdater* layer, FakeLayerUpdater::Resource::~Resource() {} void FakeLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, - gfx::Rect source_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, bool partial_update) { const gfx::Rect kRect(0, 0, 10, 10); @@ -34,7 +34,7 @@ FakeLayerUpdater::FakeLayerUpdater() : prepare_count_(0), update_count_(0) {} FakeLayerUpdater::~FakeLayerUpdater() {} -void FakeLayerUpdater::PrepareToUpdate(gfx::Rect content_rect, +void FakeLayerUpdater::PrepareToUpdate(const gfx::Rect& content_rect, gfx::Size tile_size, float contents_width_scale, float contents_height_scale, @@ -49,7 +49,7 @@ void FakeLayerUpdater::PrepareToUpdate(gfx::Rect content_rect, *resulting_opaque_rect = opaque_paint_rect_; } -void FakeLayerUpdater::SetRectToInvalidate(gfx::Rect rect, +void FakeLayerUpdater::SetRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer* layer) { rect_to_invalidate_ = rect; layer_ = layer; diff --git a/cc/test/tiled_layer_test_common.h b/cc/test/tiled_layer_test_common.h index ea1eb12..17de629 100644 --- a/cc/test/tiled_layer_test_common.h +++ b/cc/test/tiled_layer_test_common.h @@ -29,7 +29,7 @@ class FakeLayerUpdater : public LayerUpdater { virtual ~Resource(); virtual void Update(ResourceUpdateQueue* queue, - gfx::Rect source_rect, + const gfx::Rect& source_rect, gfx::Vector2d dest_offset, bool partial_update) OVERRIDE; @@ -45,14 +45,14 @@ class FakeLayerUpdater : public LayerUpdater { virtual scoped_ptr<LayerUpdater::Resource> CreateResource( PrioritizedResourceManager* resource) OVERRIDE; - virtual void PrepareToUpdate(gfx::Rect content_rect, + virtual void PrepareToUpdate(const gfx::Rect& content_rect, gfx::Size tile_size, float contents_width_scale, float contents_height_scale, gfx::Rect* resulting_opaque_rect) OVERRIDE; // Sets the rect to invalidate during the next call to PrepareToUpdate(). // After the next call to PrepareToUpdate() the rect is reset. - void SetRectToInvalidate(gfx::Rect rect, FakeTiledLayer* layer); + void SetRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer* layer); // Last rect passed to PrepareToUpdate(). gfx::Rect last_update_rect() const { return last_update_rect_; } @@ -65,7 +65,7 @@ class FakeLayerUpdater : public LayerUpdater { void ClearUpdateCount() { update_count_ = 0; } void Update() { update_count_++; } - void SetOpaquePaintRect(gfx::Rect opaque_paint_rect) { + void SetOpaquePaintRect(const gfx::Rect& opaque_paint_rect) { opaque_paint_rect_ = opaque_paint_rect; } diff --git a/cc/trees/damage_tracker.cc b/cc/trees/damage_tracker.cc index 9895458..4d0e935 100644 --- a/cc/trees/damage_tracker.cc +++ b/cc/trees/damage_tracker.cc @@ -49,7 +49,7 @@ void DamageTracker::UpdateDamageTrackingState( const LayerImplList& layer_list, int target_surface_layer_id, bool target_surface_property_changed_only_from_descendant, - gfx::Rect target_surface_content_rect, + const gfx::Rect& target_surface_content_rect, LayerImpl* target_surface_mask_layer, const FilterOperations& filters) { // diff --git a/cc/trees/damage_tracker.h b/cc/trees/damage_tracker.h index 37a1900..3809447 100644 --- a/cc/trees/damage_tracker.h +++ b/cc/trees/damage_tracker.h @@ -32,12 +32,14 @@ class CC_EXPORT DamageTracker { ~DamageTracker(); void DidDrawDamagedArea() { current_damage_rect_ = gfx::RectF(); } - void AddDamageNextUpdate(gfx::RectF dmg) { current_damage_rect_.Union(dmg); } + void AddDamageNextUpdate(const gfx::RectF& dmg) { + current_damage_rect_.Union(dmg); + } void UpdateDamageTrackingState( const LayerImplList& layer_list, int target_surface_layer_id, bool target_surface_property_changed_only_from_descendant, - gfx::Rect target_surface_content_rect, + const gfx::Rect& target_surface_content_rect, LayerImpl* target_surface_mask_layer, const FilterOperations& filters); diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index 0bf7124..55524af 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc @@ -471,8 +471,9 @@ void LayerTreeHost::DidLoseOutputSurface() { SetNeedsCommit(); } -bool LayerTreeHost::CompositeAndReadback(void* pixels, - gfx::Rect rect_in_device_viewport) { +bool LayerTreeHost::CompositeAndReadback( + void* pixels, + const gfx::Rect& rect_in_device_viewport) { trigger_idle_updates_ = false; bool ret = proxy_->CompositeAndReadback(pixels, rect_in_device_viewport); trigger_idle_updates_ = true; @@ -541,7 +542,7 @@ void LayerTreeHost::SetNeedsRedraw() { SetNeedsRedrawRect(gfx::Rect(device_viewport_size_)); } -void LayerTreeHost::SetNeedsRedrawRect(gfx::Rect damage_rect) { +void LayerTreeHost::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { proxy_->SetNeedsRedraw(damage_rect); } diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index e66cd06..640a70f 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h @@ -146,7 +146,8 @@ class CC_EXPORT LayerTreeHost { // Composites and attempts to read back the result into the provided // buffer. If it wasn't possible, e.g. due to context lost, will return // false. - bool CompositeAndReadback(void* pixels, gfx::Rect rect_in_device_viewport); + bool CompositeAndReadback(void* pixels, + const gfx::Rect& rect_in_device_viewport); void FinishAllRendering(); @@ -172,7 +173,7 @@ class CC_EXPORT LayerTreeHost { virtual void SetNeedsCommit(); virtual void SetNeedsFullTreeSync(); void SetNeedsRedraw(); - void SetNeedsRedrawRect(gfx::Rect damage_rect); + void SetNeedsRedrawRect(const gfx::Rect& damage_rect); bool CommitRequested() const; bool BeginMainFrameRequested() const; diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc index 33236cf..c126bb4 100644 --- a/cc/trees/layer_tree_host_common.cc +++ b/cc/trees/layer_tree_host_common.cc @@ -64,9 +64,9 @@ static gfx::Vector2dF GetEffectiveTotalScrollOffset(LayerType* layer) { } inline gfx::Rect CalculateVisibleRectWithCachedLayerRect( - gfx::Rect target_surface_rect, - gfx::Rect layer_bound_rect, - gfx::Rect layer_rect_in_target_space, + const gfx::Rect& target_surface_rect, + const gfx::Rect& layer_bound_rect, + const gfx::Rect& layer_rect_in_target_space, const gfx::Transform& transform) { if (layer_rect_in_target_space.IsEmpty()) return gfx::Rect(); @@ -104,8 +104,8 @@ inline gfx::Rect CalculateVisibleRectWithCachedLayerRect( } gfx::Rect LayerTreeHostCommon::CalculateVisibleRect( - gfx::Rect target_surface_rect, - gfx::Rect layer_bound_rect, + const gfx::Rect& target_surface_rect, + const gfx::Rect& layer_bound_rect, const gfx::Transform& transform) { gfx::Rect layer_in_surface_space = MathUtil::MapClippedRect(transform, layer_bound_rect); @@ -154,7 +154,7 @@ enum TranslateRectDirection { template <typename LayerType> static gfx::Rect TranslateRectToTargetSpace(const LayerType& ancestor_layer, const LayerType& descendant_layer, - gfx::Rect rect, + const gfx::Rect& rect, TranslateRectDirection direction) { gfx::Vector2dF translation = ComputeChangeOfBasisTranslation<LayerType>( ancestor_layer, descendant_layer); @@ -240,7 +240,7 @@ struct AccumulatedSurfaceState { template <typename LayerType> void UpdateAccumulatedSurfaceState( LayerType* layer, - gfx::Rect drawable_content_rect, + const gfx::Rect& drawable_content_rect, std::vector<AccumulatedSurfaceState<LayerType> >* accumulated_surface_state) { if (IsRootLayer(layer)) @@ -383,8 +383,8 @@ static inline bool LayerClipsSubtree(LayerType* layer) { template <typename LayerType> static gfx::Rect CalculateVisibleContentRect( LayerType* layer, - gfx::Rect clip_rect_of_target_surface_in_target_space, - gfx::Rect layer_rect_in_target_space) { + const gfx::Rect& clip_rect_of_target_surface_in_target_space, + const gfx::Rect& layer_rect_in_target_space) { DCHECK(layer->render_target()); // Nothing is visible if the layer bounds are empty. @@ -2247,7 +2247,7 @@ void LayerTreeHostCommon::CalculateDrawProperties( static bool PointHitsRect( gfx::PointF screen_space_point, const gfx::Transform& local_space_to_screen_space_transform, - gfx::RectF local_space_rect) { + const gfx::RectF& local_space_rect) { // If the transform is not invertible, then assume that this point doesn't hit // this rect. gfx::Transform inverse_local_space_to_screen_space( diff --git a/cc/trees/layer_tree_host_common.h b/cc/trees/layer_tree_host_common.h index 7272448..a15f9c0 100644 --- a/cc/trees/layer_tree_host_common.h +++ b/cc/trees/layer_tree_host_common.h @@ -24,8 +24,8 @@ class Layer; class CC_EXPORT LayerTreeHostCommon { public: - static gfx::Rect CalculateVisibleRect(gfx::Rect target_surface_rect, - gfx::Rect layer_bound_rect, + static gfx::Rect CalculateVisibleRect(const gfx::Rect& target_surface_rect, + const gfx::Rect& layer_bound_rect, const gfx::Transform& transform); template <typename LayerType, typename RenderSurfaceLayerListType> diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc index 58d82ce..177342e 100644 --- a/cc/trees/layer_tree_host_common_unittest.cc +++ b/cc/trees/layer_tree_host_common_unittest.cc @@ -196,7 +196,7 @@ class MockContentLayerClient : public ContentLayerClient { MockContentLayerClient() {} virtual ~MockContentLayerClient() {} virtual void PaintContents(SkCanvas* canvas, - gfx::Rect clip, + const gfx::Rect& clip, gfx::RectF* opaque) OVERRIDE {} virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} }; diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index f051b33..206e686 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -601,7 +601,7 @@ static void AppendQuadsForRenderSurfaceLayer( static void AppendQuadsToFillScreen( ResourceProvider::ResourceId overhang_resource_id, gfx::SizeF overhang_resource_scaled_size, - gfx::Rect root_scroll_layer_rect, + const gfx::Rect& root_scroll_layer_rect, RenderPass* target_render_pass, LayerImpl* root_layer, SkColor screen_background_color, @@ -960,7 +960,7 @@ void LayerTreeHostImpl::DidAnimateScrollOffset() { client_->RenewTreePriority(); } -void LayerTreeHostImpl::SetViewportDamage(gfx::Rect damage_rect) { +void LayerTreeHostImpl::SetViewportDamage(const gfx::Rect& damage_rect) { viewport_damage_rect_.Union(damage_rect); } @@ -1077,7 +1077,7 @@ void LayerTreeHostImpl::RemoveRenderPasses(RenderPassCuller culler, } bool LayerTreeHostImpl::PrepareToDraw(FrameData* frame, - gfx::Rect device_viewport_damage_rect) { + const gfx::Rect& damage_rect) { TRACE_EVENT1("cc", "LayerTreeHostImpl::PrepareToDraw", "SourceFrameNumber", @@ -1098,6 +1098,7 @@ bool LayerTreeHostImpl::PrepareToDraw(FrameData* frame, frame->contains_incomplete_tile = false; frame->has_no_damage = false; + gfx::Rect device_viewport_damage_rect(damage_rect); if (active_tree_->root_layer()) { device_viewport_damage_rect.Union(viewport_damage_rect_); viewport_damage_rect_ = gfx::Rect(); @@ -1246,8 +1247,8 @@ void LayerTreeHostImpl::SetManagedMemoryPolicy( void LayerTreeHostImpl::SetExternalDrawConstraints( const gfx::Transform& transform, - gfx::Rect viewport, - gfx::Rect clip, + const gfx::Rect& viewport, + const gfx::Rect& clip, bool valid_for_tile_management) { external_transform_ = transform; external_viewport_ = viewport; @@ -1255,7 +1256,7 @@ void LayerTreeHostImpl::SetExternalDrawConstraints( device_viewport_valid_for_tile_management_ = valid_for_tile_management; } -void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { +void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { if (damage_rect.IsEmpty()) return; NotifySwapPromiseMonitorsOfSetNeedsRedraw(); @@ -1500,7 +1501,7 @@ void LayerTreeHostImpl::DidLoseOutputSurface() { } void LayerTreeHostImpl::Readback(void* pixels, - gfx::Rect rect_in_device_viewport) { + const gfx::Rect& rect_in_device_viewport) { DCHECK(renderer_); renderer_->GetFramebufferPixels(pixels, rect_in_device_viewport); } diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index c6a1738..3f8f3a9 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h @@ -67,7 +67,7 @@ class LayerTreeHostImplClient { // Please call these 2 functions through // LayerTreeHostImpl's SetNeedsRedraw() and SetNeedsRedrawRect(). virtual void SetNeedsRedrawOnImplThread() = 0; - virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) = 0; + virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; virtual void DidInitializeVisibleTileOnImplThread() = 0; virtual void SetNeedsCommitOnImplThread() = 0; virtual void SetNeedsManageTilesOnImplThread() = 0; @@ -170,7 +170,7 @@ class CC_EXPORT LayerTreeHostImpl void MainThreadHasStoppedFlinging(); void UpdateBackgroundAnimateTicking(bool should_background_tick); void DidAnimateScrollOffset(); - void SetViewportDamage(gfx::Rect damage_rect); + void SetViewportDamage(const gfx::Rect& damage_rect); virtual void ManageTiles(); @@ -179,7 +179,7 @@ class CC_EXPORT LayerTreeHostImpl // must also be called, regardless of whether DrawLayers is called between the // two. virtual bool PrepareToDraw(FrameData* frame, - gfx::Rect device_viewport_damage_rect); + const gfx::Rect& damage_rect); virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time); // Must be called if and only if PrepareToDraw was called. void DidDrawAllLayers(const FrameData& frame); @@ -220,12 +220,12 @@ class CC_EXPORT LayerTreeHostImpl virtual bool DeferredInitialize( scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE; virtual void ReleaseGL() OVERRIDE; - virtual void SetNeedsRedrawRect(gfx::Rect rect) OVERRIDE; + virtual void SetNeedsRedrawRect(const gfx::Rect& rect) OVERRIDE; virtual void BeginImplFrame(const BeginFrameArgs& args) OVERRIDE; virtual void SetExternalDrawConstraints( const gfx::Transform& transform, - gfx::Rect viewport, - gfx::Rect clip, + const gfx::Rect& viewport, + const gfx::Rect& clip, bool valid_for_tile_management) OVERRIDE; virtual void DidLoseOutputSurface() OVERRIDE; virtual void DidSwapBuffers() OVERRIDE; @@ -263,7 +263,7 @@ class CC_EXPORT LayerTreeHostImpl void SetNeedsBeginImplFrame(bool enable); void DidModifyTilePriorities(); - void Readback(void* pixels, gfx::Rect rect_in_device_viewport); + void Readback(void* pixels, const gfx::Rect& rect_in_device_viewport); LayerTreeImpl* active_tree() { return active_tree_.get(); } const LayerTreeImpl* active_tree() const { return active_tree_.get(); } diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 6113bd4..ef30642 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -117,7 +117,8 @@ class LayerTreeHostImplTest : public testing::Test, virtual void SetNeedsRedrawOnImplThread() OVERRIDE { did_request_redraw_ = true; } - virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) OVERRIDE { + virtual void SetNeedsRedrawRectOnImplThread( + const gfx::Rect& damage_rect) OVERRIDE { did_request_redraw_ = true; } virtual void SetNeedsManageTilesOnImplThread() OVERRIDE { @@ -2786,9 +2787,11 @@ class BlendStateCheckLayer : public LayerImpl { bool quads_appended() const { return quads_appended_; } - void SetQuadRect(gfx::Rect rect) { quad_rect_ = rect; } - void SetQuadVisibleRect(gfx::Rect rect) { quad_visible_rect_ = rect; } - void SetOpaqueContentRect(gfx::Rect rect) { opaque_content_rect_ = rect; } + void SetQuadRect(const gfx::Rect& rect) { quad_rect_ = rect; } + void SetQuadVisibleRect(const gfx::Rect& rect) { quad_visible_rect_ = rect; } + void SetOpaqueContentRect(const gfx::Rect& rect) { + opaque_content_rect_ = rect; + } private: BlendStateCheckLayer(LayerTreeImpl* tree_impl, @@ -4814,7 +4817,7 @@ class CountingSoftwareDevice : public SoftwareOutputDevice { public: CountingSoftwareDevice() : frames_began_(0), frames_ended_(0) {} - virtual SkCanvas* BeginPaint(gfx::Rect damage_rect) OVERRIDE { + virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect) OVERRIDE { ++frames_began_; return SoftwareOutputDevice::BeginPaint(damage_rect); } diff --git a/cc/trees/layer_tree_host_pixeltest_masks.cc b/cc/trees/layer_tree_host_pixeltest_masks.cc index 1d4f893..4e07199 100644 --- a/cc/trees/layer_tree_host_pixeltest_masks.cc +++ b/cc/trees/layer_tree_host_pixeltest_masks.cc @@ -17,7 +17,7 @@ namespace { class LayerTreeHostMasksPixelTest : public LayerTreePixelTest {}; -class MaskContentLayerClient : public cc::ContentLayerClient { +class MaskContentLayerClient : public ContentLayerClient { public: MaskContentLayerClient() {} virtual ~MaskContentLayerClient() {} @@ -25,7 +25,7 @@ class MaskContentLayerClient : public cc::ContentLayerClient { virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} virtual void PaintContents(SkCanvas* canvas, - gfx::Rect rect, + const gfx::Rect& rect, gfx::RectF* opaque_rect) OVERRIDE { SkPaint paint; paint.setStyle(SkPaint::kStroke_Style); @@ -33,12 +33,14 @@ class MaskContentLayerClient : public cc::ContentLayerClient { paint.setColor(SK_ColorWHITE); canvas->clear(SK_ColorTRANSPARENT); - while (!rect.IsEmpty()) { - rect.Inset(3, 3, 2, 2); + gfx::Rect inset_rect(rect); + while (!inset_rect.IsEmpty()) { + inset_rect.Inset(3, 3, 2, 2); canvas->drawRect( - SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect.height()), + SkRect::MakeXYWH(inset_rect.x(), inset_rect.y(), + inset_rect.width(), inset_rect.height()), paint); - rect.Inset(3, 3, 2, 2); + inset_rect.Inset(3, 3, 2, 2); } } }; diff --git a/cc/trees/layer_tree_host_pixeltest_on_demand_raster.cc b/cc/trees/layer_tree_host_pixeltest_on_demand_raster.cc index eaa9749..5164027 100644 --- a/cc/trees/layer_tree_host_pixeltest_on_demand_raster.cc +++ b/cc/trees/layer_tree_host_pixeltest_on_demand_raster.cc @@ -64,7 +64,7 @@ class BlueYellowLayerClient : public ContentLayerClient { virtual void DidChangeLayerCanUseLCDText() OVERRIDE { } virtual void PaintContents(SkCanvas* canvas, - gfx::Rect clip, + const gfx::Rect& clip, gfx::RectF* opaque) OVERRIDE { *opaque = gfx::RectF(layer_rect_.width(), layer_rect_.height()); diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 02937bc..642180a 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -1236,7 +1236,8 @@ class TestOpacityChangeLayerDelegate : public ContentLayerClient { void SetTestLayer(Layer* test_layer) { test_layer_ = test_layer; } - virtual void PaintContents(SkCanvas*, gfx::Rect, gfx::RectF*) OVERRIDE { + virtual void PaintContents(SkCanvas*, const gfx::Rect&, + gfx::RectF*) OVERRIDE { // Set layer opacity to 0. if (test_layer_) test_layer_->SetOpacity(0.f); @@ -2513,7 +2514,7 @@ class LayerTreeHostTestLCDNotification : public LayerTreeHostTest { int lcd_notification_count() const { return lcd_notification_count_; } virtual void PaintContents(SkCanvas* canvas, - gfx::Rect clip, + const gfx::Rect& clip, gfx::RectF* opaque) OVERRIDE { ++paint_count_; } @@ -2756,7 +2757,7 @@ class LayerTreeHostTestChangeLayerPropertiesInPaintContents void set_layer(Layer* layer) { layer_ = layer; } virtual void PaintContents(SkCanvas* canvas, - gfx::Rect clip, + const gfx::Rect& clip, gfx::RectF* opaque) OVERRIDE { layer_->SetBounds(gfx::Size(2, 2)); } diff --git a/cc/trees/layer_tree_host_unittest_delegated.cc b/cc/trees/layer_tree_host_unittest_delegated.cc index 22e536e..5a33fdc 100644 --- a/cc/trees/layer_tree_host_unittest_delegated.cc +++ b/cc/trees/layer_tree_host_unittest_delegated.cc @@ -75,8 +75,9 @@ bool ResourcesMatch(ReturnedResourceArray actual, // These tests deal with delegated renderer layers. class LayerTreeHostDelegatedTest : public LayerTreeTest { protected: - scoped_ptr<DelegatedFrameData> CreateFrameData(gfx::Rect root_output_rect, - gfx::Rect root_damage_rect) { + scoped_ptr<DelegatedFrameData> CreateFrameData( + const gfx::Rect& root_output_rect, + const gfx::Rect& root_damage_rect) { scoped_ptr<DelegatedFrameData> frame(new DelegatedFrameData); scoped_ptr<RenderPass> root_pass(RenderPass::Create()); @@ -89,8 +90,8 @@ class LayerTreeHostDelegatedTest : public LayerTreeTest { } scoped_ptr<DelegatedFrameData> CreateInvalidFrameData( - gfx::Rect root_output_rect, - gfx::Rect root_damage_rect) { + const gfx::Rect& root_output_rect, + const gfx::Rect& root_damage_rect) { scoped_ptr<DelegatedFrameData> frame(new DelegatedFrameData); scoped_ptr<RenderPass> root_pass(RenderPass::Create()); @@ -160,8 +161,8 @@ class LayerTreeHostDelegatedTest : public LayerTreeTest { void AddRenderPass(DelegatedFrameData* frame, RenderPass::Id id, - gfx::Rect output_rect, - gfx::Rect damage_rect, + const gfx::Rect& output_rect, + const gfx::Rect& damage_rect, const FilterOperations& filters, const FilterOperations& background_filters) { for (size_t i = 0; i < frame->render_pass_list.size(); ++i) diff --git a/cc/trees/occlusion_tracker.cc b/cc/trees/occlusion_tracker.cc index 1c6c8a0..4ab5e14 100644 --- a/cc/trees/occlusion_tracker.cc +++ b/cc/trees/occlusion_tracker.cc @@ -19,7 +19,7 @@ namespace cc { template <typename LayerType, typename RenderSurfaceType> OcclusionTrackerBase<LayerType, RenderSurfaceType>::OcclusionTrackerBase( - gfx::Rect screen_space_clip_rect, bool record_metrics_for_frame) + const gfx::Rect& screen_space_clip_rect, bool record_metrics_for_frame) : screen_space_clip_rect_(screen_space_clip_rect), overdraw_metrics_(OverdrawMetrics::Create(record_metrics_for_frame)), occluding_screen_space_rects_(NULL), @@ -54,7 +54,8 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::LeaveLayer( template <typename RenderSurfaceType> static gfx::Rect ScreenSpaceClipRectInTargetSurface( - const RenderSurfaceType* target_surface, gfx::Rect screen_space_clip_rect) { + const RenderSurfaceType* target_surface, + const gfx::Rect& screen_space_clip_rect) { gfx::Transform inverse_screen_space_transform( gfx::Transform::kSkipInitialization); if (!target_surface->screen_space_transform().GetInverse( @@ -66,10 +67,11 @@ static gfx::Rect ScreenSpaceClipRectInTargetSurface( } template <typename RenderSurfaceType> -static Region TransformSurfaceOpaqueRegion(const Region& region, - bool have_clip_rect, - gfx::Rect clip_rect_in_new_target, - const gfx::Transform& transform) { +static Region TransformSurfaceOpaqueRegion( + const Region& region, + bool have_clip_rect, + const gfx::Rect& clip_rect_in_new_target, + const gfx::Transform& transform) { if (region.IsEmpty()) return Region(); @@ -239,7 +241,7 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::FinishedRenderTarget( template <typename LayerType> static void ReduceOcclusionBelowSurface(LayerType* contributing_layer, - gfx::Rect surface_rect, + const gfx::Rect& surface_rect, const gfx::Transform& surface_transform, LayerType* render_target, Region* occlusion_from_inside_target) { @@ -497,7 +499,7 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>:: template <typename LayerType, typename RenderSurfaceType> bool OcclusionTrackerBase<LayerType, RenderSurfaceType>::Occluded( const LayerType* render_target, - gfx::Rect content_rect, + const gfx::Rect& content_rect, const gfx::Transform& draw_transform, bool impl_draw_transform_is_unknown) const { DCHECK(!stack_.empty()); @@ -546,7 +548,7 @@ template <typename LayerType, typename RenderSurfaceType> gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>:: UnoccludedContentRect( const LayerType* render_target, - gfx::Rect content_rect, + const gfx::Rect& content_rect, const gfx::Transform& draw_transform, bool impl_draw_transform_is_unknown) const { DCHECK(!stack_.empty()); @@ -598,7 +600,7 @@ gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>:: UnoccludedContributingSurfaceContentRect( const LayerType* layer, bool for_replica, - gfx::Rect content_rect) const { + const gfx::Rect& content_rect) const { DCHECK(!stack_.empty()); // The layer is a contributing render_target so it should have a surface. DCHECK(layer->render_surface()); diff --git a/cc/trees/occlusion_tracker.h b/cc/trees/occlusion_tracker.h index 68418c7..85334bc 100644 --- a/cc/trees/occlusion_tracker.h +++ b/cc/trees/occlusion_tracker.h @@ -32,7 +32,7 @@ class RenderSurface; template <typename LayerType, typename RenderSurfaceType> class CC_EXPORT OcclusionTrackerBase { public: - OcclusionTrackerBase(gfx::Rect screen_space_clip_rect, + OcclusionTrackerBase(const gfx::Rect& screen_space_clip_rect, bool record_metrics_for_frame); ~OcclusionTrackerBase(); @@ -48,7 +48,7 @@ class CC_EXPORT OcclusionTrackerBase { // |render_target| is the contributing layer's render target, and // |draw_transform| and |impl_draw_transform_is_unknown| are relative to that. bool Occluded(const LayerType* render_target, - gfx::Rect content_rect, + const gfx::Rect& content_rect, const gfx::Transform& draw_transform, bool impl_draw_transform_is_unknown) const; @@ -58,7 +58,7 @@ class CC_EXPORT OcclusionTrackerBase { // |draw_transform| and |impl_draw_transform_is_unknown| are relative to that. gfx::Rect UnoccludedContentRect( const LayerType* render_target, - gfx::Rect content_rect, + const gfx::Rect& content_rect, const gfx::Transform& draw_transform, bool impl_draw_transform_is_unknown) const; @@ -68,7 +68,7 @@ class CC_EXPORT OcclusionTrackerBase { gfx::Rect UnoccludedContributingSurfaceContentRect( const LayerType* layer, bool for_replica, - gfx::Rect content_rect) const; + const gfx::Rect& content_rect) const; // Report operations for recording overdraw metrics. OverdrawMetrics* overdraw_metrics() const { diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc index 89afe4f..e7f3dff 100644 --- a/cc/trees/occlusion_tracker_unittest.cc +++ b/cc/trees/occlusion_tracker_unittest.cc @@ -39,7 +39,7 @@ class TestContentLayer : public Layer { return gfx::IntersectRects(opaque_contents_rect_, visible_content_rect()); return Layer::VisibleContentOpaqueRegion(); } - void SetOpaqueContentsRect(gfx::Rect opaque_contents_rect) { + void SetOpaqueContentsRect(const gfx::Rect& opaque_contents_rect) { override_opaque_contents_rect_ = true; opaque_contents_rect_ = opaque_contents_rect; } @@ -63,7 +63,7 @@ class TestContentLayerImpl : public LayerImpl { return gfx::IntersectRects(opaque_contents_rect_, visible_content_rect()); return LayerImpl::VisibleContentOpaqueRegion(); } - void SetOpaqueContentsRect(gfx::Rect opaque_contents_rect) { + void SetOpaqueContentsRect(const gfx::Rect& opaque_contents_rect) { override_opaque_contents_rect_ = true; opaque_contents_rect_ = opaque_contents_rect; } @@ -84,17 +84,17 @@ template <typename LayerType, typename RenderSurfaceType> class TestOcclusionTrackerWithClip : public TestOcclusionTrackerBase<LayerType, RenderSurfaceType> { public: - TestOcclusionTrackerWithClip(gfx::Rect viewport_rect, + TestOcclusionTrackerWithClip(const gfx::Rect& viewport_rect, bool record_metrics_for_frame) : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>( viewport_rect, record_metrics_for_frame) {} - explicit TestOcclusionTrackerWithClip(gfx::Rect viewport_rect) + explicit TestOcclusionTrackerWithClip(const gfx::Rect& viewport_rect) : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewport_rect, false) {} bool OccludedLayer(const LayerType* layer, - gfx::Rect content_rect) const { + const gfx::Rect& content_rect) const { DCHECK(layer->visible_content_rect().Contains(content_rect)); return this->Occluded(layer->render_target(), content_rect, @@ -105,7 +105,7 @@ class TestOcclusionTrackerWithClip // Gives an unoccluded sub-rect of |content_rect| in the content space of the // layer. Simple wrapper around UnoccludedContentRect. gfx::Rect UnoccludedLayerContentRect(const LayerType* layer, - gfx::Rect content_rect) const { + const gfx::Rect& content_rect) const { DCHECK(layer->visible_content_rect().Contains(content_rect)); return this->UnoccludedContentRect( layer->render_target(), diff --git a/cc/trees/proxy.h b/cc/trees/proxy.h index 8949a02..e987690 100644 --- a/cc/trees/proxy.h +++ b/cc/trees/proxy.h @@ -46,7 +46,7 @@ class CC_EXPORT Proxy { virtual ~Proxy(); - virtual bool CompositeAndReadback(void* pixels, gfx::Rect rect) = 0; + virtual bool CompositeAndReadback(void* pixels, const gfx::Rect& rect) = 0; virtual void FinishAllRendering() = 0; @@ -68,7 +68,7 @@ class CC_EXPORT Proxy { virtual void SetNeedsAnimate() = 0; virtual void SetNeedsUpdateLayers() = 0; virtual void SetNeedsCommit() = 0; - virtual void SetNeedsRedraw(gfx::Rect damage_rect) = 0; + virtual void SetNeedsRedraw(const gfx::Rect& damage_rect) = 0; virtual void SetNextCommitWaitsForActivation() = 0; virtual void NotifyInputThrottledUntilCommit() = 0; diff --git a/cc/trees/quad_culler.cc b/cc/trees/quad_culler.cc index 2fc8aaa..1b6404c 100644 --- a/cc/trees/quad_culler.cc +++ b/cc/trees/quad_culler.cc @@ -42,7 +42,7 @@ SharedQuadState* QuadCuller::UseSharedQuadState( static inline bool AppendQuadInternal( scoped_ptr<DrawQuad> draw_quad, - gfx::Rect culled_rect, + const gfx::Rect& culled_rect, QuadList* quad_list, const OcclusionTrackerImpl& occlusion_tracker, const LayerImpl* layer, diff --git a/cc/trees/quad_culler_unittest.cc b/cc/trees/quad_culler_unittest.cc index c07a0a7..880035a 100644 --- a/cc/trees/quad_culler_unittest.cc +++ b/cc/trees/quad_culler_unittest.cc @@ -30,7 +30,7 @@ namespace { class TestOcclusionTrackerImpl : public TestOcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> { public: - TestOcclusionTrackerImpl(gfx::Rect scissor_rect_in_screen, + TestOcclusionTrackerImpl(const gfx::Rect& scissor_rect_in_screen, bool record_metrics_for_frame = true) : TestOcclusionTrackerBase(scissor_rect_in_screen, record_metrics_for_frame) {} @@ -52,10 +52,10 @@ class QuadCullerTest : public testing::Test { scoped_ptr<TiledLayerImpl> MakeLayer(TiledLayerImpl* parent, const gfx::Transform& draw_transform, - gfx::Rect layer_rect, + const gfx::Rect& layer_rect, float opacity, bool opaque, - gfx::Rect layer_opaque_rect, + const gfx::Rect& layer_opaque_rect, LayerImplList& surface_layer_list) { scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::Create(host_impl_.active_tree(), layer_id_++); diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc index e7dd9f1..8bdd765 100644 --- a/cc/trees/single_thread_proxy.cc +++ b/cc/trees/single_thread_proxy.cc @@ -56,7 +56,8 @@ SingleThreadProxy::~SingleThreadProxy() { DCHECK(!layer_tree_host_impl_); } -bool SingleThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) { +bool SingleThreadProxy::CompositeAndReadback(void* pixels, + const gfx::Rect& rect) { TRACE_EVENT0("cc", "SingleThreadProxy::CompositeAndReadback"); DCHECK(Proxy::IsMainThread()); @@ -242,7 +243,7 @@ void SingleThreadProxy::SetNeedsCommit() { client_->ScheduleComposite(); } -void SingleThreadProxy::SetNeedsRedraw(gfx::Rect damage_rect) { +void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { SetNeedsRedrawRectOnImplThread(damage_rect); client_->ScheduleComposite(); } @@ -297,7 +298,8 @@ void SingleThreadProxy::SetNeedsManageTilesOnImplThread() { NOTREACHED(); } -void SingleThreadProxy::SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) { +void SingleThreadProxy::SetNeedsRedrawRectOnImplThread( + const gfx::Rect& damage_rect) { // TODO(brianderson): Once we move render_widget scheduling into this class, // we can treat redraw requests more efficiently than CommitAndRedraw // requests. @@ -425,7 +427,7 @@ void SingleThreadProxy::ForceSerializeOnSwapBuffers() { bool SingleThreadProxy::CommitAndComposite( base::TimeTicks frame_begin_time, - gfx::Rect device_viewport_damage_rect, + const gfx::Rect& device_viewport_damage_rect, bool for_readback, LayerTreeHostImpl::FrameData* frame) { DCHECK(Proxy::IsMainThread()); @@ -488,7 +490,7 @@ void SingleThreadProxy::UpdateBackgroundAnimateTicking() { bool SingleThreadProxy::DoComposite( scoped_refptr<ContextProvider> offscreen_context_provider, base::TimeTicks frame_begin_time, - gfx::Rect device_viewport_damage_rect, + const gfx::Rect& device_viewport_damage_rect, bool for_readback, LayerTreeHostImpl::FrameData* frame) { DCHECK(!layer_tree_host_->output_surface_lost()); diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h index 9d382a4..616f576 100644 --- a/cc/trees/single_thread_proxy.h +++ b/cc/trees/single_thread_proxy.h @@ -27,7 +27,8 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { virtual ~SingleThreadProxy(); // Proxy implementation - virtual bool CompositeAndReadback(void* pixels, gfx::Rect rect) OVERRIDE; + virtual bool CompositeAndReadback(void* pixels, + const gfx::Rect& rect) OVERRIDE; virtual void FinishAllRendering() OVERRIDE; virtual bool IsStarted() const OVERRIDE; virtual void SetLayerTreeHostClientReady() OVERRIDE; @@ -37,7 +38,7 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { virtual void SetNeedsAnimate() OVERRIDE; virtual void SetNeedsUpdateLayers() OVERRIDE; virtual void SetNeedsCommit() OVERRIDE; - virtual void SetNeedsRedraw(gfx::Rect damage_rect) OVERRIDE; + virtual void SetNeedsRedraw(const gfx::Rect& damage_rect) OVERRIDE; virtual void SetNextCommitWaitsForActivation() OVERRIDE; virtual void NotifyInputThrottledUntilCommit() OVERRIDE {} virtual void SetDeferCommits(bool defer_commits) OVERRIDE; @@ -61,7 +62,8 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE; virtual void NotifyReadyToActivate() OVERRIDE; virtual void SetNeedsRedrawOnImplThread() OVERRIDE; - virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect dirty_rect) OVERRIDE; + virtual void SetNeedsRedrawRectOnImplThread( + const gfx::Rect& dirty_rect) OVERRIDE; virtual void SetNeedsManageTilesOnImplThread() OVERRIDE; virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE; virtual void SetNeedsCommitOnImplThread() OVERRIDE; @@ -88,13 +90,13 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { void OnOutputSurfaceInitializeAttempted(bool success); bool CommitAndComposite(base::TimeTicks frame_begin_time, - gfx::Rect device_viewport_damage_rect, + const gfx::Rect& device_viewport_damage_rect, bool for_readback, LayerTreeHostImpl::FrameData* frame); void DoCommit(scoped_ptr<ResourceUpdateQueue> queue); bool DoComposite(scoped_refptr<ContextProvider> offscreen_context_provider, base::TimeTicks frame_begin_time, - gfx::Rect device_viewport_damage_rect, + const gfx::Rect& device_viewport_damage_rect, bool for_readback, LayerTreeHostImpl::FrameData* frame); void DidSwapFrame(); diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc index c5727c4..a1ce1b5 100644 --- a/cc/trees/thread_proxy.cc +++ b/cc/trees/thread_proxy.cc @@ -127,7 +127,7 @@ ThreadProxy::~ThreadProxy() { DCHECK(!started_); } -bool ThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) { +bool ThreadProxy::CompositeAndReadback(void* pixels, const gfx::Rect& rect) { TRACE_EVENT0("cc", "ThreadProxy::CompositeAndReadback"); DCHECK(IsMainThread()); DCHECK(layer_tree_host()); @@ -508,7 +508,7 @@ void ThreadProxy::SendManagedMemoryStats() { bool ThreadProxy::IsInsideDraw() { return inside_draw_; } -void ThreadProxy::SetNeedsRedraw(gfx::Rect damage_rect) { +void ThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { DCHECK(IsMainThread()); TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedraw"); Proxy::ImplThreadTaskRunner()->PostTask( @@ -563,7 +563,7 @@ void ThreadProxy::SetNeedsManageTilesOnImplThread() { scheduler_on_impl_thread_->SetNeedsManageTiles(); } -void ThreadProxy::SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) { +void ThreadProxy::SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) { DCHECK(IsImplThread()); layer_tree_host_impl_->SetViewportDamage(damage_rect); SetNeedsRedrawOnImplThread(); diff --git a/cc/trees/thread_proxy.h b/cc/trees/thread_proxy.h index 49cbb19..7da65a1 100644 --- a/cc/trees/thread_proxy.h +++ b/cc/trees/thread_proxy.h @@ -41,7 +41,8 @@ class ThreadProxy : public Proxy, virtual ~ThreadProxy(); // Proxy implementation - virtual bool CompositeAndReadback(void* pixels, gfx::Rect rect) OVERRIDE; + virtual bool CompositeAndReadback(void* pixels, + const gfx::Rect& rect) OVERRIDE; virtual void FinishAllRendering() OVERRIDE; virtual bool IsStarted() const OVERRIDE; virtual void SetLayerTreeHostClientReady() OVERRIDE; @@ -51,7 +52,7 @@ class ThreadProxy : public Proxy, virtual void SetNeedsAnimate() OVERRIDE; virtual void SetNeedsUpdateLayers() OVERRIDE; virtual void SetNeedsCommit() OVERRIDE; - virtual void SetNeedsRedraw(gfx::Rect damage_rect) OVERRIDE; + virtual void SetNeedsRedraw(const gfx::Rect& damage_rect) OVERRIDE; virtual void SetNextCommitWaitsForActivation() OVERRIDE; virtual void NotifyInputThrottledUntilCommit() OVERRIDE; virtual void SetDeferCommits(bool defer_commits) OVERRIDE; @@ -77,7 +78,8 @@ class ThreadProxy : public Proxy, // Please call these 2 functions through // LayerTreeHostImpl's SetNeedsRedraw() and SetNeedsRedrawRect(). virtual void SetNeedsRedrawOnImplThread() OVERRIDE; - virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect dirty_rect) OVERRIDE; + virtual void SetNeedsRedrawRectOnImplThread( + const gfx::Rect& dirty_rect) OVERRIDE; virtual void SetNeedsManageTilesOnImplThread() OVERRIDE; virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE; virtual void SetNeedsCommitOnImplThread() OVERRIDE; diff --git a/content/browser/android/in_process/synchronous_compositor_output_surface.cc b/content/browser/android/in_process/synchronous_compositor_output_surface.cc index b7c150f..2058fd1 100644 --- a/content/browser/android/in_process/synchronous_compositor_output_surface.cc +++ b/content/browser/android/in_process/synchronous_compositor_output_surface.cc @@ -78,7 +78,7 @@ class SynchronousCompositorOutputSurface::SoftwareDevice virtual void Resize(gfx::Size size) OVERRIDE { // Intentional no-op: canvas size is controlled by the embedder. } - virtual SkCanvas* BeginPaint(gfx::Rect damage_rect) OVERRIDE { + virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect) OVERRIDE { if (!surface_->current_sw_canvas_) { NOTREACHED() << "BeginPaint with no canvas set"; return &null_canvas_; @@ -89,7 +89,7 @@ class SynchronousCompositorOutputSurface::SoftwareDevice } virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE { } - virtual void CopyToBitmap(gfx::Rect rect, SkBitmap* output) OVERRIDE { + virtual void CopyToBitmap(const gfx::Rect& rect, SkBitmap* output) OVERRIDE { NOTIMPLEMENTED(); } diff --git a/content/browser/aura/software_output_device_ozone.cc b/content/browser/aura/software_output_device_ozone.cc index 1641f0f..29b322e 100644 --- a/content/browser/aura/software_output_device_ozone.cc +++ b/content/browser/aura/software_output_device_ozone.cc @@ -45,7 +45,7 @@ void SoftwareOutputDeviceOzone::Resize(gfx::Size viewport_size) { device_ = skia::SharePtr(canvas_->getDevice()); } -SkCanvas* SoftwareOutputDeviceOzone::BeginPaint(gfx::Rect damage_rect) { +SkCanvas* SoftwareOutputDeviceOzone::BeginPaint(const gfx::Rect& damage_rect) { DCHECK(gfx::Rect(viewport_size_).Contains(damage_rect)); canvas_->clipRect(gfx::RectToSkRect(damage_rect), SkRegion::kReplace_Op); diff --git a/content/browser/aura/software_output_device_ozone.h b/content/browser/aura/software_output_device_ozone.h index 7ebf430..d4c6554 100644 --- a/content/browser/aura/software_output_device_ozone.h +++ b/content/browser/aura/software_output_device_ozone.h @@ -25,7 +25,7 @@ class CONTENT_EXPORT SoftwareOutputDeviceOzone virtual ~SoftwareOutputDeviceOzone(); virtual void Resize(gfx::Size viewport_size) OVERRIDE; - virtual SkCanvas* BeginPaint(gfx::Rect damage_rect) OVERRIDE; + virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect) OVERRIDE; virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE; private: diff --git a/content/browser/aura/software_output_device_win.cc b/content/browser/aura/software_output_device_win.cc index f8d6d9b..b6e9d78 100644 --- a/content/browser/aura/software_output_device_win.cc +++ b/content/browser/aura/software_output_device_win.cc @@ -42,7 +42,7 @@ void SoftwareOutputDeviceWin::Resize(gfx::Size viewport_size) { &bitmap_info_.bmiHeader); } -SkCanvas* SoftwareOutputDeviceWin::BeginPaint(gfx::Rect damage_rect) { +SkCanvas* SoftwareOutputDeviceWin::BeginPaint(const gfx::Rect& damage_rect) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(contents_); @@ -93,7 +93,7 @@ void SoftwareOutputDeviceWin::EndPaint(cc::SoftwareFrameData* frame_data) { } void SoftwareOutputDeviceWin::CopyToBitmap( - gfx::Rect rect, SkBitmap* output) { + const gfx::Rect& rect, SkBitmap* output) { DCHECK(contents_); SkBaseDevice* device = contents_->sk_canvas()->getDevice(); const SkBitmap& bitmap = device->accessBitmap(false); diff --git a/content/browser/aura/software_output_device_win.h b/content/browser/aura/software_output_device_win.h index 9c0655b..5518de2 100644 --- a/content/browser/aura/software_output_device_win.h +++ b/content/browser/aura/software_output_device_win.h @@ -26,9 +26,9 @@ class SoftwareOutputDeviceWin : public cc::SoftwareOutputDevice { virtual ~SoftwareOutputDeviceWin(); virtual void Resize(gfx::Size viewport_size) OVERRIDE; - virtual SkCanvas* BeginPaint(gfx::Rect damage_rect) OVERRIDE; + virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect) OVERRIDE; virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE; - virtual void CopyToBitmap(gfx::Rect rect, SkBitmap* output) OVERRIDE; + virtual void CopyToBitmap(const gfx::Rect& rect, SkBitmap* output) OVERRIDE; private: HWND hwnd_; diff --git a/content/renderer/gpu/compositor_software_output_device.cc b/content/renderer/gpu/compositor_software_output_device.cc index c37b958..e400060 100644 --- a/content/renderer/gpu/compositor_software_output_device.cc +++ b/content/renderer/gpu/compositor_software_output_device.cc @@ -131,7 +131,8 @@ void CompositorSoftwareOutputDevice::DiscardBackbuffer() { void CompositorSoftwareOutputDevice::EnsureBackbuffer() { } -SkCanvas* CompositorSoftwareOutputDevice::BeginPaint(gfx::Rect damage_rect) { +SkCanvas* CompositorSoftwareOutputDevice::BeginPaint( + const gfx::Rect& damage_rect) { DCHECK(CalledOnValidThread()); Buffer* previous = NULL; diff --git a/content/renderer/gpu/compositor_software_output_device.h b/content/renderer/gpu/compositor_software_output_device.h index ce21b2b..5804baf 100644 --- a/content/renderer/gpu/compositor_software_output_device.h +++ b/content/renderer/gpu/compositor_software_output_device.h @@ -28,7 +28,7 @@ public: virtual void Resize(gfx::Size size) OVERRIDE; - virtual SkCanvas* BeginPaint(gfx::Rect damage_rect) OVERRIDE; + virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect) OVERRIDE; virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE; virtual void EnsureBackbuffer() OVERRIDE; virtual void DiscardBackbuffer() OVERRIDE; diff --git a/gpu/command_buffer/client/context_support.h b/gpu/command_buffer/client/context_support.h index 6a897208..b5e7713 100644 --- a/gpu/command_buffer/client/context_support.h +++ b/gpu/command_buffer/client/context_support.h @@ -28,7 +28,7 @@ class ContextSupport { virtual void SendManagedMemoryStats(const ManagedMemoryStats& stats) = 0; virtual void Swap() = 0; - virtual void PartialSwapBuffers(gfx::Rect sub_buffer) = 0; + virtual void PartialSwapBuffers(const gfx::Rect& sub_buffer) = 0; virtual void SetSwapBuffersCompleteCallback( const base::Closure& callback) = 0; diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 2d02579..93aa3d63 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -2781,7 +2781,7 @@ void GLES2Implementation::Swap() { weak_ptr_factory_.GetWeakPtr())); } -void GLES2Implementation::PartialSwapBuffers(gfx::Rect sub_buffer) { +void GLES2Implementation::PartialSwapBuffers(const gfx::Rect& sub_buffer) { PostSubBufferCHROMIUM(sub_buffer.x(), sub_buffer.y(), sub_buffer.width(), diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h index 102bd66..8a7ab68 100644 --- a/gpu/command_buffer/client/gles2_implementation.h +++ b/gpu/command_buffer/client/gles2_implementation.h @@ -217,7 +217,7 @@ class GLES2_IMPL_EXPORT GLES2Implementation // ContextSupport implementation. virtual void Swap() OVERRIDE; - virtual void PartialSwapBuffers(gfx::Rect sub_buffer) OVERRIDE; + virtual void PartialSwapBuffers(const gfx::Rect& sub_buffer) OVERRIDE; virtual void SetSwapBuffersCompleteCallback( const base::Closure& swap_buffers_complete_callback) OVERRIDE; diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc index 51322be..7f6f683 100644 --- a/ui/compositor/layer.cc +++ b/ui/compositor/layer.cc @@ -623,7 +623,7 @@ void Layer::RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request) { } void Layer::PaintContents(SkCanvas* sk_canvas, - gfx::Rect clip, + const gfx::Rect& clip, gfx::RectF* opaque) { TRACE_EVENT0("ui", "Layer::PaintContents"); scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvasWithoutScaling( diff --git a/ui/compositor/layer.h b/ui/compositor/layer.h index ff2f7da..f52c40f 100644 --- a/ui/compositor/layer.h +++ b/ui/compositor/layer.h @@ -316,7 +316,7 @@ class COMPOSITOR_EXPORT Layer // ContentLayerClient virtual void PaintContents( - SkCanvas* canvas, gfx::Rect clip, gfx::RectF* opaque) OVERRIDE; + SkCanvas* canvas, const gfx::Rect& clip, gfx::RectF* opaque) OVERRIDE; virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} cc::Layer* cc_layer() { return cc_layer_; } diff --git a/webkit/renderer/compositor_bindings/scrollbar_impl.cc b/webkit/renderer/compositor_bindings/scrollbar_impl.cc index fb60cd8..adbb6b8 100644 --- a/webkit/renderer/compositor_bindings/scrollbar_impl.cc +++ b/webkit/renderer/compositor_bindings/scrollbar_impl.cc @@ -63,7 +63,8 @@ gfx::Rect ScrollbarImpl::TrackRect() const { } void ScrollbarImpl::PaintPart( - SkCanvas* canvas, cc::ScrollbarPart part, gfx::Rect content_rect) { + SkCanvas* canvas, cc::ScrollbarPart part, + const gfx::Rect& content_rect) { if (part == cc::THUMB) { painter_.paintThumb(canvas, content_rect); return; diff --git a/webkit/renderer/compositor_bindings/scrollbar_impl.h b/webkit/renderer/compositor_bindings/scrollbar_impl.h index c77ad79..5938a7e 100644 --- a/webkit/renderer/compositor_bindings/scrollbar_impl.h +++ b/webkit/renderer/compositor_bindings/scrollbar_impl.h @@ -35,7 +35,7 @@ class ScrollbarImpl : public cc::Scrollbar { virtual gfx::Rect TrackRect() const OVERRIDE; virtual void PaintPart(SkCanvas* canvas, cc::ScrollbarPart part, - gfx::Rect content_rect) OVERRIDE; + const gfx::Rect& content_rect) OVERRIDE; private: scoped_ptr<blink::WebScrollbar> scrollbar_; diff --git a/webkit/renderer/compositor_bindings/web_content_layer_impl.cc b/webkit/renderer/compositor_bindings/web_content_layer_impl.cc index a7a9713..5a51481 100644 --- a/webkit/renderer/compositor_bindings/web_content_layer_impl.cc +++ b/webkit/renderer/compositor_bindings/web_content_layer_impl.cc @@ -47,7 +47,7 @@ void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) { } void WebContentLayerImpl::PaintContents(SkCanvas* canvas, - gfx::Rect clip, + const gfx::Rect& clip, gfx::RectF* opaque) { if (!client_) return; diff --git a/webkit/renderer/compositor_bindings/web_content_layer_impl.h b/webkit/renderer/compositor_bindings/web_content_layer_impl.h index 382b580..f8b64f9 100644 --- a/webkit/renderer/compositor_bindings/web_content_layer_impl.h +++ b/webkit/renderer/compositor_bindings/web_content_layer_impl.h @@ -36,7 +36,7 @@ class WebContentLayerImpl : public blink::WebContentLayer, // ContentLayerClient implementation. virtual void PaintContents(SkCanvas* canvas, - gfx::Rect clip, + const gfx::Rect& clip, gfx::RectF* opaque) OVERRIDE; virtual void DidChangeLayerCanUseLCDText() OVERRIDE; |