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

     1 /*
     2  * Copyright 2013 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  */
     8 #ifndef GrDistanceFieldTextContext_DEFINED
     9 #define GrDistanceFieldTextContext_DEFINED
    11 #include "GrTextContext.h"
    13 class GrTextStrike;
    15 /*
    16  * This class implements GrTextContext using distance field fonts
    17  */
    18 class GrDistanceFieldTextContext : public GrTextContext {
    19 public:
    20     GrDistanceFieldTextContext(GrContext*, const SkDeviceProperties&);
    21     virtual ~GrDistanceFieldTextContext();
    23     virtual void drawText(const GrPaint&, const SkPaint&, const char text[], size_t byteLength,
    24                           SkScalar x, SkScalar y) SK_OVERRIDE;
    25     virtual void drawPosText(const GrPaint&, const SkPaint&,
    26                              const char text[], size_t byteLength,
    27                              const SkScalar pos[], SkScalar constY,
    28                              int scalarsPerPosition) SK_OVERRIDE;
    30     virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE;
    32 private:
    33     GrTextStrike*           fStrike;
    34     SkScalar                fTextRatio;
    36     void init(const GrPaint&, const SkPaint&);
    37     void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontScaler*);
    38     void flushGlyphs();                 // automatically called by destructor
    39     void finish();
    41     enum {
    42         kMinRequestedGlyphs      = 1,
    43         kDefaultRequestedGlyphs  = 64,
    44         kMinRequestedVerts       = kMinRequestedGlyphs * 4,
    45         kDefaultRequestedVerts   = kDefaultRequestedGlyphs * 4,
    46     };
    48     SkPoint*                fVertices;
    49     int32_t                 fMaxVertices;
    50     GrTexture*              fCurrTexture;
    51     int                     fCurrVertex;
    52 };
    54 #endif

mercurial