| 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" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 } | 31 } |
| 32 | 32 |
| 33 void SkPictureGpuAnalyzer::analyzePicture(const SkPicture* picture) { | 33 void SkPictureGpuAnalyzer::analyzePicture(const SkPicture* picture) { |
| 34 if (!picture) { | 34 if (!picture) { |
| 35 return; | 35 return; |
| 36 } | 36 } |
| 37 | 37 |
| 38 fNumSlowPaths += picture->numSlowPaths(); | 38 fNumSlowPaths += picture->numSlowPaths(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void SkPictureGpuAnalyzer::analyzeClipPath(const SkPath& path, SkRegion::Op op,
bool doAntiAlias) { | 41 void SkPictureGpuAnalyzer::analyzeClipPath(const SkPath& path, SkCanvas::ClipOp
op, bool doAntiAlias) { |
| 42 const SkRecords::ClipPath clipOp = { | 42 const SkRecords::ClipPath clipOp = { |
| 43 SkIRect::MakeEmpty(), // Willie don't care. | 43 SkIRect::MakeEmpty(), // Willie don't care. |
| 44 path, | 44 path, |
| 45 SkRecords::RegionOpAndAA(op, doAntiAlias) | 45 SkRecords::ClipOpAndAA(op, doAntiAlias) |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 SkPathCounter counter; | 48 SkPathCounter counter; |
| 49 counter(clipOp); | 49 counter(clipOp); |
| 50 fNumSlowPaths += counter.fNumSlowPathsAndDashEffects; | 50 fNumSlowPaths += counter.fNumSlowPathsAndDashEffects; |
| 51 } | 51 } |
| 52 | 52 |
| 53 void SkPictureGpuAnalyzer::reset() { | 53 void SkPictureGpuAnalyzer::reset() { |
| 54 fNumSlowPaths = 0; | 54 fNumSlowPaths = 0; |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool SkPictureGpuAnalyzer::suitableForGpuRasterization(const char** whyNot) cons
t { | 57 bool SkPictureGpuAnalyzer::suitableForGpuRasterization(const char** whyNot) cons
t { |
| 58 if(veto_predicate(fNumSlowPaths)) { | 58 if(veto_predicate(fNumSlowPaths)) { |
| 59 if (whyNot) { *whyNot = "Too many slow paths (either concave or dashed).
"; } | 59 if (whyNot) { *whyNot = "Too many slow paths (either concave or dashed).
"; } |
| 60 return false; | 60 return false; |
| 61 } | 61 } |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 #endif // SK_SUPPORT_GPU | 65 #endif // SK_SUPPORT_GPU |
| OLD | NEW |