1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/core/SkTextToPathIter.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 1.4 +/* 1.5 + * Copyright 2012 Google Inc. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license that can be 1.8 + * found in the LICENSE file. 1.9 + */ 1.10 + 1.11 +#ifndef SkTextToPathIter_DEFINED 1.12 +#define SkTextToPathIter_DEFINED 1.13 + 1.14 +#include "SkAutoKern.h" 1.15 +#include "SkPaint.h" 1.16 + 1.17 +class SkGlyphCache; 1.18 + 1.19 +class SkTextToPathIter { 1.20 +public: 1.21 + SkTextToPathIter(const char text[], size_t length, const SkPaint& paint, 1.22 + bool applyStrokeAndPathEffects); 1.23 + ~SkTextToPathIter(); 1.24 + 1.25 + const SkPaint& getPaint() const { return fPaint; } 1.26 + SkScalar getPathScale() const { return fScale; } 1.27 + 1.28 + struct Rec { 1.29 + const SkPath* fPath; // may be null for "whitespace" glyphs 1.30 + SkScalar fXPos; 1.31 + }; 1.32 + 1.33 + /** 1.34 + * Returns false when all of the text has been consumed 1.35 + */ 1.36 + bool next(const SkPath** path, SkScalar* xpos); 1.37 + 1.38 +private: 1.39 + SkGlyphCache* fCache; 1.40 + SkPaint fPaint; 1.41 + SkScalar fScale; 1.42 + SkFixed fPrevAdvance; 1.43 + const char* fText; 1.44 + const char* fStop; 1.45 + SkMeasureCacheProc fGlyphCacheProc; 1.46 + 1.47 + SkScalar fXPos; // accumulated xpos, returned in next 1.48 + SkAutoKern fAutoKern; 1.49 + int fXYIndex; // cache for horizontal -vs- vertical text 1.50 +}; 1.51 + 1.52 +#endif