Index: include/gpu/GrDrawContext.h |
diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h |
index 03dd8c4d86e319d01181dfdd4266710d422629ad..5e1dc07d16423158a708bb8ce170dd64c4174098 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 |