summaryrefslogtreecommitdiffstats
path: root/ui/compositor/layer_unittest.cc
diff options
context:
space:
mode:
authorjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-27 19:12:58 +0000
committerjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-27 19:12:58 +0000
commit4181d4e0e3ffe5159104984d83d78c3f11839efc (patch)
tree38f8a071b860650afb7bd7fd956fb9672573c5bd /ui/compositor/layer_unittest.cc
parentfc50af30a04e546b8e16f16f734d8465d3cb8dea (diff)
downloadchromium_src-4181d4e0e3ffe5159104984d83d78c3f11839efc.zip
chromium_src-4181d4e0e3ffe5159104984d83d78c3f11839efc.tar.gz
chromium_src-4181d4e0e3ffe5159104984d83d78c3f11839efc.tar.bz2
BitmapContentLayerUpdater shouldn't reallocate bitmap smaller.
BitmapContentLayerUpdater was always allocating a new bitmap if the size of the region to be drawn changed, even if the new region was smaller. These unnecessary reallocations can be very expensive because they require page faults and for the operating system to clear out the memory. BUG=296423 R=ben@chromium.org, enne@chromium.org, vangelis@chromium.org Review URL: https://codereview.chromium.org/24486002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225751 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/compositor/layer_unittest.cc')
-rw-r--r--ui/compositor/layer_unittest.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc
index 9385dbb..fedd2991 100644
--- a/ui/compositor/layer_unittest.cc
+++ b/ui/compositor/layer_unittest.cc
@@ -176,8 +176,9 @@ class TestLayerDelegate : public LayerDelegate {
// Overridden from LayerDelegate:
virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE {
- gfx::ImageSkiaRep contents = canvas->ExtractImageRep();
- paint_size_ = gfx::Size(contents.pixel_width(), contents.pixel_height());
+ SkIRect clip_bounds;
+ canvas->sk_canvas()->getClipDeviceBounds(&clip_bounds);
+ paint_size_ = gfx::Size(clip_bounds.width(), clip_bounds.height());
canvas->FillRect(gfx::Rect(paint_size_), colors_[color_index_]);
color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size());
const SkMatrix& matrix = canvas->sk_canvas()->getTotalMatrix();