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

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

Issue 1974833003: SkPictureGpuAnalyzer (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: GrContextThreadSafeProxy Created 4 years, 7 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
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkPicture.h"
9 #include "SkPictureAnalyzer.h"
10
11 namespace {
12
13 inline bool veto_predicate(uint32_t numSlowPaths) {
14 return numSlowPaths > 5;
15 }
16
17 } // anonymous namespace
18
19 SkPictureGpuAnalyzer::SkPictureGpuAnalyzer(GrContextThreadSafeProxy* /* unused A TM */)
20 : fNumSlowPaths(0) { }
21
22 SkPictureGpuAnalyzer::SkPictureGpuAnalyzer(const sk_sp<SkPicture>& picture,
23 GrContextThreadSafeProxy* ctx)
24 : SkPictureGpuAnalyzer(ctx) {
25 this->analyze(picture.get());
26 }
27
28 void SkPictureGpuAnalyzer::analyze(const SkPicture* picture) {
29 if (!picture || veto_predicate(fNumSlowPaths)) {
30 return;
31 }
32
33 fNumSlowPaths += picture->numSlowPaths();
34 }
35
36 void SkPictureGpuAnalyzer::reset() {
37 fNumSlowPaths = 0;
38 }
39
40 bool SkPictureGpuAnalyzer::suitableForGpuRasterization(const char** whyNot) cons t {
41 if(veto_predicate(fNumSlowPaths)) {
42 if (whyNot) { *whyNot = "Too many slow paths (either concave or dashed). "; }
43 return false;
44 }
45 return true;
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698