epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 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 | */ |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 8 | #ifndef SkDrawProcs_DEFINED |
| 9 | #define SkDrawProcs_DEFINED |
| 10 | |
| 11 | #include "SkDraw.h" |
| 12 | |
reed@google.com | 045e62d | 2011-10-24 12:19:46 +0000 | [diff] [blame] | 13 | class SkAAClip; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 14 | class SkBlitter; |
| 15 | |
| 16 | struct SkDraw1Glyph { |
bungeman@google.com | 2211b62 | 2012-01-13 15:02:58 +0000 | [diff] [blame] | 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); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 31 | }; |
| 32 | |
| 33 | struct SkDrawProcs { |
| 34 | SkDraw1Glyph::Proc fD1GProc; |
| 35 | }; |
| 36 | |
reed@google.com | ecadf99 | 2011-09-19 19:18:18 +0000 | [diff] [blame] | 37 | /** |
bsalomon@google.com | dd1be60 | 2012-01-18 20:34:00 +0000 | [diff] [blame^] | 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. |
reed@google.com | ecadf99 | 2011-09-19 19:18:18 +0000 | [diff] [blame] | 42 | */ |
bsalomon@google.com | dd1be60 | 2012-01-18 20:34:00 +0000 | [diff] [blame^] | 43 | bool SkDrawTreatAsHairline(const SkPaint&, const SkMatrix&, SkScalar* coverage); |
reed@google.com | ecadf99 | 2011-09-19 19:18:18 +0000 | [diff] [blame] | 44 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 45 | #endif |
| 46 | |