41 if (localMatrix && !localMatrix->
invert(
nullptr)) {
48static unsigned gImageFromPictureKeyNamespaceLabel;
53 uint32_t pictureID,
const SkRect& subset,
55 : fColorSpaceXYZHash(colorSpace->toXYZD50Hash())
56 , fColorSpaceTransferFnHash(colorSpace->transferFnHash())
60 , fSurfaceProps(surfaceProps)
62 static const size_t keySize =
sizeof(fColorSpaceXYZHash) +
63 sizeof(fColorSpaceTransferFnHash) +
67 sizeof(fSurfaceProps);
69 SkASSERT(
sizeof(uint32_t) * (&fEndOfStruct - &fColorSpaceXYZHash) == keySize);
70 this->
init(&gImageFromPictureKeyNamespaceLabel,
76 uint32_t fColorSpaceXYZHash;
77 uint32_t fColorSpaceTransferFnHash;
91 ImageFromPictureKey fKey;
94 const Key& getKey()
const override {
return fKey; }
95 size_t bytesUsed()
const override {
97 return sizeof(fKey) + (
size_t)fImage->
width() * fImage->
height() * 4;
99 const char* getCategory()
const override {
return "bitmap-shader"; }
103 const ImageFromPictureRec& rec =
static_cast<const ImageFromPictureRec&
>(baseRec);
119 , fTile(tile ? *tile : fPicture->cullRect())
129 return SkLocalMatrixShader::MakeWrapped<SkPictureShader>(lm,
138 if (
buffer.isVersionLT(SkPicturePriv::Version::kNoShaderLocalMatrix)) {
150 bool didSerialize =
buffer.readBool();
155 unsigned legacyFilter =
buffer.read32();
169 buffer.write32((
unsigned)fTmx);
170 buffer.write32((
unsigned)fTmy);
172 buffer.write32((
unsigned)fFilter);
185 const int maxTextureSize,
189 const SkSize scaledSize = [&]() {
205 static const SkScalar kMaxTileArea = 2048 * 2048;
207 if (tileArea > kMaxTileArea) {
209 size.set(
size.width() * clampScale,
size.height() * clampScale);
214 if (maxTextureSize) {
215 if (
size.width() > maxTextureSize ||
size.height() > maxTextureSize) {
226 return {
false, {}, {}, {}, {}};
249 canvas->
concat(matrixForDraw);
250 canvas->drawPicture(pict);
260 const int maxTextureSize_NotUsedForCPU = 0;
263 dstColorType, dstColorSpace,
264 maxTextureSize_NotUsedForCPU,
270 ImageFromPictureKey
key(
info.imageInfo.colorSpace(),
info.imageInfo.colorType(),
295 bitmapShader = this->rasterShader(mRec.
totalMatrix(),
307#ifdef SK_ENABLE_LEGACY_SHADERCONTEXT
311 rec.fMatrixRec.totalMatrix(), rec.fDstColorType, rec.fDstColorSpace, rec.fProps);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kRGBA_F16Norm_SkColorType
pixel with half floats in [0,1] for red, green, blue, alpha;
static bool SkIsFinite(T x, Pack... values)
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static int SkColorTypeMaxBitsPerChannel(SkColorType ct)
static sk_sp< SkColorSpace > ref_or_srgb(SkColorSpace *cs)
sk_sp< T > sk_ref_sp(T *obj)
#define SkScalarFloorToScalar(x)
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
SkShaderBase * as_SB(SkShader *shader)
@ kUnknown_SkPixelGeometry
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
static SkScalar center(float pos0, float pos1)
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
void concat(const SkMatrix &matrix)
static sk_sp< SkColorSpace > MakeSRGB()
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
static SkScalar DifferentialAreaScale(const SkMatrix &m, const SkPoint &p)
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static SkMatrix RectToRect(const SkRect &src, const SkRect &dst, ScaleToFit mode=kFill_ScaleToFit)
bool invert(SkMatrix *inverse) const
bool decomposeScale(SkSize *scale, SkMatrix *remaining=nullptr) const
static void AddedToCache(const SkPicture *pic)
static uint64_t MakeSharedID(uint32_t pictureID)
@ kPictureShaderFilterParam_Version
@ kNoFilterQualityShaders_Version
static void Flatten(const sk_sp< const SkPicture >, SkWriteBuffer &buffer)
static sk_sp< SkPicture > MakeFromBuffer(SkReadBuffer &buffer)
bool appendStages(const SkStageRec &, const SkShaders::MatrixRec &) const override
static sk_sp< SkShader > Make(sk_sp< SkPicture >, SkTileMode, SkTileMode, SkFilterMode, const SkMatrix *, const SkRect *)
SkFilterMode filter() const
sk_sp< SkPicture > picture() const
void flatten(SkWriteBuffer &) const override
SkPictureShader(sk_sp< SkPicture >, SkTileMode, SkTileMode, SkFilterMode, const SkRect *)
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, SkFilterMode mode, const SkMatrix *localMatrix, const SkRect *tileRect) const
uint32_t uniqueID() const
virtual SkRect cullRect() const =0
static void Add(Rec *, void *payload=nullptr)
static bool Find(const Key &key, FindVisitor, void *context)
Context * makeContext(const ContextRec &, SkArenaAlloc *) const
virtual bool appendStages(const SkStageRec &, const SkShaders::MatrixRec &) const =0
SkMatrix totalMatrix() const
SkSurfaceProps cloneWithPixelGeometry(SkPixelGeometry newPixelGeometry) const
sk_sp< SkImage > makeImageSnapshot()
static float max(float r, float g, float b)
Optional< SkRect > bounds
sk_sp< const SkImage > image
sk_sp< const SkPicture > picture
SK_API sk_sp< SkShader > Empty()
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
Visitor(Ts...) -> Visitor< Ts... >
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 to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
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))
constexpr int32_t width() const
constexpr int32_t height() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static CachedImageInfo Make(const SkRect &bounds, const SkMatrix &totalM, SkColorType dstColorType, SkColorSpace *dstColorSpace, const int maxTextureSize, const SkSurfaceProps &propsIn)
sk_sp< SkImage > makeImage(sk_sp< SkSurface > surf, const SkPicture *pict) const
static SkRect MakeIWH(int w, int h)
const SkSurfaceProps & fSurfaceProps
SkColorType fDstColorType