diff options
author | fmalita <fmalita@chromium.org> | 2016-05-13 11:40:07 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-13 11:40:07 -0700 |
commit | 796e365999220f53acc58ba91ed55bb35900c8bc (patch) | |
tree | 40e1884defdbee394a49ef5f105d4699bd753ea6 /include/core/SkPictureAnalyzer.h | |
parent | b2df0c2702329be6380a943d548e7377a51d8565 (diff) |
SkPictureGpuAnalyzer
Stateful helper for gathering multi-picture GPU stats.
Exposes the existing SkPicture GPU veto semantics, while preserving
the SKP impl (which has some nice properties: lazy, hierarchical,
cached per pic).
R=reed@google.com,bsalomon@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1974833003
Review-Url: https://codereview.chromium.org/1974833003
Diffstat (limited to 'include/core/SkPictureAnalyzer.h')
-rw-r--r-- | include/core/SkPictureAnalyzer.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/include/core/SkPictureAnalyzer.h b/include/core/SkPictureAnalyzer.h new file mode 100644 index 0000000000..fa8cdb1fd1 --- /dev/null +++ b/include/core/SkPictureAnalyzer.h @@ -0,0 +1,52 @@ +/* + * Copyright 2016 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkPictureAnalyzer_DEFINED +#define SkPictureAnalyzer_DEFINED + +#include "SkRefCnt.h" +#include "SkTypes.h" + +#if SK_SUPPORT_GPU +#include "GrContext.h" + +class SkPicture; + +/** \class SkPictureGpuAnalyzer + + Gathers GPU-related statistics for one or more SkPictures. +*/ +class SK_API SkPictureGpuAnalyzer final : public SkNoncopyable { +public: + explicit SkPictureGpuAnalyzer(sk_sp<GrContextThreadSafeProxy> = nullptr); + explicit SkPictureGpuAnalyzer(const sk_sp<SkPicture>& picture, + sk_sp<GrContextThreadSafeProxy> = nullptr); + + /** + * Process the given picture and accumulate its stats. + */ + void analyze(const SkPicture*); + + /** + * Reset all accumulated stats. + */ + void reset(); + + /** + * Returns true if the analyzed pictures are suitable for rendering on the GPU. + */ + bool suitableForGpuRasterization(const char** whyNot = nullptr) const; + +private: + uint32_t fNumSlowPaths; + + typedef SkNoncopyable INHERITED; +}; + +#endif // SK_SUPPORT_GPU + +#endif // SkPictureAnalyzer_DEFINED |