Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: include/gpu/GrTextContext.h

Issue 141863005: Add standalone drawText for GrTextContext. (Closed) Base URL: https://skia.googlesource.com/skia.git@issue2018-factory
Patch Set: Remove SkDevice* from TextContext. Fix up some SK_OVERRIDEs. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/gpu/GrTextContext.h
diff --git a/include/gpu/GrTextContext.h b/include/gpu/GrTextContext.h
index 1539df09a019e5b0227acf7003ee41f6011502ff..ca6469f0330f977508789bc5c9042095b30320a7 100644
--- a/include/gpu/GrTextContext.h
+++ b/include/gpu/GrTextContext.h
@@ -14,7 +14,7 @@
#include "SkPostConfig.h"
-class GrContext;
+class SkGpuDevice;
class GrDrawTarget;
class GrFontScaler;
@@ -24,16 +24,23 @@ 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;
+ 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;
+ const SkDeviceProperties* fDeviceProperties;
+ GrPaint fPaint;
+ SkPaint fSkPaint;
+ GrDrawTarget* fDrawTarget;
SkIRect fClipRect;
};
@@ -45,8 +52,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 +61,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 +92,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;
}

Powered by Google App Engine
This is Rietveld 408576698