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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /*
michael@0 2 * Copyright 2013 Google Inc.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license that can be
michael@0 5 * found in the LICENSE file.
michael@0 6 */
michael@0 7
michael@0 8 #ifndef GrDistanceFieldTextContext_DEFINED
michael@0 9 #define GrDistanceFieldTextContext_DEFINED
michael@0 10
michael@0 11 #include "GrTextContext.h"
michael@0 12
michael@0 13 class GrTextStrike;
michael@0 14
michael@0 15 /*
michael@0 16 * This class implements GrTextContext using distance field fonts
michael@0 17 */
michael@0 18 class GrDistanceFieldTextContext : public GrTextContext {
michael@0 19 public:
michael@0 20 GrDistanceFieldTextContext(GrContext*, const SkDeviceProperties&);
michael@0 21 virtual ~GrDistanceFieldTextContext();
michael@0 22
michael@0 23 virtual void drawText(const GrPaint&, const SkPaint&, const char text[], size_t byteLength,
michael@0 24 SkScalar x, SkScalar y) SK_OVERRIDE;
michael@0 25 virtual void drawPosText(const GrPaint&, const SkPaint&,
michael@0 26 const char text[], size_t byteLength,
michael@0 27 const SkScalar pos[], SkScalar constY,
michael@0 28 int scalarsPerPosition) SK_OVERRIDE;
michael@0 29
michael@0 30 virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE;
michael@0 31
michael@0 32 private:
michael@0 33 GrTextStrike* fStrike;
michael@0 34 SkScalar fTextRatio;
michael@0 35
michael@0 36 void init(const GrPaint&, const SkPaint&);
michael@0 37 void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontScaler*);
michael@0 38 void flushGlyphs(); // automatically called by destructor
michael@0 39 void finish();
michael@0 40
michael@0 41 enum {
michael@0 42 kMinRequestedGlyphs = 1,
michael@0 43 kDefaultRequestedGlyphs = 64,
michael@0 44 kMinRequestedVerts = kMinRequestedGlyphs * 4,
michael@0 45 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4,
michael@0 46 };
michael@0 47
michael@0 48 SkPoint* fVertices;
michael@0 49 int32_t fMaxVertices;
michael@0 50 GrTexture* fCurrTexture;
michael@0 51 int fCurrVertex;
michael@0 52 };
michael@0 53
michael@0 54 #endif

mercurial