blob: 2e26ecf44aa3c2b4990a545fd28ea88501ecf9c1 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
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.com8a1c16f2008-12-17 15:59:43 +00008#ifndef SkDrawProcs_DEFINED
9#define SkDrawProcs_DEFINED
10
11#include "SkDraw.h"
12
reed@google.com045e62d2011-10-24 12:19:46 +000013class SkAAClip;
reed@android.com8a1c16f2008-12-17 15:59:43 +000014class SkBlitter;
15
16struct SkDraw1Glyph {
bungeman@google.com2211b622012-01-13 15:02:58 +000017 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.com8a1c16f2008-12-17 15:59:43 +000031};
32
33struct SkDrawProcs {
34 SkDraw1Glyph::Proc fD1GProc;
35};
36
reed@google.comecadf992011-09-19 19:18:18 +000037/**
bsalomon@google.comdd1be602012-01-18 20:34:00 +000038 * 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.comecadf992011-09-19 19:18:18 +000042 */
bsalomon@google.comdd1be602012-01-18 20:34:00 +000043bool SkDrawTreatAsHairline(const SkPaint&, const SkMatrix&, SkScalar* coverage);
reed@google.comecadf992011-09-19 19:18:18 +000044
reed@android.com8a1c16f2008-12-17 15:59:43 +000045#endif
46