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

          Line data    Source code
       1             : /*
       2             :  * Copyright 2012 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 "GrPath.h"
       9             : #include "GrShape.h"
      10             : 
      11           0 : static inline void write_style_key(uint32_t* key, const GrStyle& style)  {
      12             :     // Pass 1 for the scale since the GPU will apply the style not GrStyle::applyToPath().
      13           0 :     GrStyle::WriteKey(key, style, GrStyle::Apply::kPathEffectAndStrokeRec, SK_Scalar1);
      14           0 : }
      15             : 
      16             : 
      17           0 : void GrPath::ComputeKey(const GrShape& shape, GrUniqueKey* key, bool* outIsVolatile) {
      18           0 :     int geoCnt = shape.unstyledKeySize();
      19           0 :     int styleCnt = GrStyle::KeySize(shape.style(), GrStyle::Apply::kPathEffectAndStrokeRec);
      20             :     // This should only fail for an arbitrary path effect, and we should not have gotten
      21             :     // here with anything other than a dash path effect.
      22           0 :     SkASSERT(styleCnt >= 0);
      23           0 :     if (geoCnt < 0) {
      24           0 :         *outIsVolatile = true;
      25           0 :         return;
      26             :     }
      27           0 :     static const GrUniqueKey::Domain kGeneralPathDomain = GrUniqueKey::GenerateDomain();
      28           0 :     GrUniqueKey::Builder builder(key, kGeneralPathDomain, geoCnt + styleCnt);
      29           0 :     shape.writeUnstyledKey(&builder[0]);
      30           0 :     if (styleCnt) {
      31           0 :         write_style_key(&builder[geoCnt], shape.style());
      32             :     }
      33           0 :     *outIsVolatile = false;
      34             : }
      35             : 
      36             : #ifdef SK_DEBUG
      37           0 : bool GrPath::isEqualTo(const SkPath& path, const GrStyle& style) const {
      38             :     // Since this is only called in debug we don't care about performance.
      39           0 :     int cnt0 = GrStyle::KeySize(fStyle, GrStyle::Apply::kPathEffectAndStrokeRec);
      40           0 :     int cnt1 = GrStyle::KeySize(style, GrStyle::Apply::kPathEffectAndStrokeRec);
      41           0 :     if (cnt0 < 0 || cnt1 < 0 || cnt0 != cnt1) {
      42           0 :         return false;
      43             :     }
      44           0 :     if (cnt0) {
      45           0 :         SkAutoTArray<uint32_t> key0(cnt0);
      46           0 :         SkAutoTArray<uint32_t> key1(cnt0);
      47           0 :         write_style_key(key0.get(), fStyle);
      48           0 :         write_style_key(key1.get(), style);
      49           0 :         if (0 != memcmp(key0.get(), key1.get(), cnt0)) {
      50           0 :             return false;
      51             :         }
      52             :     }
      53           0 :     return fSkPath == path;
      54             : }
      55             : #endif

Generated by: LCOV version 1.13