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
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GrFontScaler_DEFINED
|
|
|
|
#define GrFontScaler_DEFINED
|
|
|
|
|
|
|
|
#include "GrGlyph.h"
|
|
|
|
#include "GrKey.h"
|
|
|
|
|
2011-05-16 17:21:57 +00:00
|
|
|
class SkPath;
|
2010-12-22 21:39:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is a virtual base class which Gr's interface to the host platform's
|
|
|
|
* font scaler.
|
|
|
|
*
|
|
|
|
* The client is responsible for subclassing, and instantiating this. The
|
2014-04-01 16:25:11 +00:00
|
|
|
* instance is created for a specific font+size+matrix.
|
2010-12-22 21:39:39 +00:00
|
|
|
*/
|
2013-09-09 13:38:37 +00:00
|
|
|
class GrFontScaler : public SkRefCnt {
|
2010-12-22 21:39:39 +00:00
|
|
|
public:
|
2012-06-26 20:16:17 +00:00
|
|
|
SK_DECLARE_INST_COUNT(GrFontScaler)
|
|
|
|
|
2010-12-22 21:39:39 +00:00
|
|
|
virtual const GrKey* getKey() = 0;
|
2011-03-15 15:40:16 +00:00
|
|
|
virtual GrMaskFormat getMaskFormat() = 0;
|
2013-07-17 21:39:42 +00:00
|
|
|
virtual bool getPackedGlyphBounds(GrGlyph::PackedID, SkIRect* bounds) = 0;
|
2010-12-22 21:39:39 +00:00
|
|
|
virtual bool getPackedGlyphImage(GrGlyph::PackedID, int width, int height,
|
|
|
|
int rowBytes, void* image) = 0;
|
2014-04-14 22:05:07 +00:00
|
|
|
// get bounds for distance field associated with packed ID
|
|
|
|
virtual bool getPackedGlyphDFBounds(GrGlyph::PackedID, SkIRect* bounds) = 0;
|
|
|
|
// copies distance field bytes into pre-allocated dfImage
|
|
|
|
// (should be width*height bytes in size)
|
|
|
|
virtual bool getPackedGlyphDFImage(GrGlyph::PackedID, int width, int height,
|
|
|
|
void* dfImage) = 0;
|
2011-05-16 17:21:57 +00:00
|
|
|
virtual bool getGlyphPath(uint16_t glyphID, SkPath*) = 0;
|
2012-06-26 20:16:17 +00:00
|
|
|
|
|
|
|
private:
|
2013-09-09 13:38:37 +00:00
|
|
|
typedef SkRefCnt INHERITED;
|
2010-12-22 21:39:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|