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

Unified Diff: src/gpu/GrTextContext.h

Issue 1015173002: Let text contexts fall back directly to paths (Closed) Base URL: https://skia.googlesource.com/skia.git@text-blob-to-context
Patch Set: feedback inc Created 5 years, 9 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: src/gpu/GrTextContext.h
diff --git a/src/gpu/GrTextContext.h b/src/gpu/GrTextContext.h
index d333c631413f751d3b89378f921b4dee815e9994..40a08b6b0d6754d9a93b690f173d0442954fc470 100644
--- a/src/gpu/GrTextContext.h
+++ b/src/gpu/GrTextContext.h
@@ -19,6 +19,7 @@ class GrClip;
class GrContext;
class GrDrawTarget;
class GrFontScaler;
+class SkGpuDevice;
/*
* This class wraps the state for a single text render
@@ -27,18 +28,23 @@ class GrTextContext {
public:
virtual ~GrTextContext();
- bool drawText(GrRenderTarget* rt, const GrClip&, const GrPaint&, const SkPaint&,
+ void drawText(GrRenderTarget* rt, const GrClip&, const GrPaint&, const SkPaint&,
const SkMatrix& viewMatrix, const char text[], size_t byteLength, SkScalar x,
- SkScalar y);
- bool drawPosText(GrRenderTarget* rt, const GrClip&, const GrPaint&, const SkPaint&,
+ SkScalar y, const SkIRect& clipBounds);
+ void drawPosText(GrRenderTarget* rt, const GrClip&, const GrPaint&, const SkPaint&,
const SkMatrix& viewMatrix,
const char text[], size_t byteLength,
const SkScalar pos[], int scalarsPerPosition,
- const SkPoint& offset);
+ const SkPoint& offset, const SkIRect& clipBounds);
protected:
GrTextContext* fFallbackTextContext;
GrContext* fContext;
+ // TODO we probably don't really need to store a back pointer to the owning SkGpuDevice, except
+ // we need to be able to call drawPath on it in the event no other text context can draw the
+ // text. We might be able to move this logic to context though. This is unreffed because
+ // GrTextContext is completely owned by SkGpuDevice
+ SkGpuDevice* fGpuDevice;
SkDeviceProperties fDeviceProperties;
SkAutoTUnref<GrRenderTarget> fRenderTarget;
@@ -48,7 +54,7 @@ protected:
GrPaint fPaint;
SkPaint fSkPaint;
- GrTextContext(GrContext*, const SkDeviceProperties&);
+ GrTextContext(GrContext*, SkGpuDevice*, const SkDeviceProperties&);
virtual bool canDraw(const SkPaint& paint, const SkMatrix& viewMatrix) = 0;
@@ -61,6 +67,14 @@ protected:
const SkScalar pos[], int scalarsPerPosition,
const SkPoint& offset) = 0;
+ void drawTextAsPath(const SkPaint& origPaint, const SkMatrix& viewMatrix,
+ const char text[], size_t byteLength, SkScalar x, SkScalar y,
+ const SkIRect& clipBounds);
+ void drawPosTextAsPath(const SkPaint& origPaint, const SkMatrix& viewMatrix,
+ const char text[], size_t byteLength,
+ const SkScalar pos[], int scalarsPerPosition,
+ const SkPoint& offset, const SkIRect& clipBounds);
+
void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&);
void finish() { fDrawTarget = NULL; }
@@ -68,6 +82,9 @@ protected:
// sets extent in stopVector and returns glyph count
static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc,
const char text[], size_t byteLength, SkVector* stopVector);
+
+ friend class GrDistanceFieldTextContext;
+ friend class GrStencilAndCoverTextContext;
};
#endif

Powered by Google App Engine
This is Rietveld 408576698