int scalarsPerPosition) SK_OVERRIDE;
private:
- GrDistanceFieldTextContext(GrContext*, const GrPaint&, const SkPaint&,
+ GrDistanceFieldTextContext(GrContext*, const GrPaint&, const SkPaint&,
const SkDeviceProperties&);
virtual ~GrDistanceFieldTextContext();
friend class GrTTextContextManager<GrDistanceFieldTextContext>;
static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache);
static void MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc,
const char text[], size_t byteLength, SkVector* stopVector);
-
+
GrContext* fContext;
GrPaint fPaint;
SkPaint fSkPaint;
}
virtual GrTextContext* create(GrContext* grContext, const GrPaint& grPaint,
- const SkPaint& skPaint, const SkDeviceProperties& properties)
+ const SkPaint& skPaint, const SkDeviceProperties& properties)
SK_OVERRIDE {
// add check for usePath here?
SkASSERT(!fUsed);
SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false,
"Dump the contents of the font cache before every purge.");
-GrBitmapTextContext::GrBitmapTextContext(GrContext* context,
+GrBitmapTextContext::GrBitmapTextContext(GrContext* context,
const GrPaint& grPaint,
- const SkPaint& skPaint,
+ const SkPaint& skPaint,
const SkDeviceProperties& properties)
: GrTextContext(context, grPaint, skPaint, properties) {
fStrike = NULL;
SkFixed fx = SkScalarToFixed(x) + halfSampleX;
SkFixed fy = SkScalarToFixed(y) + halfSampleY;
-
+
GrContext::AutoMatrix autoMatrix;
autoMatrix.setIdentity(fContext, &fPaint);
-
+
while (text < stop) {
const SkGlyph& glyph = glyphCacheProc(cache, &text, fx & fxMask, fy & fyMask);
SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false,
"Dump the contents of the font cache before every purge.");
-GrDistanceFieldTextContext::GrDistanceFieldTextContext(GrContext* context,
+GrDistanceFieldTextContext::GrDistanceFieldTextContext(GrContext* context,
const GrPaint& grPaint,
- const SkPaint& skPaint,
+ const SkPaint& skPaint,
const SkDeviceProperties& properties)
: GrTextContext(context, grPaint, skPaint, properties) {
fStrike = NULL;
|| fSkPaint.getRasterizer()) {
return;
}
-
+
SkScalar sizeRatio = fTextRatio;
SkDrawCacheProc glyphCacheProc = fSkPaint.getDrawCacheProc();
SkAutoGlyphCache autoCache(fSkPaint, &fDeviceProperties, NULL);
SkGlyphCache* cache = autoCache.getCache();
GrFontScaler* fontScaler = GetGrFontScaler(cache);
-
+
// need to measure first
// TODO - generate positions and pre-load cache as well?
const char* stop = text + byteLength;
SkAutoGlyphCache autoCache(fSkPaint, &fDeviceProperties, NULL);
SkGlyphCache* cache = autoCache.getCache();
GrFontScaler* fontScaler = GetGrFontScaler(cache);
-
+
const char* stop = text + byteLength;
if (SkPaint::kLeft_Align == fSkPaint.getTextAlign()) {
#include "SkGr.h"
GrTextContext::GrTextContext(GrContext* context, const GrPaint& paint,
- const SkPaint& skPaint, const SkDeviceProperties& properties) :
+ const SkPaint& skPaint, const SkDeviceProperties& properties) :
fContext(context), fPaint(paint), fSkPaint(skPaint),
fDeviceProperties(properties) {
const char text[], size_t byteLength, SkVector* stopVector) {
SkFixed x = 0, y = 0;
const char* stop = text + byteLength;
-
+
SkAutoKern autokern;
-
+
while (text < stop) {
// don't need x, y here, since all subpixel variants will have the
// same advance
const SkGlyph& glyph = glyphCacheProc(cache, &text, 0, 0);
-
+
x += autokern.adjust(glyph) + glyph.fAdvanceX;
y += glyph.fAdvanceY;
}
stopVector->set(SkFixedToScalar(x), SkFixedToScalar(y));
-
+
SkASSERT(text == stop);
}
GrFontScaler* GrTextContext::GetGrFontScaler(SkGlyphCache* cache) {
void* auxData;
GrFontScaler* scaler = NULL;
-
+
if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) {
scaler = (GrFontScaler*)auxData;
}
scaler = SkNEW_ARGS(SkGrFontScaler, (cache));
cache->setAuxProc(GlyphCacheAuxProc, scaler);
}
-
+
return scaler;
}
-
SkDEBUGCODE(this->validate();)
- SkAutoTDelete<GrTextContext> ctx(fTextContextManager->create(this->context(),
+ SkAutoTDelete<GrTextContext> ctx(fTextContextManager->create(this->context(),
grPaint, paint,
this->getDeviceProperties()));
ctx->drawText((const char *)text, byteLength, x, y);
SkDEBUGCODE(this->validate();)
- SkAutoTDelete<GrTextContext> ctx(fTextContextManager->create(this->context(),
+ SkAutoTDelete<GrTextContext> ctx(fTextContextManager->create(this->context(),
grPaint, paint,
this->getDeviceProperties()));
ctx->drawPosText((const char *)text, byteLength, pos, constY, scalarsPerPos);
#undef TILEX_LOW_BITS
#undef TILEY_LOW_BITS
-