struct SkArc; class SkColorSpace; class SkMesh; struct SkDrawShadowRec; class SkImageFilter; class SkRasterHandleAllocator; class SkSpecialImage; class GrRecordingContext; class SkData; class SkDrawable; class SkImage; class SkPaint; class SkPath; class SkPixmap; class SkRRect; class SkRecorder; class SkSurface; class SkVertices; enum SkColorType : int; enumclass SkBlendMode; enumclass SkScalerContextFlags : uint32_t; struct SkRSXform;
namespace sktext { class GlyphRunList;
}
namespace skif { class Backend; class Mapping;
} namespace skgpu::ganesh { class Device;
} namespace skgpu::graphite { class Device; class Recorder;
} namespace sktext::gpu { class SubRunControl; class Slug;
}
struct SkStrikeDeviceInfo { const SkSurfaceProps fSurfaceProps; const SkScalerContextFlags fScalerContextFlags; // This is a pointer so this can be compiled without SK_GPU_SUPPORT. const sktext::gpu::SubRunControl* const fSubRunControl;
};
// TEMPORARY: Whether or not SkCanvas should use an layer and image filters to simulate // mask filters and then draw the filtered mask using drawCoverageMask. Unlike regular // layers, the color type passed to SkDevice::createDevice() will always be an alpha-only // color type. Eventually this will be the only way that mask filters are handled (barring // dedicated fast-paths for blurs on [r]rects and text).
virtual bool useDrawCoverageMaskForMaskFilters() const { returnfalse; }
// SkCanvas uses NoPixelsDevice when createDevice fails; but then it needs to be able to // inspect a layer's device to know if calling drawDevice() later is allowed.
virtual bool isNoPixelsDevice() const { returnfalse; }
// Marking an SkDevice immutable declares the intent that rendering to the device is // complete, allowing it to be sampled as an image without requiring a copy. Drawing // operations may not function and may assert if invoked after setImmutable() is called.
virtual void setImmutable() {}
// Default impl always calls drawRect() with a solid-color paint, setting it to anti-aliased // only when all edge flags are set. If there's a clip region, it draws that using drawPath, // or uses clipPath().
virtual void drawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
SkCanvas::QuadAAFlags aaFlags, const SkColor4f& color,
SkBlendMode mode); // Default impl uses drawImageRect per entry, being anti-aliased only when an entry's edge flags // are all set. If there's a clip region, it will be applied using clipPath().
virtual void drawEdgeAAImageSet(const SkCanvas::ImageSetEntry[], int count, const SkPoint dstClips[], const SkMatrix preViewMatrices[], const SkSamplingOptions&, const SkPaint&,
SkCanvas::SrcRectConstraint);
// Snap the 'subset' contents from this device, possibly as a read-only view. If 'forceCopy' // is true then the returned image's pixels must not be affected by subsequent draws into the // device. When 'forceCopy' is false, the image can be a view into the device's pixels // (avoiding a copy for performance, at the expense of safety). Default returns null.
virtual sk_sp<SkSpecialImage> snapSpecial(const SkIRect& subset, bool forceCopy = false); // Can return null if unable to perform scaling as part of the copy, even if snapSpecial() w/o // scaling would succeed.
virtual sk_sp<SkSpecialImage> snapSpecialScaled(const SkIRect& subset, const SkISize& dstDims); // Get a view of the entire device's current contents as an image.
sk_sp<SkSpecialImage> snapSpecial();
protected: // Configure the device's coordinate spaces, specifying both how its device image maps back to // the global space (via 'deviceToGlobal') and the initial CTM of the device (via // 'localToDevice', i.e. what geometry drawn into this device will be transformed with). // // (bufferOriginX, bufferOriginY) defines where the (0,0) pixel the device's backing buffer // is anchored in the device space. The final device-to-global matrix stored by the SkDevice // will include a pre-translation by T(deviceOriginX, deviceOriginY), and the final // local-to-device matrix will have a post-translation of T(-deviceOriginX, -deviceOriginY). void setDeviceCoordinateSystem(const SkM44& deviceToGlobal, const SkM44& globalToDevice, const SkM44& localToDevice, int bufferOriginX, int bufferOriginY); // Convenience to configure the device to be axis-aligned with the root canvas, but with a // unique origin. void setOrigin(const SkM44& globalCTM, int x, int y) {
this->setDeviceCoordinateSystem(SkM44(), SkM44(), globalCTM, x, y);
}
// Returns whether or not localToDevice() has changed since the last call to this function. bool checkLocalToDeviceDirty() { bool wasDirty = fLocalToDeviceDirty;
fLocalToDeviceDirty = false; return wasDirty;
}
private: friendclass SkCanvas; // for setOrigin/setDeviceCoordinateSystem friendclass DeviceTestingAccess;
// Defaults to a CPU image filtering backend.
virtual sk_sp<skif::Backend> createImageFilteringBackend(const SkSurfaceProps& surfaceProps,
SkColorType colorType) const;
// Implementations can assume that the device from (x,y) to (w,h) will fit within dst.
virtual bool onReadPixels(const SkPixmap&, int x, int y) { returnfalse; }
// Implementations can assume that the src image placed at 'x,y' will fit within the device.
virtual bool onWritePixels(const SkPixmap&, int x, int y) { returnfalse; }
// Only called with glyphRunLists that do not contain RSXForm.
virtual void onDrawGlyphRunList(SkCanvas*, const sktext::GlyphRunList&, const SkPaint& paint) = 0;
const SkImageInfo fInfo; const SkSurfaceProps fSurfaceProps;
SkM44 fLocalToDevice; // fDeviceToGlobal and fGlobalToDevice are inverses of each other; there are never that many // SkDevices, so pay the memory cost to avoid recalculating the inverse.
SkM44 fDeviceToGlobal;
SkM44 fGlobalToDevice;
// fLocalToDevice but as a 3x3.
SkMatrix fLocalToDevice33;
// fLocalToDevice is the device CTM, not the global CTM. // It maps from local space to the device's coordinate space. // fDeviceToGlobal * fLocalToDevice will match the canvas' CTM. // // setGlobalCTM and setLocalToDevice are intentionally not virtual for performance reasons. // However, track a dirty bit for subclasses that want to defer local-to-device dependent // calculations until needed for a clip or draw. bool fLocalToDeviceDirty = true;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.