OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |