| 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 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 | 1409 |
| 1410 for (int i = 0; i < 50; ++i) { | 1410 for (int i = 0; i < 50; ++i) { |
| 1411 canvas->drawRect(SkRect::MakeWH(10, 10), paint); | 1411 canvas->drawRect(SkRect::MakeWH(10, 10), paint); |
| 1412 } | 1412 } |
| 1413 } | 1413 } |
| 1414 sk_sp<SkPicture> vetoPicture(recorder.finishRecordingAsPicture()); | 1414 sk_sp<SkPicture> vetoPicture(recorder.finishRecordingAsPicture()); |
| 1415 | 1415 |
| 1416 SkPictureGpuAnalyzer analyzer; | 1416 SkPictureGpuAnalyzer analyzer; |
| 1417 REPORTER_ASSERT(r, analyzer.suitableForGpuRasterization()); | 1417 REPORTER_ASSERT(r, analyzer.suitableForGpuRasterization()); |
| 1418 | 1418 |
| 1419 analyzer.analyze(vetoPicture.get()); | 1419 analyzer.analyzePicture(vetoPicture.get()); |
| 1420 REPORTER_ASSERT(r, !analyzer.suitableForGpuRasterization()); | 1420 REPORTER_ASSERT(r, !analyzer.suitableForGpuRasterization()); |
| 1421 | 1421 |
| 1422 analyzer.reset(); | 1422 analyzer.reset(); |
| 1423 REPORTER_ASSERT(r, analyzer.suitableForGpuRasterization()); | 1423 REPORTER_ASSERT(r, analyzer.suitableForGpuRasterization()); |
| 1424 | 1424 |
| 1425 recorder.beginRecording(10, 10)->drawPicture(vetoPicture); | 1425 recorder.beginRecording(10, 10)->drawPicture(vetoPicture); |
| 1426 sk_sp<SkPicture> nestedVetoPicture(recorder.finishRecordingAsPicture()); | 1426 sk_sp<SkPicture> nestedVetoPicture(recorder.finishRecordingAsPicture()); |
| 1427 | 1427 |
| 1428 analyzer.analyze(nestedVetoPicture.get()); | 1428 analyzer.analyzePicture(nestedVetoPicture.get()); |
| 1429 REPORTER_ASSERT(r, !analyzer.suitableForGpuRasterization()); | 1429 REPORTER_ASSERT(r, !analyzer.suitableForGpuRasterization()); |
| 1430 | 1430 |
| 1431 analyzer.reset(); | 1431 analyzer.reset(); |
| 1432 | 1432 |
| 1433 const SkPath convexClip = make_convex_path(); | 1433 const SkPath convexClip = make_convex_path(); |
| 1434 const SkPath concaveClip = make_concave_path(); | 1434 const SkPath concaveClip = make_concave_path(); |
| 1435 for (int i = 0; i < 50; ++i) { | 1435 for (int i = 0; i < 50; ++i) { |
| 1436 analyzer.analyzeClipPath(convexClip, SkRegion::kIntersect_Op, false); | 1436 analyzer.analyzeClipPath(convexClip, SkRegion::kIntersect_Op, false); |
| 1437 analyzer.analyzeClipPath(convexClip, SkRegion::kIntersect_Op, true); | 1437 analyzer.analyzeClipPath(convexClip, SkRegion::kIntersect_Op, true); |
| 1438 analyzer.analyzeClipPath(concaveClip, SkRegion::kIntersect_Op, false); | 1438 analyzer.analyzeClipPath(concaveClip, SkRegion::kIntersect_Op, false); |
| 1439 } | 1439 } |
| 1440 REPORTER_ASSERT(r, analyzer.suitableForGpuRasterization()); | 1440 REPORTER_ASSERT(r, analyzer.suitableForGpuRasterization()); |
| 1441 | 1441 |
| 1442 for (int i = 0; i < 50; ++i) { | 1442 for (int i = 0; i < 50; ++i) { |
| 1443 analyzer.analyzeClipPath(concaveClip, SkRegion::kIntersect_Op, true); | 1443 analyzer.analyzeClipPath(concaveClip, SkRegion::kIntersect_Op, true); |
| 1444 } | 1444 } |
| 1445 REPORTER_ASSERT(r, !analyzer.suitableForGpuRasterization()); | 1445 REPORTER_ASSERT(r, !analyzer.suitableForGpuRasterization()); |
| 1446 } | 1446 } |
| 1447 | 1447 |
| 1448 #endif // SK_SUPPORT_GPU | 1448 #endif // SK_SUPPORT_GPU |
| OLD | NEW |