Flutter Engine
The Flutter Engine
|
#include <SurfaceDrawContext.h>
Public Types | |
enum class | QuadOptimization { kDiscarded , kSubmitted , kClipApplied , kCropped } |
using | WillAddOpFn = void(GrOp *, uint32_t opsTaskID) |
Public Types inherited from skgpu::ganesh::SurfaceContext | |
using | ReadPixelsCallback = SkImage::ReadPixelsCallback |
using | ReadPixelsContext = SkImage::ReadPixelsContext |
using | RescaleGamma = SkImage::RescaleGamma |
using | RescaleMode = SkImage::RescaleMode |
Private Member Functions | |
void | willReplaceOpsTask (OpsTask *prevTask, OpsTask *nextTask) override |
OpsTask::CanDiscardPreviousOps | canDiscardPreviousOpsOnFullClear () const override |
Additional Inherited Members | |
Protected Member Functions inherited from skgpu::ganesh::SurfaceFillContext | |
OpsTask * | replaceOpsTask () |
void | addOp (GrOp::Owner) |
template<SkAlphaType AlphaType> | |
std::array< float, 4 > | adjustColorAlphaType (SkRGBA4f< AlphaType > color) const |
Protected Member Functions inherited from skgpu::ganesh::SurfaceContext | |
GrDrawingManager * | drawingManager () |
const GrDrawingManager * | drawingManager () const |
PixelTransferResult | transferPixels (GrColorType colorType, const SkIRect &rect) |
void | asyncReadPixels (GrDirectContext *, const SkIRect &srcRect, SkColorType, ReadPixelsCallback, ReadPixelsContext) |
Static Protected Member Functions inherited from skgpu::ganesh::SurfaceFillContext | |
static void | ClearToGrPaint (std::array< float, 4 > color, GrPaint *paint) |
template<SkAlphaType AlphaType> | |
static std::array< float, 4 > | ConvertColor (SkRGBA4f< AlphaType > color) |
template<> | |
std::array< float, 4 > | ConvertColor (SkPMColor4f color) |
template<> | |
std::array< float, 4 > | ConvertColor (SkColor4f color) |
Protected Attributes inherited from skgpu::ganesh::SurfaceFillContext | |
GrSurfaceProxyView | fWriteView |
Protected Attributes inherited from skgpu::ganesh::SurfaceContext | |
SkDEBUGCODE(void validate() const ;) SkDEBUGCODE(skgpu GrRecordingContext * | fContext |
GrSurfaceProxyView | fReadView |
A helper object to orchestrate commands (draws, etc...) for GrSurfaces that are GrRenderTargets.
Definition at line 65 of file SurfaceDrawContext.h.
using skgpu::ganesh::SurfaceDrawContext::WillAddOpFn = void(GrOp*, uint32_t opsTaskID) |
Definition at line 570 of file SurfaceDrawContext.h.
|
strong |
Enumerator | |
---|---|
kDiscarded | |
kSubmitted | |
kClipApplied | |
kCropped |
Definition at line 388 of file SurfaceDrawContext.cpp.
skgpu::ganesh::SurfaceDrawContext::SurfaceDrawContext | ( | GrRecordingContext * | rContext, |
GrSurfaceProxyView | readView, | ||
GrSurfaceProxyView | writeView, | ||
GrColorType | colorType, | ||
sk_sp< SkColorSpace > | colorSpace, | ||
const SkSurfaceProps & | surfaceProps | ||
) |
Definition at line 294 of file SurfaceDrawContext.cpp.
|
override |
Definition at line 311 of file SurfaceDrawContext.cpp.
|
inline |
Definition at line 616 of file SurfaceDrawContext.h.
void skgpu::ganesh::SurfaceDrawContext::addDrawOp | ( | const GrClip * | clip, |
GrOp::Owner | op, | ||
const std::function< WillAddOpFn > & | willAddFn = std::function<WillAddOpFn>() |
||
) |
Definition at line 1922 of file SurfaceDrawContext.cpp.
|
inline |
Definition at line 580 of file SurfaceDrawContext.h.
|
inline |
Definition at line 596 of file SurfaceDrawContext.h.
|
overrideprivatevirtual |
Override to be called to participate in the decision to discard all previous ops if a fullscreen clear occurs.
Reimplemented from skgpu::ganesh::SurfaceFillContext.
Definition at line 803 of file SurfaceDrawContext.cpp.
|
inline |
Definition at line 593 of file SurfaceDrawContext.h.
Definition at line 600 of file SurfaceDrawContext.h.
Definition at line 604 of file SurfaceDrawContext.h.
|
inline |
Definition at line 517 of file SurfaceDrawContext.h.
bool skgpu::ganesh::SurfaceDrawContext::drawAndStencilPath | ( | const GrHardClip * | clip, |
const GrUserStencilSettings * | ss, | ||
SkRegion::Op | op, | ||
bool | invert, | ||
GrAA | doStencilMSAA, | ||
const SkMatrix & | viewMatrix, | ||
const SkPath & | path | ||
) |
Draws a path, either AA or not, and touches the stencil buffer with the user stencil settings for each color sample written.
Definition at line 1589 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawArc | ( | const GrClip * | clip, |
GrPaint && | paint, | ||
GrAA | aa, | ||
const SkMatrix & | viewMatrix, | ||
const SkRect & | oval, | ||
SkScalar | startAngle, | ||
SkScalar | sweepAngle, | ||
bool | useCenter, | ||
const GrStyle & | style | ||
) |
Draws a partial arc of an oval.
paint | describes how to color pixels. |
GrGrAA | Controls whether the arc is antialiased. |
viewMatrix | transformation matrix. |
oval | the bounding rect of the oval. |
startAngle | starting angle in degrees. |
sweepAngle | angle to sweep in degrees. Must be in (-360, 360) |
useCenter | true 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. |
style | style to apply to the oval. |
Definition at line 1418 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawAtlas | ( | const GrClip * | clip, |
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. This currently does not support AA for the sprite rectangle edges.
paint | describes how to color pixels. |
viewMatrix | transformation matrix |
spriteCount | number of sprites. |
xform | array of compressed transformation data, required. |
texRect | array of texture rectangles used to access the paint. |
colors | optional array of per-sprite colors, supercedes the paint's color field. |
Definition at line 983 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawDrawable | ( | std::unique_ptr< SkDrawable::GpuDrawHandler > | drawable, |
const SkRect & | bounds | ||
) |
Adds the necessary signal and wait semaphores and adds the passed in SkDrawable to the command stream.
Definition at line 1481 of file SurfaceDrawContext.cpp.
bool skgpu::ganesh::SurfaceDrawContext::drawFastShadow | ( | const GrClip * | clip, |
const SkMatrix & | viewMatrix, | ||
const SkPath & | path, | ||
const SkDrawShadowRec & | rec | ||
) |
Use a fast method to render the ambient and spot shadows for a path. Will return false if not possible for the given path.
viewMatrix | transformation matrix |
path | the path to shadow |
rec | parameters for shadow rendering |
Definition at line 1104 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawGlyphRunList | ( | SkCanvas * | canvas, |
const GrClip * | clip, | ||
const SkMatrix & | viewMatrix, | ||
const sktext::GlyphRunList & | glyphRunList, | ||
SkStrikeDeviceInfo | strikeDeviceInfo, | ||
const SkPaint & | paint | ||
) |
Draw the text specified by the GlyphRunList.
viewMatrix | transformation matrix |
glyphRunList | text, text positions, and paint. |
Definition at line 331 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawImageLattice | ( | const GrClip * | clip, |
GrPaint && | paint, | ||
const SkMatrix & | viewMatrix, | ||
GrSurfaceProxyView | view, | ||
SkAlphaType | alphaType, | ||
sk_sp< GrColorSpaceXform > | csxf, | ||
GrSamplerState::Filter | filter, | ||
std::unique_ptr< SkLatticeIter > | iter, | ||
const SkRect & | dst | ||
) |
Draw the image as a set of rects, specified by |iter|.
Definition at line 1459 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawMesh | ( | const GrClip * | clip, |
GrPaint && | paint, | ||
const SkMatrix & | viewMatrix, | ||
const SkMesh & | mesh, | ||
skia_private::TArray< std::unique_ptr< GrFragmentProcessor > > | children | ||
) |
Draws a custom mesh with a paint.
paint | describes how to color pixels. |
viewMatrix | transformation matrix |
mesh | the mesh to draw. |
children | child effects referenced by SkMesh shaders |
Definition at line 952 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawOval | ( | const GrClip * | clip, |
GrPaint && | paint, | ||
GrAA | aa, | ||
const SkMatrix & | viewMatrix, | ||
const SkRect & | oval, | ||
const GrStyle & | style | ||
) |
Draws an oval.
paint | describes how to color pixels. |
GrAA | Controls whether the oval is antialiased. |
viewMatrix | transformation matrix |
oval | the bounding rect of the oval. |
style | style to apply to the oval. Currently path effects are not allowed. |
Definition at line 1350 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawPaint | ( | const GrClip * | clip, |
GrPaint && | paint, | ||
const SkMatrix & | viewMatrix | ||
) |
Draw everywhere (respecting the clip) with the paint.
Definition at line 367 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawPath | ( | const GrClip * | clip, |
GrPaint && | paint, | ||
GrAA | aa, | ||
const SkMatrix & | viewMatrix, | ||
const SkPath & | path, | ||
const GrStyle & | style | ||
) |
Draws a path.
paint | describes how to color pixels. |
GrAA | Controls whether the path is antialiased. |
viewMatrix | transformation matrix |
path | the path to draw |
style | style to apply to the path. |
Definition at line 1546 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawQuadSet | ( | const GrClip * | clip, |
GrPaint && | paint, | ||
const SkMatrix & | viewMatrix, | ||
const GrQuadSetEntry | quads[], | ||
int | cnt | ||
) |
Definition at line 788 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawRect | ( | const GrClip * | clip, |
GrPaint && | paint, | ||
GrAA | aa, | ||
const SkMatrix & | viewMatrix, | ||
const SkRect & | rect, | ||
const GrStyle * | style = nullptr |
||
) |
Draw the rect using a paint.
paint | describes how to color pixels. |
GrAA | Controls whether rect is antialiased |
viewMatrix | transformation matrix |
style | The style to apply. Null means fill. Currently path effects are not allowed. The rects coords are used to access the paint (through texture matrix) |
Definition at line 679 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawRegion | ( | const GrClip * | clip, |
GrPaint && | paint, | ||
GrAA | aa, | ||
const SkMatrix & | viewMatrix, | ||
const SkRegion & | region, | ||
const GrStyle & | style, | ||
const GrUserStencilSettings * | ss = nullptr |
||
) |
Draws a region.
paint | describes how to color pixels |
viewMatrix | transformation matrix |
aa | should the rects of the region be antialiased. |
region | the region to be drawn |
style | style to apply to the region |
Definition at line 1315 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawRRect | ( | const GrClip * | origClip, |
GrPaint && | paint, | ||
GrAA | aa, | ||
const SkMatrix & | viewMatrix, | ||
const SkRRect & | rrect, | ||
const GrStyle & | style | ||
) |
Draw a roundrect using a paint.
paint | describes how to color pixels. |
GrAA | Controls whether rrect is antialiased. |
viewMatrix | transformation matrix |
rrect | the roundrect to draw |
style | style to apply to the rrect. Currently path effects are not allowed. |
Definition at line 1005 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawShape | ( | const GrClip * | clip, |
GrPaint && | paint, | ||
GrAA | aa, | ||
const SkMatrix & | viewMatrix, | ||
GrStyledShape && | shape | ||
) |
Draws a shape.
paint | describes how to color pixels. |
GrAA | Controls whether the path is antialiased. |
viewMatrix | transformation matrix |
shape | the shape to draw |
Definition at line 1561 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawStrokedLine | ( | const GrClip * | clip, |
GrPaint && | paint, | ||
GrAA | aa, | ||
const SkMatrix & | viewMatrix, | ||
const SkPoint | points[2], | ||
const SkStrokeRec & | stroke | ||
) |
Definition at line 1671 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawTexture | ( | const GrClip * | clip, |
GrSurfaceProxyView | view, | ||
SkAlphaType | srcAlphaType, | ||
GrSamplerState::Filter | filter, | ||
GrSamplerState::MipmapMode | mm, | ||
SkBlendMode | blendMode, | ||
const SkPMColor4f & | color, | ||
const SkRect & | srcRect, | ||
const SkRect & | dstRect, | ||
GrQuadAAFlags | edgeAA, | ||
SkCanvas::SrcRectConstraint | constraint, | ||
const SkMatrix & | viewMatrix, | ||
sk_sp< GrColorSpaceXform > | colorSpaceXform | ||
) |
Creates an op that draws a subrectangle of a texture. The passed color is modulated by the texture's color. 'srcRect' specifies the rectangle of the texture to draw. 'dstRect' specifies the rectangle to draw in local coords which will be transformed by 'viewMatrix' to device space.
Definition at line 580 of file SurfaceDrawContext.cpp.
|
inline |
Variant of drawTexture that instead draws the texture applied to 'dstQuad' transformed by 'viewMatrix', using the 'srcQuad' texture coordinates clamped to the optional 'subset'. If 'subset' is null, it's equivalent to using the fast src rect constraint. If 'subset' is provided, the strict src rect constraint is applied using 'subset'.
Definition at line 264 of file SurfaceDrawContext.h.
void skgpu::ganesh::SurfaceDrawContext::drawTextureSet | ( | const GrClip * | clip, |
GrTextureSetEntry | set[], | ||
int | cnt, | ||
int | proxyRunCnt, | ||
GrSamplerState::Filter | filter, | ||
GrSamplerState::MipmapMode | mm, | ||
SkBlendMode | mode, | ||
SkCanvas::SrcRectConstraint | constraint, | ||
const SkMatrix & | viewMatrix, | ||
sk_sp< GrColorSpaceXform > | texXform | ||
) |
Draws a set of textures with a shared filter, color, view matrix, color xform, and texture color xform. The textures must all have the same GrTextureType and GrConfig.
If any entries provide a non-null fDstClip array, it will be read from immediately based on fDstClipCount, so the pointer can become invalid after this returns.
'proxRunCnt' is the number of proxy changes encountered in the entry array. Technically this can be inferred from the array within this function, but the information is already known by SkGpuDevice, so no need to incur another iteration over the array.
Definition at line 899 of file SurfaceDrawContext.cpp.
void skgpu::ganesh::SurfaceDrawContext::drawVertices | ( | const GrClip * | clip, |
GrPaint && | paint, | ||
const SkMatrix & | viewMatrix, | ||
sk_sp< SkVertices > | vertices, | ||
GrPrimitiveType * | overridePrimType = nullptr , |
||
bool | skipColorXform = false |
||
) |
Draws vertices with a paint.
paint | describes how to color pixels. |
viewMatrix | transformation matrix |
vertices | specifies the mesh to draw. |
overridePrimType | primitive type to draw. If NULL, derive prim type from vertices. |
skipColorXform | if true, do not apply a color space transfer function |
Definition at line 926 of file SurfaceDrawContext.cpp.
|
inline |
Fills a block of pixels with a paint and a localMatrix, respecting the clip.
Definition at line 184 of file SurfaceDrawContext.h.
|
inline |
Similar to fillRectWithEdgeAA but draws an arbitrary 2D convex quadrilateral transformed by 'viewMatrix', with per-edge control over anti-aliasing. The quad should follow the ordering used by SkRect::toQuad(), which determines how the edge AA is applied:
The last argument, 'optionalLocalQuad', can be null if no separate local coordinates are necessary.
Definition at line 225 of file SurfaceDrawContext.h.
void skgpu::ganesh::SurfaceDrawContext::fillRectToRect | ( | const GrClip * | clip, |
GrPaint && | paint, | ||
GrAA | aa, | ||
const SkMatrix & | viewMatrix, | ||
const SkRect & | rectToDraw, | ||
const SkRect & | localRect | ||
) |
Maps a rectangle of shader coordinates to a rectangle and fills that rectangle.
GrPaint | describes how to color pixels. |
GrAA | Controls whether rect is antialiased |
SkMatrix | transformation matrix which applies to rectToDraw |
rectToDraw | the rectangle to draw |
localRect | the rectangle of shader coordinates applied to rectToDraw |
Definition at line 732 of file SurfaceDrawContext.cpp.
|
inline |
Creates an op that draws a fill rect with per-edge control over anti-aliasing.
This is a specialized version of fillQuadWithEdgeAA, but is kept separate since knowing the geometry is a rectangle affords more optimizations.
Definition at line 200 of file SurfaceDrawContext.h.
skgpu::Budgeted skgpu::ganesh::SurfaceDrawContext::isBudgeted | ( | ) | const |
Definition at line 1659 of file SurfaceDrawContext.cpp.
|
static |
Definition at line 131 of file SurfaceDrawContext.cpp.
|
static |
Definition at line 205 of file SurfaceDrawContext.cpp.
|
static |
Takes custom swizzles rather than determining swizzles from color type and format. It will have color type kUnknown.
Definition at line 156 of file SurfaceDrawContext.cpp.
|
static |
Definition at line 269 of file SurfaceDrawContext.cpp.
|
static |
Definition at line 247 of file SurfaceDrawContext.cpp.
int skgpu::ganesh::SurfaceDrawContext::maxWindowRectangles | ( | ) | const |
Definition at line 799 of file SurfaceDrawContext.cpp.
bool skgpu::ganesh::SurfaceDrawContext::mustRenderClip | ( | uint32_t | clipStackGenID, |
const SkIRect & | devClipBounds, | ||
int | numClipAnalyticElements | ||
) |
Definition at line 1501 of file SurfaceDrawContext.cpp.
|
inline |
Definition at line 591 of file SurfaceDrawContext.h.
|
inline |
Definition at line 582 of file SurfaceDrawContext.h.
void skgpu::ganesh::SurfaceDrawContext::setLastClip | ( | uint32_t | clipStackGenID, |
const SkIRect & | devClipBounds, | ||
int | numClipAnalyticElements | ||
) |
Definition at line 1492 of file SurfaceDrawContext.cpp.
bool skgpu::ganesh::SurfaceDrawContext::stencilPath | ( | const GrHardClip * | clip, |
GrAA | doStencilMSAA, | ||
const SkMatrix & | viewMatrix, | ||
const SkPath & | path | ||
) |
Definition at line 861 of file SurfaceDrawContext.cpp.
|
inline |
Definition at line 524 of file SurfaceDrawContext.h.
|
inline |
Definition at line 592 of file SurfaceDrawContext.h.
|
inline |
Definition at line 567 of file SurfaceDrawContext.h.
bool skgpu::ganesh::SurfaceDrawContext::waitOnSemaphores | ( | int | numSemaphores, |
const GrBackendSemaphore | waitSemaphores[], | ||
bool | deleteSemaphoresAfterWait | ||
) |
The next time this SurfaceDrawContext is flushed, the gpu will wait on the passed in semaphores before executing any commands.
Definition at line 1510 of file SurfaceDrawContext.cpp.
|
overrideprivatevirtual |
Override to be notified in subclass before the current ops task is replaced.
Reimplemented from skgpu::ganesh::SurfaceFillContext.
Definition at line 315 of file SurfaceDrawContext.cpp.
|
inline |
Definition at line 594 of file SurfaceDrawContext.h.