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

Unified Diff: include/gpu/GrDrawContext.h

Issue 1175553002: Make GrTextContext be owned by the GrDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix nvpr config Created 5 years, 6 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/GrContext.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrDrawContext.h
diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h
index 4b78c89f918379586266c024cb7dd5398eaab828..7e711260cec282f46401c2a67f98c3ee0c1535ce 100644
--- a/include/gpu/GrDrawContext.h
+++ b/include/gpu/GrDrawContext.h
@@ -22,14 +22,18 @@ class GrPipelineBuilder;
class GrRenderTarget;
class GrStrokeInfo;
class GrSurface;
+class GrTextContext;
+struct SkDeviceProperties;
+class SkDrawFilter;
struct SkIPoint;
struct SkIRect;
class SkMatrix;
+class SkPaint;
class SkPath;
struct SkPoint;
struct SkRect;
class SkRRect;
-
+class SkTextBlob;
/*
* A helper object to orchestrate draws
@@ -38,14 +42,28 @@ class SK_API GrDrawContext : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrDrawContext)
+ ~GrDrawContext() override;
+
void copySurface(GrRenderTarget* dst, GrSurface* src,
const SkIRect& srcRect, const SkIPoint& dstPoint);
- // drawText and drawPaths are thanks to the GrAtlasTextContext and the
- // GrStencilAndCoverTextContext respectively
- // TODO: remove these two
- void drawText(GrPipelineBuilder* pipelineBuilder, GrBatch* batch);
+ // TODO: it is odd that we need both the SkPaint in the following 3 methods.
+ // We should extract the text parameters from SkPaint and pass them separately
+ // akin to GrStrokeInfo (GrTextInfo?)
+ void drawText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&,
+ const SkMatrix& viewMatrix, const char text[], size_t byteLength,
+ SkScalar x, SkScalar y, const SkIRect& clipBounds);
+ void drawPosText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&,
+ const SkMatrix& viewMatrix, const char text[], size_t byteLength,
+ const SkScalar pos[], int scalarsPerPosition,
+ const SkPoint& offset, const SkIRect& clipBounds);
+ void drawTextBlob(GrRenderTarget*, const GrClip&, const SkPaint&,
+ const SkMatrix& viewMatrix, const SkTextBlob*,
+ SkScalar x, SkScalar y,
+ SkDrawFilter*, const SkIRect& clipBounds);
+ // drawPaths is thanks to GrStencilAndCoverTextContext
+ // TODO: remove
void drawPaths(GrPipelineBuilder* pipelineBuilder,
const GrPathProcessor* pathProc,
const GrPathRange* pathRange,
@@ -223,16 +241,17 @@ public:
private:
+ friend class GrAtlasTextContext; // for access to drawBatch
friend class GrContext; // for ctor
- GrDrawContext(GrContext* context, GrDrawTarget* drawTarget);
- ~GrDrawContext() override;
+ GrDrawContext(GrContext*, GrDrawTarget*, const SkDeviceProperties&, bool useDFT);
// Sets the paint. Returns true on success; false on failure.
bool prepareToDraw(GrPipelineBuilder*,
GrRenderTarget* rt,
const GrClip&,
const GrPaint* paint);
+ GrTextContext* createTextContext(GrRenderTarget*, const SkDeviceProperties&, bool useDFT);
// A simpler version of the above which just returns true on success; false on failure.
// Clip is *NOT* set
@@ -246,8 +265,16 @@ private:
const SkPath&,
const GrStrokeInfo&);
- GrContext* fContext; // owning context -> no ref
- GrDrawTarget* fDrawTarget;
+ // This entry point allows the GrTextContext-derived classes to add their batches to
+ // the drawTarget.
+ void drawBatch(GrPipelineBuilder* pipelineBuilder, GrBatch* batch);
+
+ GrContext* fContext; // owning context -> no ref
+ GrDrawTarget* fDrawTarget;
+ GrTextContext* fTextContext; // lazily created
+
+ SkDeviceProperties* fDevProps; // ptr b.c. SkDeviceProperties isn't public
+ bool fUseDFT;
};
#endif
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698