52 : fImageSize(imageSize)
54 , fTileGridSize(tileGridSize)
55 , fClampMode(clampMode)
56 , fTransformMode(transformMode)
57 , fLayerCnt(layerCnt) {
58 fName.
appendf(
"compositing_images_tile_size_%dx%d_grid_%dx%d_layers_%d",
60 fTileGridSize.
fHeight, fLayerCnt);
61 if (imageSize != tileSize) {
75 fName.
append(
"_chrome_optimal");
78 switch(transformMode) {
104 int numImages = fLayerCnt * fTileGridSize.
fWidth * fTileGridSize.
fHeight;
105 fImages = std::make_unique<sk_sp<SkImage>[]>(numImages);
106 for (
int i = 0;
i < numImages; ++
i) {
109 surf->getCanvas()->clear(
color);
115 surf->getCanvas()->drawRect(
117 fImages[
i] = surf->makeImageSnapshot();
125 paint.setAntiAlias(
true);
129 canvas->
concat(this->getTransform());
131 for (
int loop = 0; loop < loops; ++loop) {
132 for (
int l = 0; l < fLayerCnt; ++l) {
140 for (
int y = 0;
y < fTileGridSize.
fHeight; ++
y) {
141 for (
int x = 0;
x < fTileGridSize.
fWidth; ++
x) {
142 set[
i++] = this->getEntry(
x,
y, l);
156 for (
int y = 0;
y < fTileGridSize.
fHeight - 1; ++
y) {
158 for (
int x = 0;
x < fTileGridSize.
fWidth - 1; ++
x) {
159 set[
i++] = this->getEntry(
x,
y, l);
167 set[
i++] = this->getAdjustedEntry(fTileGridSize.
fWidth - 1,
y, l, dstQuad);
175 for (
int x = 0;
x < fTileGridSize.
fWidth - 1; ++
x) {
176 set[
i++] = this->getAdjustedEntry(
x, fTileGridSize.
fHeight - 1, l,
177 dstQuads.
get() +
x * 4);
180 set[
i++] = this->getEntry(
189 for (
int y = 0;
y < fTileGridSize.
fHeight - 1; ++
y) {
190 for (
int x = 0;
x < fTileGridSize.
fWidth - 1; ++
x) {
191 set[
i++] = this->getEntry(
x,
y, l);
202 for (
int y = 0;
y < fTileGridSize.
fHeight - 1; ++
y) {
203 set[
i++] = this->getAdjustedEntry(fTileGridSize.
fWidth - 1,
y, l,
204 dstQuads.
get() +
y * 4);
209 int quadStart = 4 * (fTileGridSize.
fHeight - 1);
211 for (
int x = 0;
x < fTileGridSize.
fWidth - 1; ++
x) {
212 set[
i++] = this->getAdjustedEntry(
x, fTileGridSize.
fHeight - 1, l,
213 dstQuads.
get() + quadStart +
x * 4);
215 set[
i++] = this->getEntry(
231 switch(fTransformMode) {
236 m.setTranslate(0.5f, 0.5f);
258 unsigned getEdgeFlags(
int x,
int y)
const {
262 }
else if (
x == fTileGridSize.
fWidth - 1) {
268 }
else if (
y == fTileGridSize.
fHeight - 1) {
279 float dstWidth = srcRect.
width() * 1.25f;
280 float dstHeight = srcRect.
height() * 1.25f;
283 this->getEdgeFlags(
x,
y));
291 if (
x == fTileGridSize.
fWidth - 1) {
295 if (
y == fTileGridSize.
fHeight - 1) {
311 std::unique_ptr<sk_sp<SkImage>[]> fImages;
DEF_BENCH(return new CompositingImages({256, 256}, {256, 256}, {8, 8}, ClampingMode::kAlwaysFast, TransformMode::kNone, 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
#define SkScalarCeilToInt(x)
void onPerCanvasPostDraw(SkCanvas *) override
bool isSuitableFor(Backend backend) override
void onDraw(int loops, SkCanvas *canvas) override
void onPerCanvasPreDraw(SkCanvas *canvas) override
CompositingImages(SkISize imageSize, SkISize tileSize, SkISize tileGridSize, ClampingMode clampMode, TransformMode transformMode, int layerCnt)
const char * onGetName() override
SkSurface * getSurface() const
sk_sp< SkSurface > makeSurface(const SkImageInfo &info, const SkSurfaceProps *props=nullptr)
@ kStrict_SrcRectConstraint
sample only inside bounds; slower
@ kFast_SrcRectConstraint
sample outside bounds; faster
void experimental_DrawEdgeAAImageSet(const ImageSetEntry imageSet[], int cnt, const SkPoint dstClips[], const SkMatrix preViewMatrices[], const SkSamplingOptions &, const SkPaint *paint=nullptr, SrcRectConstraint constraint=kStrict_SrcRectConstraint)
void concat(const SkMatrix &matrix)
static SkMatrix RectToRect(const SkRect &src, const SkRect &dst, ScaleToFit mode=kFill_ScaleToFit)
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
void append(const char text[])
const char * c_str() const
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
FlutterSemanticsFlag flags
SkSamplingOptions sampling
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
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 set
void Flush(SkSurface *surface)
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static SkRect Make(const SkISize &size)
SkScalar fBottom
larger y-axis bounds
void toQuad(SkPoint quad[4]) const
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
SkScalar fRight
larger x-axis bounds
constexpr float height() const
constexpr float width() const
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)