summaryrefslogtreecommitdiffstats
path: root/ui/compositor
diff options
context:
space:
mode:
authorenne <enne@chromium.org>2014-10-08 23:26:36 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-09 06:26:49 +0000
commit9b779de87d09341bb31eca53c8097a0f37f97c2d (patch)
tree9c09285bb6f8ed0967e6e1437a1a4bbb00a049c4 /ui/compositor
parent847c900b6eed100c0aecfc382501affc646a8bf0 (diff)
downloadchromium_src-9b779de87d09341bb31eca53c8097a0f37f97c2d.zip
chromium_src-9b779de87d09341bb31eca53c8097a0f37f97c2d.tar.gz
chromium_src-9b779de87d09341bb31eca53c8097a0f37f97c2d.tar.bz2
Fix memory issues in compositor_unittests
These LayerDelegates are trying to paint rectangles at offsets, but end up always painting their rectangles at the layer origin. This causes any scheduled paint not at the origin to not fill the entire invalidation, leading to uninitialized pixels being drawn. The fix is rather than drawing a rect at the origin, just fill the entire clip with the right color. The clip is in the right place, so this will do what the test intends. Also fill the canvas in the DrawTreeLayerDelegate, which was always leaving it uninitialized. R=piman@chromium.org,danakj@chromium.org BUG=421107 Review URL: https://codereview.chromium.org/637933004 Cr-Commit-Position: refs/heads/master@{#298817}
Diffstat (limited to 'ui/compositor')
-rw-r--r--ui/compositor/layer_unittest.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc
index c74d5c8..ac534f8 100644
--- a/ui/compositor/layer_unittest.cc
+++ b/ui/compositor/layer_unittest.cc
@@ -237,7 +237,7 @@ class TestLayerDelegate : public LayerDelegate {
virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE {
SkISize size = canvas->sk_canvas()->getBaseLayerSize();
paint_size_ = gfx::Size(size.width(), size.height());
- canvas->FillRect(gfx::Rect(paint_size_), colors_[color_index_]);
+ canvas->DrawColor(colors_[color_index_]);
color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size());
const SkMatrix& matrix = canvas->sk_canvas()->getTotalMatrix();
scale_x_ = matrix.getScaleX();
@@ -289,6 +289,7 @@ class DrawTreeLayerDelegate : public LayerDelegate {
// Overridden from LayerDelegate:
virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE {
painted_ = true;
+ canvas->DrawColor(SK_ColorTRANSPARENT);
}
virtual void OnDelegatedFrameDamage(
const gfx::Rect& damage_rect_in_dip) OVERRIDE {}