gfx/skia/trunk/src/gpu/GrTextContext.h

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:cd6a8c6fd695
1 /*
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.
6 */
7
8 #ifndef GrTextContext_DEFINED
9 #define GrTextContext_DEFINED
10
11 #include "GrPoint.h"
12 #include "GrGlyph.h"
13 #include "GrPaint.h"
14 #include "SkDeviceProperties.h"
15
16 #include "SkPostConfig.h"
17
18 class GrContext;
19 class GrDrawTarget;
20 class GrFontScaler;
21
22 /*
23 * This class wraps the state for a single text render
24 */
25 class GrTextContext {
26 public:
27 virtual ~GrTextContext() {}
28 virtual void drawText(const GrPaint&, const SkPaint&, const char text[], size_t byteLength,
29 SkScalar x, SkScalar y) = 0;
30 virtual void drawPosText(const GrPaint&, const SkPaint&,
31 const char text[], size_t byteLength,
32 const SkScalar pos[], SkScalar constY,
33 int scalarsPerPosition) = 0;
34
35 virtual bool canDraw(const SkPaint& paint) = 0;
36
37 protected:
38 GrTextContext(GrContext*, const SkDeviceProperties&);
39
40 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache);
41 static void MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc,
42 const char text[], size_t byteLength, SkVector* stopVector);
43
44 void init(const GrPaint&, const SkPaint&);
45 void finish() { fDrawTarget = NULL; }
46
47 GrContext* fContext;
48 SkDeviceProperties fDeviceProperties;
49
50 GrDrawTarget* fDrawTarget;
51 SkIRect fClipRect;
52 GrPaint fPaint;
53 SkPaint fSkPaint;
54 };
55
56 #endif

mercurial