LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/core - SkDrawLooper.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 33 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 2013 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 "SkArenaAlloc.h"
       9             : #include "SkDrawLooper.h"
      10             : #include "SkCanvas.h"
      11             : #include "SkMatrix.h"
      12             : #include "SkPaint.h"
      13             : #include "SkRect.h"
      14             : 
      15           0 : bool SkDrawLooper::canComputeFastBounds(const SkPaint& paint) const {
      16           0 :     SkCanvas canvas;
      17             :     char storage[48];
      18           0 :     SkArenaAlloc alloc {storage};
      19             : 
      20           0 :     SkDrawLooper::Context* context = this->makeContext(&canvas, &alloc);
      21             :     for (;;) {
      22           0 :         SkPaint p(paint);
      23           0 :         if (context->next(&canvas, &p)) {
      24           0 :             p.setLooper(nullptr);
      25           0 :             if (!p.canComputeFastBounds()) {
      26           0 :                 return false;
      27             :             }
      28             :         } else {
      29           0 :             break;
      30             :         }
      31           0 :     }
      32           0 :     return true;
      33             : }
      34             : 
      35           0 : void SkDrawLooper::computeFastBounds(const SkPaint& paint, const SkRect& s,
      36             :                                      SkRect* dst) const {
      37             :     // src and dst rects may alias and we need to keep the original src, so copy it.
      38           0 :     const SkRect src = s;
      39             : 
      40           0 :     SkCanvas canvas;
      41             :     char storage[48];
      42           0 :     SkArenaAlloc alloc {storage};
      43             : 
      44           0 :     *dst = src;   // catch case where there are no loops
      45           0 :     SkDrawLooper::Context* context = this->makeContext(&canvas, &alloc);
      46             : 
      47           0 :     for (bool firstTime = true;; firstTime = false) {
      48           0 :         SkPaint p(paint);
      49           0 :         if (context->next(&canvas, &p)) {
      50           0 :             SkRect r(src);
      51             : 
      52           0 :             p.setLooper(nullptr);
      53           0 :             p.computeFastBounds(r, &r);
      54           0 :             canvas.getTotalMatrix().mapRect(&r);
      55             : 
      56           0 :             if (firstTime) {
      57           0 :                 *dst = r;
      58             :             } else {
      59           0 :                 dst->join(r);
      60             :             }
      61             :         } else {
      62           0 :             break;
      63             :         }
      64           0 :     }
      65           0 : }
      66             : 
      67           0 : bool SkDrawLooper::asABlurShadow(BlurShadowRec*) const {
      68           0 :     return false;
      69             : }

Generated by: LCOV version 1.13