Skia
2DGraphicsLibrary
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GrDrawContext Class Reference
Inheritance diagram for GrDrawContext:
SkRefCnt SkRefCntBase

Public Member Functions

bool copySurface (GrSurface *src, const SkIRect &srcRect, const SkIPoint &dstPoint)
 
virtual void drawText (const GrClip &, const GrPaint &, const SkPaint &, const SkMatrix &viewMatrix, const char text[], size_t byteLength, SkScalar x, SkScalar y, const SkIRect &clipBounds)
 
virtual 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)
 
virtual void drawTextBlob (const GrClip &, const SkPaint &, const SkMatrix &viewMatrix, const SkTextBlob *, SkScalar x, SkScalar y, SkDrawFilter *, const SkIRect &clipBounds)
 
void discard ()
 Provides a perfomance hint that the render target's contents are allowed to become undefined.
 
void clear (const SkIRect *rect, GrColor color, bool canIgnoreRect)
 Clear the entire or rect of the render target, ignoring any clips. More...
 
void drawPaint (const GrClip &, const GrPaint &, const SkMatrix &viewMatrix)
 Draw everywhere (respecting the clip) with the paint.
 
void drawRect (const GrClip &, const GrPaint &paint, const SkMatrix &viewMatrix, const SkRect &, const GrStyle *style=nullptr)
 Draw the rect using a paint. More...
 
void fillRectToRect (const GrClip &, const GrPaint &paint, const SkMatrix &viewMatrix, const SkRect &rectToDraw, const SkRect &localRect)
 Maps a rectangle of shader coordinates to a rectangle and fills that rectangle. More...
 
void fillRectWithLocalMatrix (const GrClip &clip, const GrPaint &paint, const SkMatrix &viewMatrix, const SkRect &rect, const SkMatrix &localMatrix)
 Fills a rect with a paint and a localMatrix.
 
void drawRRect (const GrClip &, const GrPaint &, const SkMatrix &viewMatrix, const SkRRect &rrect, const GrStyle &style)
 Draw a roundrect using a paint. More...
 
void drawDRRect (const GrClip &, const GrPaint &, const SkMatrix &viewMatrix, const SkRRect &outer, const SkRRect &inner)
 Shortcut for drawing an SkPath consisting of nested rrects using a paint. More...
 
void drawPath (const GrClip &, const GrPaint &, const SkMatrix &viewMatrix, const SkPath &, const GrStyle &style)
 Draws a path. More...
 
void drawVertices (const GrClip &, const GrPaint &paint, const SkMatrix &viewMatrix, GrPrimitiveType primitiveType, int vertexCount, const SkPoint positions[], const SkPoint texs[], const GrColor colors[], const uint16_t indices[], int indexCount)
 Draws vertices with a paint. More...
 
void drawAtlas (const GrClip &, const GrPaint &paint, const SkMatrix &viewMatrix, int spriteCount, const SkRSXform xform[], const SkRect texRect[], const SkColor colors[])
 Draws textured sprites from an atlas with a paint. More...
 
void drawOval (const GrClip &, const GrPaint &paint, const SkMatrix &viewMatrix, const SkRect &oval, const GrStyle &style)
 Draws an oval. More...
 
void drawArc (const GrClip &, const GrPaint &paint, const SkMatrix &viewMatrix, const SkRect &oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, const GrStyle &style)
 Draws a partial arc of an oval. More...
 
void drawImageLattice (const GrClip &, const GrPaint &paint, const SkMatrix &viewMatrix, int imageWidth, int imageHeight, std::unique_ptr< SkLatticeIter > iter, const SkRect &dst)
 Draw the image as a set of rects, specified by |iter|.
 
void prepareForExternalIO ()
 After this returns any pending surface IO will be issued to the backend 3D API and if the surface has MSAA it will be resolved.
 
bool isStencilBufferMultisampled () const
 
bool isUnifiedMultisampled () const
 
bool hasMixedSamples () const
 
bool mustUseHWAA (const GrPaint &paint) const
 
const GrSurfaceDescdesc () const
 
int width () const
 
int height () const
 
GrPixelConfig config () const
 
int numColorSamples () const
 
bool isGammaCorrect () const
 
SkSourceGammaTreatment sourceGammaTreatment () const
 
const SkSurfacePropssurfaceProps () const
 
SkColorSpacegetColorSpace () const
 
