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

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: One more Mac compile error. 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
« no previous file with comments | « include/gpu/GrDistanceFieldTextContext.h ('k') | include/gpu/SkGpuDevice.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrTextContext.h
diff --git a/include/gpu/GrTextContext.h b/include/gpu/GrTextContext.h
index 1539df09a019e5b0227acf7003ee41f6011502ff..a8c0df0bda7c412018e185b9204809a91c953d99 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;
}
« no previous file with comments | « include/gpu/GrDistanceFieldTextContext.h ('k') | include/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698