2010-12-22 21:39:39 +00:00
|
|
|
|
2011-07-28 14:26:00 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2010 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
2010-12-22 21:39:39 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-07-28 14:26:00 +00:00
|
|
|
|
2010-12-22 21:39:39 +00:00
|
|
|
#ifndef GrTextContext_DEFINED
|
|
|
|
#define GrTextContext_DEFINED
|
|
|
|
|
2012-10-15 14:25:50 +00:00
|
|
|
#include "GrContext.h"
|
2010-12-22 21:39:39 +00:00
|
|
|
#include "GrGlyph.h"
|
2012-06-29 18:37:57 +00:00
|
|
|
#include "GrPaint.h"
|
2010-12-22 21:39:39 +00:00
|
|
|
|
|
|
|
class GrContext;
|
2012-06-29 18:37:57 +00:00
|
|
|
class GrTextStrike;
|
2010-12-22 21:39:39 +00:00
|
|
|
class GrFontScaler;
|
2012-06-29 18:37:57 +00:00
|
|
|
class GrDrawTarget;
|
2010-12-22 21:39:39 +00:00
|
|
|
|
2012-06-29 18:37:57 +00:00
|
|
|
class GrTextContext {
|
|
|
|
public:
|
2012-10-08 20:44:25 +00:00
|
|
|
GrTextContext(GrContext*, const GrPaint&);
|
2012-06-29 18:37:57 +00:00
|
|
|
~GrTextContext();
|
2010-12-22 21:39:39 +00:00
|
|
|
|
2012-06-29 18:37:57 +00:00
|
|
|
void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top,
|
|
|
|
GrFontScaler*);
|
|
|
|
|
|
|
|
void flush(); // optional; automatically called by destructor
|
|
|
|
|
|
|
|
private:
|
|
|
|
GrPaint fPaint;
|
2010-12-22 21:39:39 +00:00
|
|
|
GrContext* fContext;
|
2012-06-29 18:37:57 +00:00
|
|
|
GrDrawTarget* fDrawTarget;
|
2010-12-22 21:39:39 +00:00
|
|
|
|
2012-06-29 18:37:57 +00:00
|
|
|
GrFontScaler* fScaler;
|
|
|
|
GrTextStrike* fStrike;
|
|
|
|
|
|
|
|
inline void flushGlyphs();
|
|
|
|
void setupDrawTarget();
|
|
|
|
|
|
|
|
enum {
|
|
|
|
kMinRequestedGlyphs = 1,
|
|
|
|
kDefaultRequestedGlyphs = 64,
|
|
|
|
kMinRequestedVerts = kMinRequestedGlyphs * 4,
|
|
|
|
kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4,
|
2010-12-22 21:39:39 +00:00
|
|
|
};
|
|
|
|
|
2013-02-07 22:00:29 +00:00
|
|
|
SkPoint* fVertices;
|
2012-10-15 14:25:50 +00:00
|
|
|
int32_t fMaxVertices;
|
|
|
|
GrTexture* fCurrTexture;
|
|
|
|
int fCurrVertex;
|
2010-12-22 21:39:39 +00:00
|
|
|
|
2012-10-15 14:25:50 +00:00
|
|
|
GrIRect fClipRect;
|
|
|
|
GrContext::AutoMatrix fAutoMatrix;
|
2012-06-29 18:37:57 +00:00
|
|
|
};
|
2010-12-22 21:39:39 +00:00
|
|
|
|
2012-03-16 14:02:46 +00:00
|
|
|
#endif
|