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

Side by Side Diff: src/core/SkPictureAnalyzer.cpp

Issue 2031243003: SkPictureAnalyzer: expose the number of slow GPU commands. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove early-out veto Created 4 years, 6 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 | « include/core/SkPictureAnalyzer.h ('k') | 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 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 13 matching lines...) Expand all
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->analyzePicture(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) {
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, SkRegion::Op op, bool doAntiAlias) {
42 if (veto_predicate(fNumSlowPaths)) {
43 return;
44 }
45
46 const SkRecords::ClipPath clipOp = { 42 const SkRecords::ClipPath clipOp = {
47 SkIRect::MakeEmpty(), // Willie don't care. 43 SkIRect::MakeEmpty(), // Willie don't care.
48 path, 44 path,
49 SkRecords::RegionOpAndAA(op, doAntiAlias) 45 SkRecords::RegionOpAndAA(op, doAntiAlias)
50 }; 46 };
51 47
52 SkPathCounter counter; 48 SkPathCounter counter;
53 counter(clipOp); 49 counter(clipOp);
54 fNumSlowPaths += counter.fNumSlowPathsAndDashEffects; 50 fNumSlowPaths += counter.fNumSlowPathsAndDashEffects;
55 } 51 }
56 52
57 void SkPictureGpuAnalyzer::reset() { 53 void SkPictureGpuAnalyzer::reset() {
58 fNumSlowPaths = 0; 54 fNumSlowPaths = 0;
59 } 55 }
60 56
61 bool SkPictureGpuAnalyzer::suitableForGpuRasterization(const char** whyNot) cons t { 57 bool SkPictureGpuAnalyzer::suitableForGpuRasterization(const char** whyNot) cons t {
62 if(veto_predicate(fNumSlowPaths)) { 58 if(veto_predicate(fNumSlowPaths)) {
63 if (whyNot) { *whyNot = "Too many slow paths (either concave or dashed). "; } 59 if (whyNot) { *whyNot = "Too many slow paths (either concave or dashed). "; }
64 return false; 60 return false;
65 } 61 }
66 return true; 62 return true;
67 } 63 }
68 64
69 #endif // SK_SUPPORT_GPU 65 #endif // SK_SUPPORT_GPU
OLDNEW
« no previous file with comments | « include/core/SkPictureAnalyzer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698