Runs the given GM and returns a JS object. If the GM was successful, the object will have the following properties: "png" - a Uint8Array of the PNG data extracted from the surface. "hash" - a string which is the md5 hash of the pixel contents and the metadata.
116 {
119 if (!gm) {
120 SkDebugf(
"Could not find gm with name %s\n",
name.c_str());
122 }
123
124
126 auto colorType = SkColorType::kN32_SkColorType;
132 SkDebugf(
"Could not make surface\n");
134 }
135 auto canvas =
surface->getCanvas();
136
137 gm->onceBeforeDraw();
139
140 auto gpuSetupResult = gm->gpuSetup(canvas, &msg);
146 }
147
148 auto drawResult = gm->draw(canvas, &msg);
154 }
156
157
160 if (!canvas->readPixels(
bitmap, 0, 0)) {
161 SkDebugf(
"Could not read pixels back\n");
163 }
164
165
166
167 std::unique_ptr<HashAndEncode> hashAndEncode = std::make_unique<HashAndEncode>(
bitmap);
170 hashAndEncode->feedHash(&
hash);
172 for (
int i = 0;
i < 16;
i++) {
173 md5.appendf(
"%02x", digest.
data[
i]);
174 }
175
178
179
181
184
186
187
188
189
190
192
193 typed_memory_view(
data->size(),
data->bytes())
195
196 result.set(
"png", pngData);
198 }
201}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kBottomLeft_GrSurfaceOrigin
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static uint32_t hash(const SkShaderBase::GradientInfo &v)
emscripten::val Uint8Array
void flushAndSubmit(GrSyncCpu sync=GrSyncCpu::kNo)
const char * c_str() const
EMSCRIPTEN_KEEPALIVE void empty()
static std::unique_ptr< skiagm::GM > getGMWithName(std::string name)
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
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
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)