diff options
author | prashant.n@samsung.com <prashant.n@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-10 20:05:06 +0000 |
---|---|---|
committer | prashant.n@samsung.com <prashant.n@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-10 20:05:06 +0000 |
commit | 0023fc78d056556b353ee17f03760bec8c1fee49 (patch) | |
tree | 009367358a1c44b08f3142f63b087d936206ba44 /cc/layers | |
parent | 37df32bd517577ac6ad20c6d76b236265caeacaf (diff) | |
download | chromium_src-0023fc78d056556b353ee17f03760bec8c1fee49.zip chromium_src-0023fc78d056556b353ee17f03760bec8c1fee49.tar.gz chromium_src-0023fc78d056556b353ee17f03760bec8c1fee49.tar.bz2 |
Pass gfx::Rect and gfx::RectF by const ref.
Avoid unneccessary copy of structures gfx::Rect & gfx::RectF
by passing them by const ref rather than value.
Any struct of size > 4 bytes should be passed by const ref.
Passing by ref for these structs is faster than passing
by value, especially when invoking function has multiple parameters.
Pass by value creates unneccessary overhead which should be avoided.
BUG=159273
Review URL: https://codereview.chromium.org/93663004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244224 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layers')
34 files changed, 78 insertions, 66 deletions
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); |