| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkPath.h" | 8 #include "SkPath.h" |
| 9 #include "SkPicture.h" | 9 #include "SkPicture.h" |
| 10 #include "SkPictureAnalyzer.h" | 10 #include "SkPictureAnalyzer.h" |
| 11 #include "SkPictureCommon.h" | 11 #include "SkPictureCommon.h" |
| 12 #include "SkRecords.h" | 12 #include "SkRecords.h" |
| 13 | 13 |
| 14 #if SK_SUPPORT_GPU | 14 #if SK_SUPPORT_GPU |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 inline bool veto_predicate(uint32_t numSlowPaths) { | 18 inline bool veto_predicate(uint32_t numSlowPaths) { |
| 19 return numSlowPaths > 5; | 19 return numSlowPaths > 5; |
| 20 } | 20 } |
| 21 | 21 |
| 22 } // anonymous namespace | 22 } // anonymous namespace |
| 23 | 23 |
| 24 SkPictureGpuAnalyzer::SkPictureGpuAnalyzer(sk_sp<GrContextThreadSafeProxy> /* un
used ATM */) | 24 SkPictureGpuAnalyzer::SkPictureGpuAnalyzer(sk_sp<GrContextThreadSafeProxy> /* un
used ATM */) |
| 25 : fNumSlowPaths(0) { } | 25 : fNumSlowPaths(0) { } |
| 26 | 26 |
| 27 SkPictureGpuAnalyzer::SkPictureGpuAnalyzer(const sk_sp<SkPicture>& picture, | 27 SkPictureGpuAnalyzer::SkPictureGpuAnalyzer(const sk_sp<SkPicture>& picture, |
| 28 sk_sp<GrContextThreadSafeProxy> ctx) | 28 sk_sp<GrContextThreadSafeProxy> ctx) |
| 29 : SkPictureGpuAnalyzer(std::move(ctx)) { | 29 : SkPictureGpuAnalyzer(std::move(ctx)) { |
| 30 this->analyze(picture.get()); | 30 this->analyzePicture(picture.get()); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void SkPictureGpuAnalyzer::analyzePicture(const SkPicture* picture) { | 33 void SkPictureGpuAnalyzer::analyzePicture(const SkPicture* picture) { |
| 34 if (!picture || veto_predicate(fNumSlowPaths)) { | 34 if (!picture || veto_predicate(fNumSlowPaths)) { |
| 35 return; | 35 return; |
| 36 } | 36 } |
| 37 | 37 |
| 38 fNumSlowPaths += picture->numSlowPaths(); | 38 fNumSlowPaths += picture->numSlowPaths(); |
| 39 } | 39 } |
| 40 | 40 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 60 | 60 |
| 61 bool SkPictureGpuAnalyzer::suitableForGpuRasterization(const char** whyNot) cons
t { | 61 bool SkPictureGpuAnalyzer::suitableForGpuRasterization(const char** whyNot) cons
t { |
| 62 if(veto_predicate(fNumSlowPaths)) { | 62 if(veto_predicate(fNumSlowPaths)) { |
| 63 if (whyNot) { *whyNot = "Too many slow paths (either concave or dashed).
"; } | 63 if (whyNot) { *whyNot = "Too many slow paths (either concave or dashed).
"; } |
| 64 return false; | 64 return false; |
| 65 } | 65 } |
| 66 return true; | 66 return true; |
| 67 } | 67 } |
| 68 | 68 |
| 69 #endif // SK_SUPPORT_GPU | 69 #endif // SK_SUPPORT_GPU |
| OLD | NEW |