47 , fSurfaceProps(surfaceProps) {
53 const SkM44& globalToDevice,
54 const SkM44& localToDevice,
64 if (bufferOriginX | bufferOriginY) {
65 fDeviceToGlobal.
preTranslate(bufferOriginX, bufferOriginY);
66 fGlobalToDevice.
postTranslate(-bufferOriginX, -bufferOriginY);
69 fLocalToDevice33 = fLocalToDevice.
asM33();
70 fLocalToDeviceDirty =
true;
78 fLocalToDevice33 = fLocalToDevice.
asM33();
79 fLocalToDeviceDirty =
true;
88 return pixelAligned == fDeviceToGlobal;
106 return (dstDevice.fGlobalToDevice * fDeviceToGlobal).asM33();
117 paint.getPathEffect();
120 if (isNonTranslate || complexPaint || antiAlias) {
123 path.setIsVolatile(
true);
144 path.addRRect(outer);
145 path.addRRect(inner);
147 path.setIsVolatile(
true);
157 this->imageInfo().colorSpace());
169 bool isFixedColor =
false;
172 while (iter.
next(&srcR, &dstR, &isFixedColor, &c)) {
174 if (isFixedColor || (srcR.
width() <= 1.0f && srcR.
height() <= 1.0f &&
178 if (0 != c || !
paint.isSrcOver()) {
209 const int triCount = quadCount << 1;
210 const int vertexCount = triCount * 3;
220 for (
int i = 0;
i < quadCount; ++
i) {
271 if (
images[
i].fMatrixIndex >= 0) {
290 if (images[
i].fMatrixIndex >= 0) {
310 SK_ABORT(
"Must override if useDrawCoverageMaskForMaskFilters() is true");
385 if (
nullptr == pmap) {
393 if (
nullptr == pmap) {
403 if (!shader || !lm.
invert(&inverse_lm)) {
407#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
417 shader = nested_shader.get();
436 this->simplifyGlyphRunRSXFormAndRedraw(canvas, glyphRunList,
paint);
440void SkDevice::simplifyGlyphRunRSXFormAndRedraw(
SkCanvas* canvas,
444 if (
run.scaledRotations().empty()) {
445 auto subList = glyphRunList.builder()->makeGlyphRunList(
run,
paint, {0, 0});
448 SkPoint origin = glyphRunList.origin();
461 sharedGlyphID = glyphID;
462 auto [scos, ssin] =
run.scaledRotations()[
i];
489 SK_ABORT(
"Slug drawing not supported.");
518 std::move(colorSpace)), props) {
536 SkASSERT(fClipStack.
size() == 1 && fClipStack[0].fDeferredSaveCount == 0);
538 fClipStack[0].fClipBounds = this->
bounds();
539 fClipStack[0].fIsAA =
false;
540 fClipStack[0].fIsRect =
true;
548 fClipStack.
back().fDeferredSaveCount++;
553 if (fClipStack.
back().fDeferredSaveCount > 0) {
554 fClipStack.
back().fDeferredSaveCount--;
561SkNoPixelsDevice::ClipState& SkNoPixelsDevice::writableClip() {
563 ClipState& current = fClipStack.
back();
564 if (current.fDeferredSaveCount > 0) {
565 current.fDeferredSaveCount--;
568 bool aa = current.fIsAA;
569 bool rect = current.fIsRect;
588 if (
path.isInverseFillType()) {
597 false, globalRgn.
isRect());
601 this->writableClip().fIsRect =
false;
606 if (!deviceRect.
intersect(this->bounds())) {
609 auto& clip = this->writableClip();
610 clip.fClipBounds = deviceRect;
616 bool isAA,
bool fillsBounds) {
623 if (!fClipBounds.intersect(isAA ? devBounds.
roundOut() : devBounds.
round())) {
624 fClipBounds.setEmpty();
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static bool isFinite(const SkRect &r)
@ kUnknown_SkAlphaType
uninitialized
#define SK_ABORT(message,...)
#define SkAlphaMul(value, alpha256)
static unsigned SkAlpha255To256(U8CPU alpha)
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kUnknown_SkColorType
uninitialized
static constexpr SkColor SkColorSetA(SkColor c, U8CPU a)
#define SkColorGetA(color)
static bool is_int(float x)
static sk_sp< SkShader > make_post_inverse_lm(const SkShader *shader, const SkMatrix &lm)
static SkPoint * quad_to_tris(SkPoint tris[6], const SkPoint quad[4])
constexpr SkEnumerate< Iter > SkMakeEnumerate(C &c)
#define sk_float_round2int(x)
static SkImageFilter_Base * as_IFB(SkImageFilter *filter)
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static size_t difference(size_t minuend, size_t subtrahend)
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
sk_sp< T > sk_ref_sp(T *obj)
#define SkScalarFloorToScalar(x)
static bool SkScalarIsInt(SkScalar x)
#define SkScalarFloorToInt(x)
@ kFakeGammaAndBoostContrast
SkShaderBase * as_SB(SkShader *shader)
@ kStrict_SrcRectConstraint
sample only inside bounds; slower
@ kFast_SrcRectConstraint
sample outside bounds; faster
void concat(const SkMatrix &matrix)
bool gammaIsLinear() const
void drawFilteredImage(const skif::Mapping &mapping, SkSpecialImage *src, SkColorType ct, const SkImageFilter *, const SkSamplingOptions &, const SkPaint &)
const SkImageInfo & imageInfo() const
virtual void drawVertices(const SkVertices *, sk_sp< SkBlender >, const SkPaint &, bool skipColorXform=false)=0
virtual void drawEdgeAAQuad(const SkRect &rect, const SkPoint clip[4], SkCanvas::QuadAAFlags aaFlags, const SkColor4f &color, SkBlendMode mode)
SkScalerContextFlags scalerContextFlags() const
virtual void drawRegion(const SkRegion &r, const SkPaint &paint)
SkIPoint getOrigin() const
SkDevice(const SkImageInfo &, const SkSurfaceProps &)
virtual void drawAtlas(const SkRSXform[], const SkRect[], const SkColor[], int count, sk_sp< SkBlender >, const SkPaint &)
virtual void clipPath(const SkPath &path, SkClipOp op, bool aa)=0
void setLocalToDevice(const SkM44 &localToDevice)
virtual bool onAccessPixels(SkPixmap *)
virtual void drawCoverageMask(const SkSpecialImage *, const SkMatrix &maskToDevice, const SkSamplingOptions &, const SkPaint &)
virtual sk_sp< skif::Backend > createImageFilteringBackend(const SkSurfaceProps &surfaceProps, SkColorType colorType) const
void drawGlyphRunList(SkCanvas *, const sktext::GlyphRunList &glyphRunList, const SkPaint &paint)
virtual void drawEdgeAAImageSet(const SkCanvas::ImageSetEntry[], int count, const SkPoint dstClips[], const SkMatrix preViewMatrices[], const SkSamplingOptions &, const SkPaint &, SkCanvas::SrcRectConstraint)
const SkM44 & globalToDevice() const
virtual void drawDRRect(const SkRRect &outer, const SkRRect &inner, const SkPaint &)
sk_sp< SkSpecialImage > snapSpecial()
virtual void popClipStack()=0
virtual sk_sp< SkSpecialImage > snapSpecialScaled(const SkIRect &subset, const SkISize &dstDims)
virtual void pushClipStack()=0
bool accessPixels(SkPixmap *pmap)
const SkMatrix & localToDevice() const
virtual void drawSlug(SkCanvas *, const sktext::gpu::Slug *slug, const SkPaint &paint)
void setOrigin(const SkM44 &globalCTM, int x, int y)
virtual void drawSpecial(SkSpecialImage *, const SkMatrix &localToDevice, const SkSamplingOptions &, const SkPaint &, SkCanvas::SrcRectConstraint constraint=SkCanvas::kStrict_SrcRectConstraint)
bool isPixelAlignedToGlobal() const
virtual void drawDevice(SkDevice *, const SkSamplingOptions &, const SkPaint &)
virtual SkIRect devClipBounds() const =0
const SkSurfaceProps & surfaceProps() const
virtual bool onPeekPixels(SkPixmap *)
virtual sk_sp< SkSpecialImage > makeSpecial(const SkBitmap &)
const SkM44 & deviceToGlobal() const
virtual void drawDrawable(SkCanvas *, SkDrawable *, const SkMatrix *)
virtual void onDrawGlyphRunList(SkCanvas *, const sktext::GlyphRunList &, const SkPaint &paint)=0
void setDeviceCoordinateSystem(const SkM44 &deviceToGlobal, const SkM44 &globalToDevice, const SkM44 &localToDevice, int bufferOriginX, int bufferOriginY)
void setGlobalCTM(const SkM44 &ctm)
virtual sk_sp< sktext::gpu::Slug > convertGlyphRunListToSlug(const sktext::GlyphRunList &glyphRunList, const SkPaint &paint)
bool peekPixels(SkPixmap *)
virtual sk_sp< SkSurface > makeSurface(const SkImageInfo &, const SkSurfaceProps &)
virtual void drawPatch(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], sk_sp< SkBlender >, const SkPaint &paint)
virtual void drawRect(const SkRect &r, const SkPaint &paint)=0
virtual void drawImageRect(const SkImage *, const SkRect *src, const SkRect &dst, const SkSamplingOptions &, const SkPaint &, SkCanvas::SrcRectConstraint)=0
const SkM44 & localToDevice44() const
virtual void drawArc(const SkArc &arc, const SkPaint &paint)
virtual void drawPath(const SkPath &path, const SkPaint &paint, bool pathIsMutable=false)=0
SkMatrix getRelativeTransform(const SkDevice &) const
virtual void drawImageLattice(const SkImage *, const SkCanvas::Lattice &, const SkRect &dst, SkFilterMode, const SkPaint &)
void draw(SkCanvas *, const SkMatrix *=nullptr)
skif::FilterResult filterImage(const skif::Context &context) const
bool readPixels(GrDirectContext *context, const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY, CachingHint cachingHint=kAllow_CachingHint) const
bool next(SkIRect *src, SkRect *dst, bool *isFixedColor=nullptr, SkColor *fixedColor=nullptr)
SkM44 & postConcat(const SkM44 &m)
SkM44 & postTranslate(SkScalar x, SkScalar y, SkScalar z=0)
void normalizePerspective()
SkScalar rc(int r, int c) const
void setRC(int r, int c, SkScalar value)
SkM44 & preTranslate(SkScalar x, SkScalar y, SkScalar z=0)
static SkRect MapRect(const SkM44 &m, const SkRect &r)
static bool IsScaleTranslateAsM33(const SkM44 &m)
SkMatrix & postTranslate(SkScalar dx, SkScalar dy)
SkScalar getTranslateY() const
bool invert(SkMatrix *inverse) const
SkMatrix & setRSXform(const SkRSXform &rsxForm)
SkMatrix & preTranslate(SkScalar dx, SkScalar dy)
SkScalar getTranslateX() const
@ kTranslate_Mask
translation SkMatrix
void clipRegion(const SkRegion &globalRgn, SkClipOp op) override
void clipRect(const SkRect &rect, SkClipOp op, bool aa) override
bool resetForNextPicture(const SkIRect &bounds)
void popClipStack() override
void replaceClip(const SkIRect &rect) override
void clipPath(const SkPath &path, SkClipOp op, bool aa) override
void pushClipStack() override
SkNoPixelsDevice(const SkIRect &bounds, const SkSurfaceProps &props)
void clipRRect(const SkRRect &rrect, SkClipOp op, bool aa) override
void setColor(SkColor color)
void setAntiAlias(bool aa)
@ kFill_Style
set to fill geometry
static sk_sp< SkVertices > MakeVertices(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], int lodX, int lodY, SkColorSpace *colorSpace=nullptr)
static SkISize GetLevelOfDetail(const SkPoint cubics[12], const SkMatrix *matrix)
static void CreateDrawArcPath(SkPath *path, const SkArc &arc, bool isFillNoPathEffect)
const SkRect & getBounds() const
const SkRect & getBounds() const
static bool Subtract(const SkRect &a, const SkRect &b, SkRect *out)
const SkIRect & rect() const
bool getBoundaryPath(SkPath *path) const
const SkIRect & getBounds() const
virtual sk_sp< SkShader > makeAsALocalMatrixShader(SkMatrix *localMatrix) const
sk_sp< SkShader > makeWithLocalMatrix(const SkMatrix &) const
sk_sp< SkVertices > detach()
@ kHasTexCoords_BuilderFlag
T & emplace_back(Args &&... args)
sk_sp< SkSpecialImage > imageAndOffset(const Context &ctx, SkIPoint *offset) const
const SkMatrix & deviceToLayer() const
const SkMatrix & layerToDevice() const
GlyphRunList makeGlyphRunList(const GlyphRun &run, const SkPaint &paint, SkPoint origin)
GlyphRunBuilder * builder() const
FlutterSemanticsFlag flags
std::array< MockImage, 3 > images
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
void(* memset32)(uint32_t[], uint32_t, int)
unsigned useCenter Optional< SkMatrix > matrix
Optional< SkRect > bounds
PODArray< SkPoint > dstClips
sk_sp< const SkImage > image
ClipOpAndAA opAA SkRegion region
sk_sp< SkBlender > blender SkRect rect
PODArray< SkMatrix > preViewMatrices
PODArray< SkColor > colors
SkSamplingOptions sampling
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
SkSamplingOptions(SkFilterMode::kLinear))
sk_sp< Backend > MakeRasterBackend(const SkSurfaceProps &surfaceProps, SkColorType colorType)
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
static constexpr SkIPoint Make(int32_t x, int32_t y)
bool intersect(const SkIRect &r)
constexpr int32_t top() const
constexpr int32_t height() const
constexpr int32_t width() const
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
constexpr int32_t left() const
constexpr int32_t width() const
constexpr int32_t height() const
SkColorSpace * colorSpace() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
constexpr float y() const
constexpr float x() const
static SkRect Make(const SkISize &size)
static constexpr SkRect MakeEmpty()
void toQuad(SkPoint quad[4]) const
void roundIn(SkIRect *dst) const
SkScalar fLeft
smaller x-axis bounds
void roundOut(SkIRect *dst) const
void round(SkIRect *dst) const
constexpr float height() const
constexpr float width() const
SkScalar fTop
smaller y-axis bounds