GrSurfaceOrigin origin () const
 
bool wasAbandoned () const
 
GrRenderTargetaccessRenderTarget ()
 
sk_sp< GrRenderTargetrenderTarget ()
 
sk_sp< GrTextureasTexture ()
 
GrDrawContextPriv drawContextPriv ()
 
const GrDrawContextPriv drawContextPriv () const
 
GrAuditTrail * auditTrail ()
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 Default construct, initializing the reference count to 1.
 
virtual ~SkRefCntBase ()
 Destruct, asserting that the reference count is 1.
 
int32_t getRefCnt () const
 Return the reference count. More...
 
void validate () const
 
bool unique () const
 May return true if the caller is the only owner. More...
 
void ref () const
 Increment the reference count. More...
 
void unref () const
 Decrement the reference count. More...
 

Protected Member Functions

 GrDrawContext (GrContext *, GrDrawingManager *, sk_sp< GrRenderTarget >, sk_sp< SkColorSpace >, const SkSurfaceProps *surfaceProps, GrAuditTrail *, GrSingleOwner *)
 
GrDrawingManager * drawingManager ()
 
 SkDEBUGCODE (GrSingleOwner *singleOwner(){return fSingleOwner;}) SkDEBUGCODE(void validate() const
 
- Protected Member Functions inherited from SkRefCntBase
void internal_dispose_restore_refcnt_to_1 () const
 Allow subclasses to call this if they've overridden internal_dispose so they can reset fRefCnt before the destructor is called or if they choose not to call the destructor (e.g. More...
 

Private Member Functions

bool drawFilledDRRect (const GrClip &clip, const GrPaint &paint, const SkMatrix &viewMatrix, const SkRRect &origOuter, const SkRRect &origInner)
 
bool drawFilledRect (const GrClip &clip, const GrPaint &paint, const SkMatrix &viewMatrix, const SkRect &rect, const GrUserStencilSettings *ss)
 
void drawNonAAFilledRect (const GrClip &, const GrPaint &, const SkMatrix &viewMatrix, const SkRect &rect, const SkRect *localRect, const SkMatrix *localMatrix, const GrUserStencilSettings *ss, bool useHWAA)
 
void internalDrawPath (const GrClip &clip, const GrPaint &paint, const SkMatrix &viewMatrix, const SkPath &path, const GrStyle &style)
 
void drawBatch (const GrPipelineBuilder &pipelineBuilder, const GrClip &, GrDrawBatch *batch)
 
GrDrawTarget * getDrawTarget ()
 

Private Attributes

GrDrawingManager * fDrawingManager
 
sk_sp< GrRenderTargetfRenderTarget
 
GrDrawTarget * fDrawTarget
 
GrContextfContext
 
GrInstancedPipelineInfo fInstancedPipelineInfo
 
sk_sp< SkColorSpacefColorSpace
 
SkSurfaceProps fSurfaceProps
 
GrAuditTrail * fAuditTrail
 

Friends

class GrAtlasTextBlob
 
class GrStencilAndCoverTextContext
 
class GrDrawingManager
 
class GrDrawContextPriv
 
class GrTestTarget
 
class GrSWMaskHelper
 
class GrSoftwarePathRenderer
 
class GrAAConvexPathRenderer
 
class GrDashLinePathRenderer
 
class GrAAHairLinePathRenderer
 
class GrAALinearizingConvexPathRenderer
 
class GrAADistanceFieldPathRenderer
 
class GrDefaultPathRenderer
 
class GrPLSPathRenderer
 
class GrMSAAPathRenderer
 
class GrStencilAndCoverPathRenderer
 
class GrTessellatingPathRenderer
 

Member Function Documentation

void GrDrawContext::clear ( const SkIRect rect,
GrColor  color,
bool  canIgnoreRect 
)

Clear the entire or rect of the render target, ignoring any clips.

Parameters
rectthe rect to clear or the whole thing if rect is NULL.
colorthe color to clear to.
canIgnoreRectallows partial clears to be converted to whole clears on platforms for which that is cheap
void GrDrawContext::drawArc ( const GrClip ,
const GrPaint paint,
const SkMatrix viewMatrix,
const SkRect oval,
SkScalar  startAngle,
SkScalar  sweepAngle,
bool  useCenter,
const GrStyle &  style 
)

Draws a partial arc of an oval.

Parameters
paintdescribes how to color pixels.
viewMatrixtransformation matrix.
ovalthe bounding rect of the oval.
startAnglestarting angle in degrees.
sweepAngleangle to sweep in degrees. Must be in (-360, 360)
useCentertrue means that the implied path begins at the oval center, connects as a line to the point indicated by the start contains the arc indicated by the sweep angle. If false the line beginning at the center point is omitted.
stylestyle to apply to the oval.
void GrDrawContext::drawAtlas ( const GrClip ,
const GrPaint paint,
const SkMatrix viewMatrix,
int  spriteCount,
const SkRSXform  xform[],
const SkRect  texRect[],
const SkColor  colors[] 
)

Draws textured sprites from an atlas with a paint.

Parameters
paintdescribes how to color pixels.
viewMatrixtransformation matrix
spriteCountnumber of sprites.
xformarray of compressed transformation data, required.
texRectarray of texture rectangles used to access the paint.
colorsoptional array of per-sprite colors, supercedes the paint's color field.
void GrDrawContext::drawDRRect ( const GrClip ,
const GrPaint ,
const SkMatrix viewMatrix,
const SkRRect outer,
const SkRRect inner 
)

Shortcut for drawing an SkPath consisting of nested rrects using a paint.

Does not support stroking. The result is undefined if outer does not contain inner.

Parameters
paintdescribes how to color pixels.
viewMatrixtransformation matrix
outerthe outer roundrect
innerthe inner roundrect
void GrDrawContext::drawOval ( const GrClip ,
const GrPaint paint,
const SkMatrix viewMatrix,
const SkRect oval,
const GrStyle &  style 
)

Draws an oval.

Parameters
paintdescribes how to color pixels.
viewMatrixtransformation matrix
ovalthe bounding rect of the oval.
stylestyle to apply to the oval. Currently path effects are not allowed.
void GrDrawContext::drawPath ( const GrClip ,
const GrPaint ,
const SkMatrix viewMatrix,
const SkPath ,
const GrStyle &  style 
)

Draws a path.

Parameters
paintdescribes how to color pixels.
viewMatrixtransformation matrix
paththe path to draw
stylestyle to apply to the path.
void GrDrawContext::drawRect ( const GrClip ,
const GrPaint paint,
const SkMatrix viewMatrix,
const SkRect ,
const GrStyle *  style = nullptr 
)

Draw the rect using a paint.

Parameters
paintdescribes how to color pixels.
viewMatrixtransformation matrix
styleThe style to apply. Null means fill. Currently path effects are not allowed. The rects coords are used to access the paint (through texture matrix)
void GrDrawContext::drawRRect ( const GrClip ,
const GrPaint ,
const SkMatrix viewMatrix,
const SkRRect rrect,
const GrStyle &  style 
)

Draw a roundrect using a paint.

Parameters
paintdescribes how to color pixels.
viewMatrixtransformation matrix
rrectthe roundrect to draw
stylestyle to apply to the rrect. Currently path effects are not allowed.
void GrDrawContext::drawVertices ( const GrClip ,
const GrPaint paint,
const SkMatrix viewMatrix,
GrPrimitiveType  primitiveType,
int  vertexCount,
const SkPoint  positions[],
const SkPoint  texs[],
const GrColor  colors[],
const uint16_t  indices[],
int  indexCount 
)

Draws vertices with a paint.

Parameters
paintdescribes how to color pixels.
viewMatrixtransformation matrix
primitiveTypeprimitives type to draw.
vertexCountnumber of vertices.
positionsarray of vertex positions, required.
texCoordsoptional array of texture coordinates used to access the paint.
colorsoptional array of per-vertex colors, supercedes the paint's color field.
indicesoptional array of indices. If NULL vertices are drawn non-indexed.
indexCountif indices is non-null then this is the number of indices.
void GrDrawContext::fillRectToRect ( const GrClip ,
const GrPaint paint,
const SkMatrix viewMatrix,
const SkRect rectToDraw,
const SkRect localRect 
)

Maps a rectangle of shader coordinates to a rectangle and fills that rectangle.

Parameters
paintdescribes how to color pixels.
viewMatrixtransformation matrix which applies to rectToDraw
rectToDrawthe rectangle to draw
localRectthe rectangle of shader coordinates applied to rectToDraw

The documentation for this class was generated from the following file: