Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: cc/damage_tracker_unittest.cc

Issue 11418117: cc: Increment the ref count when assigning the SkImageFilter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/damage_tracker.h" 5 #include "cc/damage_tracker.h"
6 6
7 #include "cc/layer_impl.h" 7 #include "cc/layer_impl.h"
8 #include "cc/layer_sorter.h" 8 #include "cc/layer_sorter.h"
9 #include "cc/layer_tree_host_common.h" 9 #include "cc/layer_tree_host_common.h"
10 #include "cc/math_util.h" 10 #include "cc/math_util.h"
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 389
390 TEST_F(DamageTrackerTest, verifyDamageForImageFilter) 390 TEST_F(DamageTrackerTest, verifyDamageForImageFilter)
391 { 391 {
392 scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); 392 scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface();
393 LayerImpl* child = root->children()[0]; 393 LayerImpl* child = root->children()[0];
394 gfx::RectF rootDamageRect, childDamageRect; 394 gfx::RectF rootDamageRect, childDamageRect;
395 395
396 // Allow us to set damage on child too. 396 // Allow us to set damage on child too.
397 child->setDrawsContent(true); 397 child->setDrawsContent(true);
398 398
399 SkAutoTUnref<SkImageFilter> filter(new SkBlurImageFilter(SkIntToScalar(2), 399 SkRefPtr<SkImageFilter> filter(new SkBlurImageFilter(SkIntToScalar(2), SkInt ToScalar(2)));
Stephen White 2012/11/21 17:23:00 I don't think this is correct. I think this'll en
400 SkIntToScalar(2)));
401 // Setting the filter will damage the whole surface. 400 // Setting the filter will damage the whole surface.
402 clearDamageForAllSurfaces(root.get()); 401 clearDamageForAllSurfaces(root.get());
403 child->setFilter(filter); 402 child->setFilter(filter);
404 emulateDrawingOneFrame(root.get()); 403 emulateDrawingOneFrame(root.get());
405 rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect() ; 404 rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect() ;
406 childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect (); 405 childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect ();
407 EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 30, 30), rootDamageRect); 406 EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 30, 30), rootDamageRect);
408 EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect); 407 EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
409 408
410 // CASE 1: Setting the update rect should damage the whole surface (for now) 409 // CASE 1: Setting the update rect should damage the whole surface (for now)
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 EXPECT_TRUE(rootDamageRect.IsEmpty()); 1149 EXPECT_TRUE(rootDamageRect.IsEmpty());
1151 1150
1152 // Damage should remain empty even after one frame, since there's yet no new damage 1151 // Damage should remain empty even after one frame, since there's yet no new damage
1153 emulateDrawingOneFrame(root.get()); 1152 emulateDrawingOneFrame(root.get());
1154 rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect() ; 1153 rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect() ;
1155 EXPECT_TRUE(rootDamageRect.IsEmpty()); 1154 EXPECT_TRUE(rootDamageRect.IsEmpty());
1156 } 1155 }
1157 1156
1158 } // namespace 1157 } // namespace
1159 } // namespace cc 1158 } // namespace cc
OLDNEW
« no previous file with comments | « cc/damage_tracker.cc ('k') | cc/gl_renderer.cc » ('j') | cc/render_pass_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698