LCOV - code coverage report
Current view: directory - gfx/skia/include/core - SkMaskFilter.h (source / functions) Found Hit Coverage
Test: app.info Lines: 4 0 0.0 %
Date: 2012-06-02 Functions: 5 0 0.0 %

       1                 : 
       2                 : /*
       3                 :  * Copyright 2006 The Android Open Source Project
       4                 :  *
       5                 :  * Use of this source code is governed by a BSD-style license that can be
       6                 :  * found in the LICENSE file.
       7                 :  */
       8                 : 
       9                 : 
      10                 : #ifndef SkMaskFilter_DEFINED
      11                 : #define SkMaskFilter_DEFINED
      12                 : 
      13                 : #include "SkFlattenable.h"
      14                 : #include "SkMask.h"
      15                 : 
      16                 : class SkBlitter;
      17                 : class SkBounder;
      18                 : class SkMatrix;
      19                 : class SkPath;
      20                 : class SkRasterClip;
      21                 : 
      22                 : /** \class SkMaskFilter
      23                 : 
      24                 :     SkMaskFilter is the base class for object that perform transformations on
      25                 :     an alpha-channel mask before drawing it. A subclass of SkMaskFilter may be
      26                 :     installed into a SkPaint. Once there, each time a primitive is drawn, it
      27                 :     is first scan converted into a SkMask::kA8_Format mask, and handed to the
      28                 :     filter, calling its filterMask() method. If this returns true, then the
      29                 :     new mask is used to render into the device.
      30                 : 
      31                 :     Blur and emboss are implemented as subclasses of SkMaskFilter.
      32                 : */
      33               0 : class SkMaskFilter : public SkFlattenable {
      34                 : public:
      35               0 :     SkMaskFilter() {}
      36                 : 
      37                 :     /** Returns the format of the resulting mask that this subclass will return
      38                 :         when its filterMask() method is called.
      39                 :     */
      40                 :     virtual SkMask::Format getFormat() = 0;
      41                 : 
      42                 :     /** Create a new mask by filter the src mask.
      43                 :         If src.fImage == null, then do not allocate or create the dst image
      44                 :         but do fill out the other fields in dstMask.
      45                 :         If you do allocate a dst image, use SkMask::AllocImage()
      46                 :         If this returns false, dst mask is ignored.
      47                 :         @param  dst the result of the filter. If src.fImage == null, dst should not allocate its image
      48                 :         @param src the original image to be filtered.
      49                 :         @param matrix the CTM
      50                 :         @param margin   if not null, return the buffer dx/dy need when calculating the effect. Used when
      51                 :                         drawing a clipped object to know how much larger to allocate the src before
      52                 :                         applying the filter. If returning false, ignore this parameter.
      53                 :         @return true if the dst mask was correctly created.
      54                 :     */
      55                 :     virtual bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix&,
      56                 :                             SkIPoint* margin);
      57                 : 
      58               0 :     virtual void flatten(SkFlattenableWriteBuffer& ) {}
      59                 : 
      60                 :     enum BlurType {
      61                 :         kNone_BlurType,    //!< this maskfilter is not a blur
      62                 :         kNormal_BlurType,  //!< fuzzy inside and outside
      63                 :         kSolid_BlurType,   //!< solid inside, fuzzy outside
      64                 :         kOuter_BlurType,   //!< nothing inside, fuzzy outside
      65                 :         kInner_BlurType    //!< fuzzy inside, nothing outside
      66                 :     };
      67                 : 
      68                 :     struct BlurInfo {
      69                 :         SkScalar fRadius;
      70                 :         bool     fIgnoreTransform;
      71                 :         bool     fHighQuality;
      72                 :     };
      73                 : 
      74                 :     /**
      75                 :      *  Optional method for maskfilters that can be described as a blur. If so,
      76                 :      *  they return the corresponding BlurType and set the fields in BlurInfo
      77                 :      *  (if not null). If they cannot be described as a blur, they return
      78                 :      *  kNone_BlurType and ignore the info parameter.
      79                 :      */
      80                 :     virtual BlurType asABlur(BlurInfo*) const;
      81                 : 
      82                 : protected:
      83                 :     // empty for now, but lets get our subclass to remember to init us for the future
      84               0 :     SkMaskFilter(SkFlattenableReadBuffer&) {}
      85                 : 
      86                 : private:
      87                 :     friend class SkDraw;
      88                 : 
      89                 :     /** Helper method that, given a path in device space, will rasterize it into a kA8_Format mask
      90                 :      and then call filterMask(). If this returns true, the specified blitter will be called
      91                 :      to render that mask. Returns false if filterMask() returned false.
      92                 :      This method is not exported to java.
      93                 :      */
      94                 :     bool filterPath(const SkPath& devPath, const SkMatrix& devMatrix,
      95                 :                     const SkRasterClip&, SkBounder*, SkBlitter* blitter);
      96                 : };
      97                 : 
      98                 : #endif
      99                 : 

Generated by: LCOV version 1.7