Home | History | Annotate | Download | only in core
      1 
      2 /*
      3  * Copyright 2011 Google Inc.
      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 #ifndef SkDrawProcs_DEFINED
      9 #define SkDrawProcs_DEFINED
     10 
     11 #include "SkDraw.h"
     12 
     13 class SkAAClip;
     14 class SkBlitter;
     15 
     16 struct SkDraw1Glyph {
     17     const SkDraw* fDraw;
     18     SkBounder* fBounder;
     19     const SkRegion* fClip;
     20     const SkAAClip* fAAClip;
     21     SkBlitter* fBlitter;
     22     SkGlyphCache* fCache;
     23     SkIRect fClipBounds;
     24 
     25     // The fixed x,y are pre-rounded, so impls just trunc them down to ints.
     26     // i.e. half the sampling frequency has been added.
     27     // e.g. 1/2 or 1/(2^(SkGlyph::kSubBits+1)) has already been added.
     28     typedef void (*Proc)(const SkDraw1Glyph&, SkFixed x, SkFixed y, const SkGlyph&);
     29 
     30     Proc init(const SkDraw* draw, SkBlitter* blitter, SkGlyphCache* cache);
     31 };
     32 
     33 struct SkDrawProcs {
     34     SkDraw1Glyph::Proc  fD1GProc;
     35 };
     36 
     37 /**
     38  *  If the current paint is set to stroke and the stroke-width when applied to
     39  *  the matrix is <= 1.0, then this returns true, and sets coverage (simulating
     40  *  a stroke by drawing a hairline with partial coverage). If any of these
     41  *  conditions are false, then this returns false and coverage is ignored.
     42  */
     43 bool SkDrawTreatAsHairline(const SkPaint&, const SkMatrix&, SkScalar* coverage);
     44 
     45 #endif
     46 
     47