aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'include/gpu')
-rw-r--r--include/gpu/GrContext.h7
-rw-r--r--include/gpu/GrDrawContext.h51
2 files changed, 24 insertions, 34 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index b79ab640a4..91ae2d1001 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -175,12 +175,13 @@ public:
* Callers should take a ref if they rely on the GrDrawContext sticking around.
* NULL will be returned if the context has been abandoned.
*
+ * @param rt the render target receiving the draws
* @param surfaceProps the surface properties (mainly defines text drawing)
*
* @return a draw context
*/
- GrDrawContext* drawContext(const SkSurfaceProps* surfaceProps = NULL) {
- return fDrawingMgr.drawContext(surfaceProps);
+ GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps* surfaceProps = NULL) {
+ return fDrawingMgr.drawContext(rt, surfaceProps);
}
GrTextContext* textContext(const SkSurfaceProps& surfaceProps, GrRenderTarget* rt) {
@@ -441,7 +442,7 @@ private:
// Callers assume the creation ref of the drawContext!
// NULL will be returned if the context has been abandoned.
- GrDrawContext* drawContext(const SkSurfaceProps* surfaceProps);
+ GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps* surfaceProps);
GrTextContext* textContext(const SkSurfaceProps& props, GrRenderTarget* rt);
diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h
index 03dd8c4d86..5e1dc07d16 100644
--- a/include/gpu/GrDrawContext.h
+++ b/include/gpu/GrDrawContext.h
@@ -44,20 +44,19 @@ class SK_API GrDrawContext : public SkRefCnt {
public:
~GrDrawContext() override;
- void copySurface(GrRenderTarget* dst, GrSurface* src,
- const SkIRect& srcRect, const SkIPoint& dstPoint);
+ void copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint);
// 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&,
+ void drawText(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&,
+ void drawPosText(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&,
+ void drawTextBlob(const GrClip&, const SkPaint&,
const SkMatrix& viewMatrix, const SkTextBlob*,
SkScalar x, SkScalar y,
SkDrawFilter*, const SkIRect& clipBounds);
@@ -76,22 +75,21 @@ public:
* Provides a perfomance hint that the render target's contents are allowed
* to become undefined.
*/
- void discard(GrRenderTarget*);
+ void discard();
/**
* Clear the entire or rect of the render target, ignoring any clips.
- * @param target The render target to clear.
* @param rect the rect to clear or the whole thing if rect is NULL.
* @param color the color to clear to.
* @param canIgnoreRect allows partial clears to be converted to whole
* clears on platforms for which that is cheap
*/
- void clear(GrRenderTarget*, const SkIRect* rect, GrColor color, bool canIgnoreRect);
+ void clear(const SkIRect* rect, GrColor color, bool canIgnoreRect);
/**
* Draw everywhere (respecting the clip) with the paint.
*/
- void drawPaint(GrRenderTarget*, const GrClip&, const GrPaint&, const SkMatrix& viewMatrix);
+ void drawPaint(const GrClip&, const GrPaint&, const SkMatrix& viewMatrix);
/**
* Draw the rect using a paint.
@@ -105,8 +103,7 @@ public:
* mitered/beveled stroked based on stroke width.
* The rects coords are used to access the paint (through texture matrix)
*/
- void drawRect(GrRenderTarget*,
- const GrClip&,
+ void drawRect(const GrClip&,
const GrPaint& paint,
const SkMatrix& viewMatrix,
const SkRect&,
@@ -120,8 +117,7 @@ public:
* @param rectToDraw the rectangle to draw
* @param localRect the rectangle of shader coordinates applied to rectToDraw
*/
- void drawNonAARectToRect(GrRenderTarget*,
- const GrClip&,
+ void drawNonAARectToRect(const GrClip&,
const GrPaint& paint,
const SkMatrix& viewMatrix,
const SkRect& rectToDraw,
@@ -130,8 +126,7 @@ public:
/**
* Draws a non-AA rect with paint and a localMatrix
*/
- void drawNonAARectWithLocalMatrix(GrRenderTarget* rt,
- const GrClip& clip,
+ void drawNonAARectWithLocalMatrix(const GrClip& clip,
const GrPaint& paint,
const SkMatrix& viewMatrix,
const SkRect& rect,
@@ -146,8 +141,7 @@ public:
* @param strokeInfo the stroke information (width, join, cap) and
* the dash information (intervals, count, phase).
*/
- void drawRRect(GrRenderTarget*,
- const GrClip&,
+ void drawRRect(const GrClip&,
const GrPaint&,
const SkMatrix& viewMatrix,
const SkRRect& rrect,
@@ -163,8 +157,7 @@ public:
* @param outer the outer roundrect
* @param inner the inner roundrect
*/
- void drawDRRect(GrRenderTarget*,
- const GrClip&,
+ void drawDRRect(const GrClip&,
const GrPaint&,
const SkMatrix& viewMatrix,
const SkRRect& outer,
@@ -180,8 +173,7 @@ public:
* @param strokeInfo the stroke information (width, join, cap) and
* the dash information (intervals, count, phase).
*/
- void drawPath(GrRenderTarget*,
- const GrClip&,
+ void drawPath(const GrClip&,
const GrPaint&,
const SkMatrix& viewMatrix,
const SkPath&,
@@ -204,8 +196,7 @@ public:
* @param indexCount if indices is non-null then this is the
* number of indices.
*/
- void drawVertices(GrRenderTarget*,
- const GrClip&,
+ void drawVertices(const GrClip&,
const GrPaint& paint,
const SkMatrix& viewMatrix,
GrPrimitiveType primitiveType,
@@ -227,8 +218,7 @@ public:
* @param colors optional array of per-sprite colors, supercedes
* the paint's color field.
*/
- void drawAtlas(GrRenderTarget*,
- const GrClip&,
+ void drawAtlas(const GrClip&,
const GrPaint& paint,
const SkMatrix& viewMatrix,
int spriteCount,
@@ -245,8 +235,7 @@ public:
* @param strokeInfo the stroke information (width, join, cap) and
* the dash information (intervals, count, phase).
*/
- void drawOval(GrRenderTarget*,
- const GrClip&,
+ void drawOval(const GrClip&,
const GrPaint& paint,
const SkMatrix& viewMatrix,
const SkRect& oval,
@@ -259,16 +248,15 @@ public:
* @param paint describes how to color pixels.
* @param batch the batch to draw
*/
- void drawBatch(GrRenderTarget*, const GrClip&, const GrPaint&, GrDrawBatch*);
+ void drawBatch(const GrClip&, const GrPaint&, GrDrawBatch*);
private:
friend class GrAtlasTextContext; // for access to drawBatch
friend class GrContext; // for ctor
- GrDrawContext(GrContext*, GrDrawTarget*, const SkSurfaceProps* surfaceProps);
+ SkDEBUGCODE(void validate() const;)
- // Checks if the context has been abandoned and if the rendertarget is owned by this context
- bool prepareToDraw(GrRenderTarget* rt);
+ GrDrawContext(GrContext*, GrRenderTarget*, GrDrawTarget*, const SkSurfaceProps* surfaceProps);
void internalDrawPath(GrDrawTarget*,
GrPipelineBuilder*,
@@ -283,6 +271,7 @@ private:
void drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* batch);
GrContext* fContext; // owning context -> no ref
+ GrRenderTarget* fRenderTarget;
GrDrawTarget* fDrawTarget;
GrTextContext* fTextContext; // lazily gotten from GrContext::DrawingMgr