LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/core - SkPictureAnalyzer.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 27 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 "SkPath.h"
       9             : #include "SkPicture.h"
      10             : #include "SkPictureAnalyzer.h"
      11             : #include "SkPictureCommon.h"
      12             : #include "SkRecords.h"
      13             : 
      14             : #if SK_SUPPORT_GPU
      15             : 
      16             : namespace {
      17             : 
      18           0 : inline bool veto_predicate(uint32_t numSlowPaths) {
      19           0 :     return numSlowPaths > 5;
      20             : }
      21             : 
      22             : } // anonymous namespace
      23             : 
      24           0 : SkPictureGpuAnalyzer::SkPictureGpuAnalyzer(sk_sp<GrContextThreadSafeProxy> /* unused ATM */)
      25           0 :     : fNumSlowPaths(0) { }
      26             : 
      27           0 : SkPictureGpuAnalyzer::SkPictureGpuAnalyzer(const sk_sp<SkPicture>& picture,
      28           0 :                                            sk_sp<GrContextThreadSafeProxy> ctx)
      29           0 :     : SkPictureGpuAnalyzer(std::move(ctx)) {
      30           0 :     this->analyzePicture(picture.get());
      31           0 : }
      32             : 
      33           0 : void SkPictureGpuAnalyzer::analyzePicture(const SkPicture* picture) {
      34           0 :     if (!picture) {
      35           0 :         return;
      36             :     }
      37             : 
      38           0 :     fNumSlowPaths += picture->numSlowPaths();
      39             : }
      40             : 
      41           0 : void SkPictureGpuAnalyzer::analyzeClipPath(const SkPath& path, SkClipOp op, bool doAntiAlias) {
      42             :     const SkRecords::ClipPath clipOp = {
      43             :         SkIRect::MakeEmpty(), // Willie don't care.
      44             :         path,
      45             :         SkRecords::ClipOpAndAA(op, doAntiAlias)
      46           0 :     };
      47             : 
      48           0 :     SkPathCounter counter;
      49           0 :     counter(clipOp);
      50           0 :     fNumSlowPaths += counter.fNumSlowPathsAndDashEffects;
      51           0 : }
      52             : 
      53           0 : void SkPictureGpuAnalyzer::reset() {
      54           0 :     fNumSlowPaths = 0;
      55           0 : }
      56             : 
      57           0 : bool SkPictureGpuAnalyzer::suitableForGpuRasterization(const char** whyNot) const {
      58           0 :     if(veto_predicate(fNumSlowPaths)) {
      59           0 :         if (whyNot) { *whyNot = "Too many slow paths (either concave or dashed)."; }
      60           0 :         return false;
      61             :     }
      62           0 :     return true;
      63             : }
      64             : 
      65             : #endif // SK_SUPPORT_GPU

Generated by: LCOV version 1.13