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

          Line data    Source code
       1             : /*
       2             :  * Copyright 2006 The Android Open Source Project
       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             : 
       9             : #include "SkScan.h"
      10             : #include "SkBlitter.h"
      11             : #include "SkRasterClip.h"
      12             : 
      13             : #ifdef SK_NO_ANALYTIC_AA
      14             :     std::atomic<bool> gSkUseAnalyticAA{false};
      15             : #else
      16             :     std::atomic<bool> gSkUseAnalyticAA{true};
      17             : #endif
      18             : 
      19             : std::atomic<bool> gSkForceAnalyticAA{false};
      20             : 
      21         128 : static inline void blitrect(SkBlitter* blitter, const SkIRect& r) {
      22         128 :     blitter->blitRect(r.fLeft, r.fTop, r.width(), r.height());
      23         128 : }
      24             : 
      25         126 : void SkScan::FillIRect(const SkIRect& r, const SkRegion* clip,
      26             :                        SkBlitter* blitter) {
      27         126 :     if (!r.isEmpty()) {
      28         126 :         if (clip) {
      29         126 :             if (clip->isRect()) {
      30         120 :                 const SkIRect& clipBounds = clip->getBounds();
      31             : 
      32         120 :                 if (clipBounds.contains(r)) {
      33         106 :                     blitrect(blitter, r);
      34             :                 } else {
      35          14 :                     SkIRect rr = r;
      36          14 :                     if (rr.intersect(clipBounds)) {
      37          14 :                         blitrect(blitter, rr);
      38             :                     }
      39             :                 }
      40             :             } else {
      41           6 :                 SkRegion::Cliperator    cliper(*clip, r);
      42           6 :                 const SkIRect&          rr = cliper.rect();
      43             : 
      44          22 :                 while (!cliper.done()) {
      45           8 :                     blitrect(blitter, rr);
      46           8 :                     cliper.next();
      47             :                 }
      48             :             }
      49             :         } else {
      50           0 :             blitrect(blitter, r);
      51             :         }
      52             :     }
      53         126 : }
      54             : 
      55           0 : void SkScan::FillXRect(const SkXRect& xr, const SkRegion* clip,
      56             :                        SkBlitter* blitter) {
      57             :     SkIRect r;
      58             : 
      59           0 :     XRect_round(xr, &r);
      60           0 :     SkScan::FillIRect(r, clip, blitter);
      61           0 : }
      62             : 
      63           8 : void SkScan::FillRect(const SkRect& r, const SkRegion* clip,
      64             :                        SkBlitter* blitter) {
      65             :     SkIRect ir;
      66             : 
      67           8 :     r.round(&ir);
      68           8 :     SkScan::FillIRect(ir, clip, blitter);
      69           8 : }
      70             : 
      71             : ///////////////////////////////////////////////////////////////////////////////
      72             : 
      73         118 : void SkScan::FillIRect(const SkIRect& r, const SkRasterClip& clip,
      74             :                        SkBlitter* blitter) {
      75         118 :     if (clip.isEmpty() || r.isEmpty()) {
      76         105 :         return;
      77             :     }
      78             : 
      79         118 :     if (clip.isBW()) {
      80         105 :         FillIRect(r, &clip.bwRgn(), blitter);
      81         105 :         return;
      82             :     }
      83             : 
      84          26 :     SkAAClipBlitterWrapper wrapper(clip, blitter);
      85          13 :     FillIRect(r, &wrapper.getRgn(), wrapper.getBlitter());
      86             : }
      87             : 
      88           0 : void SkScan::FillXRect(const SkXRect& xr, const SkRasterClip& clip,
      89             :                        SkBlitter* blitter) {
      90           0 :     if (clip.isEmpty() || xr.isEmpty()) {
      91           0 :         return;
      92             :     }
      93             : 
      94           0 :     if (clip.isBW()) {
      95           0 :         FillXRect(xr, &clip.bwRgn(), blitter);
      96           0 :         return;
      97             :     }
      98             : 
      99           0 :     SkAAClipBlitterWrapper wrapper(clip, blitter);
     100           0 :     FillXRect(xr, &wrapper.getRgn(), wrapper.getBlitter());
     101             : }
     102             : 
     103           8 : void SkScan::FillRect(const SkRect& r, const SkRasterClip& clip,
     104             :                       SkBlitter* blitter) {
     105           8 :     if (clip.isEmpty() || r.isEmpty()) {
     106           0 :         return;
     107             :     }
     108             : 
     109           8 :     if (clip.isBW()) {
     110           0 :         FillRect(r, &clip.bwRgn(), blitter);
     111           0 :         return;
     112             :     }
     113             : 
     114          16 :     SkAAClipBlitterWrapper wrapper(clip, blitter);
     115           8 :     FillRect(r, &wrapper.getRgn(), wrapper.getBlitter());
     116             : }

Generated by: LCOV version 1.13