diff options
author | vivek.vg <vivek.vg@samsung.com> | 2014-09-23 19:10:14 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-24 02:10:32 +0000 |
commit | f814f45c209ebc36f28251d8de602c099a54262e (patch) | |
tree | 172882263bbc52e0a5cf9d1e1f8535e56f90082f /cc/blink | |
parent | 376e975aac2909438e8c5f4d61439dd318dba11f (diff) | |
download | chromium_src-f814f45c209ebc36f28251d8de602c099a54262e.zip chromium_src-f814f45c209ebc36f28251d8de602c099a54262e.tar.gz chromium_src-f814f45c209ebc36f28251d8de602c099a54262e.tar.bz2 |
[chromium] Pass SkBitmap by reference in WebNinePatchLayer::setBitmap and refactor
Although passing SkBitmap by value doesn't copy the underlying pixels, it indeed
involves memcpy (~64 bytes to be precise) to replicate the settings from the
other bitmap in the copy constructor.
This overhead, albeit minor, can be avoided by passing SkBitmap as reference.
R=jamesr@chromium.org
Review URL: https://codereview.chromium.org/597553002
Cr-Commit-Position: refs/heads/master@{#296330}
Diffstat (limited to 'cc/blink')
-rw-r--r-- | cc/blink/web_nine_patch_layer_impl.cc | 8 | ||||
-rw-r--r-- | cc/blink/web_nine_patch_layer_impl.h | 7 |
2 files changed, 4 insertions, 11 deletions
diff --git a/cc/blink/web_nine_patch_layer_impl.cc b/cc/blink/web_nine_patch_layer_impl.cc index 6b3eacf..65e6fdd 100644 --- a/cc/blink/web_nine_patch_layer_impl.cc +++ b/cc/blink/web_nine_patch_layer_impl.cc @@ -34,7 +34,7 @@ void WebNinePatchLayerImpl::setBitmap(SkBitmap bitmap, bitmap.height() - aperture.height)); } -void WebNinePatchLayerImpl::setBitmap(SkBitmap bitmap) { +void WebNinePatchLayerImpl::setBitmap(const SkBitmap& bitmap) { cc::NinePatchLayer* nine_patch = static_cast<cc::NinePatchLayer*>(layer_->layer()); nine_patch->SetBitmap(bitmap); @@ -52,10 +52,4 @@ void WebNinePatchLayerImpl::setBorder(const blink::WebRect& border) { nine_patch->SetBorder(gfx::Rect(border)); } -void WebNinePatchLayerImpl::setFillCenter(bool fill_center) { - cc::NinePatchLayer* nine_patch = - static_cast<cc::NinePatchLayer*>(layer_->layer()); - nine_patch->SetFillCenter(fill_center); -} - } // namespace cc_blink diff --git a/cc/blink/web_nine_patch_layer_impl.h b/cc/blink/web_nine_patch_layer_impl.h index bfdb32a..1f2e389 100644 --- a/cc/blink/web_nine_patch_layer_impl.h +++ b/cc/blink/web_nine_patch_layer_impl.h @@ -22,13 +22,12 @@ class WebNinePatchLayerImpl : public blink::WebNinePatchLayer { // blink::WebNinePatchLayer implementation. virtual blink::WebLayer* layer(); - // TODO(ccameron): Remove setBitmap(SkBitmap, blink::WebRect) in favor of - // setBitmap(), setAperture(), and setBorder(); + // TODO(vivekg): Remove setBitmap(SkBitmap, blink::WebRect) once blink side + // CL, http://crrev.com/594193002 lands virtual void setBitmap(SkBitmap bitmap, const blink::WebRect& aperture); - virtual void setBitmap(SkBitmap bitmap); + virtual void setBitmap(const SkBitmap& bitmap); virtual void setAperture(const blink::WebRect& aperture); virtual void setBorder(const blink::WebRect& border); - virtual void setFillCenter(bool fill_center); private: scoped_ptr<WebLayerImpl> layer_; |