| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 1 | /* |
| epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 2 | * Copyright 2010 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 8 | #ifndef GrTextContext_DEFINED |
| 9 | #define GrTextContext_DEFINED |
| 10 | |
| bsalomon@google.com | 858804d | 2012-10-15 14:25:50 +0000 | [diff] [blame] | 11 | #include "GrContext.h" |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 12 | #include "GrGlyph.h" |
| tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 13 | #include "GrPaint.h" |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 14 | |
| 15 | class GrContext; |
| tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 16 | class GrTextStrike; |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 17 | class GrFontScaler; |
| tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 18 | class GrDrawTarget; |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 19 | |
| tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 20 | class GrTextContext { |
| bsalomon@google.com | f4a9c82 | 2012-03-16 14:02:46 +0000 | [diff] [blame] | 21 | public: |
| bsalomon@google.com | 0e354aa | 2012-10-08 20:44:25 +0000 | [diff] [blame] | 22 | GrTextContext(GrContext*, const GrPaint&); |
| tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 23 | ~GrTextContext(); |
| reed@google.com | fa35e3d | 2012-06-26 20:16:17 +0000 | [diff] [blame] | 24 | |
| tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 25 | void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, |
| 26 | GrFontScaler*); |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 27 | |
| tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 28 | void flush(); // optional; automatically called by destructor |
| bsalomon@google.com | f4a9c82 | 2012-03-16 14:02:46 +0000 | [diff] [blame] | 29 | |
| 30 | private: |
| tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 31 | GrPaint fPaint; |
| tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 32 | GrContext* fContext; |
| 33 | GrDrawTarget* fDrawTarget; |
| 34 | |
| tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 35 | GrFontScaler* fScaler; |
| 36 | GrTextStrike* fStrike; |
| 37 | |
| 38 | inline void flushGlyphs(); |
| 39 | void setupDrawTarget(); |
| 40 | |
| 41 | enum { |
| 42 | kMinRequestedGlyphs = 1, |
| 43 | kDefaultRequestedGlyphs = 64, |
| 44 | kMinRequestedVerts = kMinRequestedGlyphs * 4, |
| 45 | kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, |
| 46 | }; |
| 47 | |
| bsalomon@google.com | 8598328 | 2013-02-07 22:00:29 +0000 | [diff] [blame] | 48 | SkPoint* fVertices; |
| bsalomon@google.com | 858804d | 2012-10-15 14:25:50 +0000 | [diff] [blame] | 49 | int32_t fMaxVertices; |
| 50 | GrTexture* fCurrTexture; |
| 51 | int fCurrVertex; |
| tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 52 | |
| commit-bot@chromium.org | fd03d4a | 2013-07-17 21:39:42 +0000 | [diff] [blame^] | 53 | SkIRect fClipRect; |
| bsalomon@google.com | 858804d | 2012-10-15 14:25:50 +0000 | [diff] [blame] | 54 | GrContext::AutoMatrix fAutoMatrix; |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | #endif |