aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/core/SkPaint.h1
-rwxr-xr-xinclude/gpu/GrBitmapTextContext.h10
-rwxr-xr-xinclude/gpu/GrDistanceFieldTextContext.h19
-rw-r--r--include/gpu/GrTextContext.h51
-rw-r--r--include/gpu/SkGpuDevice.h2
5 files changed, 45 insertions, 38 deletions
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index ab93eac102..00ec29e42e 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -1071,6 +1071,7 @@ private:
friend class SkDraw;
friend class SkGraphics; // So Term() can be called.
friend class SkPDFDevice;
+ friend class GrBitmapTextContext;
friend class GrDistanceFieldTextContext;
friend class SkTextToPathIter;
friend class SkCanonicalizePaint;
diff --git a/include/gpu/GrBitmapTextContext.h b/include/gpu/GrBitmapTextContext.h
index e1b3d725a9..c66f8a8564 100755
--- a/include/gpu/GrBitmapTextContext.h
+++ b/include/gpu/GrBitmapTextContext.h
@@ -17,17 +17,19 @@ class GrTextStrike;
*/
class GrBitmapTextContext : public GrTextContext {
public:
- virtual void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top,
- GrFontScaler*) SK_OVERRIDE;
+ virtual void drawText(const char text[], size_t byteLength, SkScalar x, SkScalar y) SK_OVERRIDE;
+ virtual void drawPosText(const char text[], size_t byteLength,
+ const SkScalar pos[], SkScalar constY,
+ int scalarsPerPosition) SK_OVERRIDE;
private:
- GrBitmapTextContext(GrContext*, const GrPaint&, const SkPaint&);
+ GrBitmapTextContext(GrContext*, const GrPaint&, const SkPaint&, const SkDeviceProperties&);
virtual ~GrBitmapTextContext();
friend class GrTTextContextManager<GrBitmapTextContext>;
- GrContext::AutoMatrix fAutoMatrix;
GrTextStrike* fStrike;
+ void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontScaler*);
void flushGlyphs(); // automatically called by destructor
enum {
diff --git a/include/gpu/GrDistanceFieldTextContext.h b/include/gpu/GrDistanceFieldTextContext.h
index 4fde6ceef8..79058b8bbd 100755
--- a/include/gpu/GrDistanceFieldTextContext.h
+++ b/include/gpu/GrDistanceFieldTextContext.h
@@ -17,26 +17,21 @@ class GrTextStrike;
*/
class GrDistanceFieldTextContext : public GrTextContext {
public:
- virtual void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top,
- GrFontScaler*) SK_OVERRIDE;
-
- void drawText(const char text[], size_t byteLength,
- SkScalar x, SkScalar y, SkGlyphCache*, GrFontScaler*);
- void drawPosText(const char text[], size_t byteLength,
- const SkScalar pos[], SkScalar constY,
- int scalarsPerPosition,
- SkGlyphCache* cache, GrFontScaler* fontScaler);
-
- const SkPaint& getSkPaint() { return fSkPaint; }
+ virtual void drawText(const char text[], size_t byteLength, SkScalar x, SkScalar y) SK_OVERRIDE;
+ virtual void drawPosText(const char text[], size_t byteLength,
+ const SkScalar pos[], SkScalar constY,
+ 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>;
GrTextStrike* fStrike;
SkScalar fTextRatio;
+ void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontScaler*);
void flushGlyphs(); // automatically called by destructor
enum {
diff --git a/include/gpu/GrTextContext.h b/include/gpu/GrTextContext.h
index 1539df09a0..a8c0df0bda 100644
--- a/include/gpu/GrTextContext.h
+++ b/include/gpu/GrTextContext.h
@@ -8,9 +8,10 @@
#ifndef GrTextContext_DEFINED
#define GrTextContext_DEFINED
-#include "GrContext.h"
+#include "GrPoint.h"
#include "GrGlyph.h"
#include "GrPaint.h"
+#include "SkDeviceProperties.h"
#include "SkPostConfig.h"
@@ -24,18 +25,25 @@ class GrFontScaler;
class GrTextContext {
public:
virtual ~GrTextContext() {}
- virtual void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top,
- GrFontScaler*) = 0;
+ virtual void drawText(const char text[], size_t byteLength, SkScalar x, SkScalar y) = 0;
+ virtual void drawPosText(const char text[], size_t byteLength,
+ const SkScalar pos[], SkScalar constY,
+ int scalarsPerPosition) = 0;
protected:
- GrTextContext(GrContext*, const GrPaint&, const SkPaint&);
-
- GrPaint fPaint;
- SkPaint fSkPaint;
- GrContext* fContext;
- GrDrawTarget* fDrawTarget;
-
- SkIRect fClipRect;
+ GrTextContext(GrContext*, const GrPaint&, const SkPaint&, const SkDeviceProperties&);
+
+ 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;
+ SkDeviceProperties fDeviceProperties;
+ GrDrawTarget* fDrawTarget;
+
+ SkIRect fClipRect;
};
/*
@@ -45,8 +53,8 @@ protected:
class GrTextContextManager {
public:
virtual ~GrTextContextManager() {}
- virtual GrTextContext* create(GrContext* context, const GrPaint& grPaint,
- const SkPaint& skPaint) = 0;
+ virtual GrTextContext* create(GrContext* grContext, const GrPaint& grPaint,
+ const SkPaint& skPaint, const SkDeviceProperties& props) = 0;
};
template <class TextContextClass>
@@ -54,13 +62,14 @@ class GrTTextContextManager : public GrTextContextManager {
private:
class ManagedTextContext : public TextContextClass {
public:
- ~ManagedTextContext() {}
+ virtual ~ManagedTextContext() {}
- ManagedTextContext(GrContext* context,
+ ManagedTextContext(GrContext* grContext,
const GrPaint& grPaint,
const SkPaint& skPaint,
+ const SkDeviceProperties& properties,
GrTTextContextManager<TextContextClass>* manager) :
- TextContextClass(context, grPaint, skPaint) {
+ TextContextClass(grContext, grPaint, skPaint, properties) {
fManager = manager;
}
@@ -84,17 +93,19 @@ public:
fUsed = false;
}
- ~GrTTextContextManager() {
+ virtual ~GrTTextContextManager() {
SkASSERT(!fUsed);
sk_free(fAllocation);
}
- GrTextContext* create(GrContext* context, const GrPaint& grPaint,
- const SkPaint& skPaint) {
+ virtual GrTextContext* create(GrContext* grContext, const GrPaint& grPaint,
+ const SkPaint& skPaint, const SkDeviceProperties& properties)
+ SK_OVERRIDE {
// add check for usePath here?
SkASSERT(!fUsed);
ManagedTextContext* obj = SkNEW_PLACEMENT_ARGS(fAllocation, ManagedTextContext,
- (context, grPaint, skPaint, this));
+ (grContext, grPaint, skPaint, properties,
+ this));
fUsed = true;
return obj;
}
diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h
index 2888951e47..addf678654 100644
--- a/include/gpu/SkGpuDevice.h
+++ b/include/gpu/SkGpuDevice.h
@@ -167,8 +167,6 @@ private:
bool isOpaque,
Usage usage) SK_OVERRIDE;
- SkDrawProcs* initDrawForText(GrTextContext*);
-
// sets the render target, clip, and matrix on GrContext. Use forceIdenity to override
// SkDraw's matrix and draw in device coords.
void prepareDraw(const SkDraw&, bool forceIdentity);