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

Side by Side Diff: tests/PictureTest.cpp

Issue 1210053008: Fix leak in PictureTest.cpp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBBoxHierarchy.h" 8 #include "SkBBoxHierarchy.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 986
987 static void test_cull_rect_reset(skiatest::Reporter* reporter) { 987 static void test_cull_rect_reset(skiatest::Reporter* reporter) {
988 SkPictureRecorder recorder; 988 SkPictureRecorder recorder;
989 SkRect bounds = SkRect::MakeWH(10, 10); 989 SkRect bounds = SkRect::MakeWH(10, 10);
990 SkRTreeFactory factory; 990 SkRTreeFactory factory;
991 SkCanvas* canvas = recorder.beginRecording(bounds, &factory); 991 SkCanvas* canvas = recorder.beginRecording(bounds, &factory);
992 bounds = SkRect::MakeWH(100, 100); 992 bounds = SkRect::MakeWH(100, 100);
993 SkPaint paint; 993 SkPaint paint;
994 canvas->drawRect(bounds, paint); 994 canvas->drawRect(bounds, paint);
995 canvas->drawRect(bounds, paint); 995 canvas->drawRect(bounds, paint);
996 const SkBigPicture* picture = recorder.endRecordingAsPicture(bounds)->asSkBi gPicture(); 996 SkAutoTUnref<const SkPicture> p(recorder.endRecordingAsPicture(bounds));
997 const SkBigPicture* picture = p->asSkBigPicture();
997 REPORTER_ASSERT(reporter, picture); 998 REPORTER_ASSERT(reporter, picture);
998 999
999 SkRect finalCullRect = picture->cullRect(); 1000 SkRect finalCullRect = picture->cullRect();
1000 REPORTER_ASSERT(reporter, 0 == finalCullRect.fLeft); 1001 REPORTER_ASSERT(reporter, 0 == finalCullRect.fLeft);
1001 REPORTER_ASSERT(reporter, 0 == finalCullRect.fTop); 1002 REPORTER_ASSERT(reporter, 0 == finalCullRect.fTop);
1002 REPORTER_ASSERT(reporter, 100 == finalCullRect.fBottom); 1003 REPORTER_ASSERT(reporter, 100 == finalCullRect.fBottom);
1003 REPORTER_ASSERT(reporter, 100 == finalCullRect.fRight); 1004 REPORTER_ASSERT(reporter, 100 == finalCullRect.fRight);
1004 1005
1005 const SkBBoxHierarchy* pictureBBH = picture->bbh(); 1006 const SkBBoxHierarchy* pictureBBH = picture->bbh();
1006 SkRect bbhCullRect = pictureBBH->getRootBound(); 1007 SkRect bbhCullRect = pictureBBH->getRootBound();
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 1335
1335 DEF_TEST(MiniRecorderLeftHanging, r) { 1336 DEF_TEST(MiniRecorderLeftHanging, r) {
1336 // Any shader or other ref-counted effect will do just fine here. 1337 // Any shader or other ref-counted effect will do just fine here.
1337 SkPaint paint; 1338 SkPaint paint;
1338 paint.setShader(SkShader::CreateColorShader(SK_ColorRED))->unref(); 1339 paint.setShader(SkShader::CreateColorShader(SK_ColorRED))->unref();
1339 1340
1340 SkMiniRecorder rec; 1341 SkMiniRecorder rec;
1341 REPORTER_ASSERT(r, rec.drawRect(SkRect::MakeWH(20,30), paint)); 1342 REPORTER_ASSERT(r, rec.drawRect(SkRect::MakeWH(20,30), paint));
1342 // Don't call rec.detachPicture(). Test succeeds by not asserting or leakin g the shader. 1343 // Don't call rec.detachPicture(). Test succeeds by not asserting or leakin g the shader.
1343 } 1344 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698