Flutter Engine
The Flutter Engine
ImageProviderTest.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2022 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "tests/Test.h"
9
15#include "include/core/SkSpan.h"
25#include "tests/TestUtils.h"
26#include "tools/GpuToolUtils.h"
27#include "tools/ToolUtils.h"
28
29using namespace skgpu::graphite;
31
32namespace {
33
34const SkISize kSurfaceSize = { 16, 16 };
35const SkISize kImageSize = { 32, 32 };
36
37constexpr SkColor4f kBaseImageColor = SkColors::kYellow;
38constexpr SkColor4f kFirstMipLevelColor = SkColors::kRed;
39constexpr SkColor4f kBackgroundColor = SkColors::kBlue;
40
41sk_sp<SkImage> create_and_attach_mipmaps(sk_sp<SkImage> img) {
42 constexpr SkColor4f mipLevelColors[] = {
43 kFirstMipLevelColor,
48 };
49
51
52 int count = builder.countLevels();
53
54 SkASSERT_RELEASE(count == SkToInt(std::size(mipLevelColors)));
55
56 for (int i = 0; i < count; ++i) {
57 SkPixmap pm = builder.level(i);
58 pm.erase(mipLevelColors[i]);
59 }
60
61 return builder.attachTo(img);
62}
63
64sk_sp<SkImage> create_raster(Mipmapped mipmapped) {
66 kImageSize.height(),
69 SkBitmap bm;
70 if (!bm.tryAllocPixels(ii)) {
71 return nullptr;
72 }
73
74 bm.eraseColor(kBaseImageColor);
75
77
78 if (mipmapped == Mipmapped::kYes) {
79 img = create_and_attach_mipmaps(std::move(img));
80 }
81
82 return img;
83}
84
85/* 0 */
86sk_sp<SkImage> create_raster_backed_image_no_mipmaps(Recorder*) {
87 return create_raster(Mipmapped::kNo);
88}
89
90/* 1 */
91sk_sp<SkImage> create_raster_backed_image_with_mipmaps(Recorder*) {
92 return create_raster(Mipmapped::kYes);
93}
94
95/* 2 */
96sk_sp<SkImage> create_gpu_backed_image_no_mipmaps(Recorder* recorder) {
97 sk_sp<SkImage> raster = create_raster(Mipmapped::kNo);
98 return SkImages::TextureFromImage(recorder, raster, {false});
99}
100
101/* 3 */
102sk_sp<SkImage> create_gpu_backed_image_with_mipmaps(Recorder* recorder) {
103 sk_sp<SkImage> raster = create_raster(Mipmapped::kYes);
104 return SkImages::TextureFromImage(recorder, raster, {true});
105}
106
107/* 4 */
108sk_sp<SkImage> create_picture_backed_image(Recorder*) {
109 SkIRect r = SkIRect::MakeWH(kImageSize.width(), kImageSize.height());
111 paint.setColor(kBaseImageColor);
112
113 SkPictureRecorder recorder;
114 SkCanvas* canvas = recorder.beginRecording(SkRect::Make(r));
115 canvas->drawIRect(r, paint);
117
118 return SkImages::DeferredFromPicture(std::move(picture),
119 r.size(),
120 /* matrix= */ nullptr,
121 /* paint= */ nullptr,
124}
125
126/* 5 */
127sk_sp<SkImage> create_bitmap_generator_backed_image(Recorder*) {
128
129 class BitmapBackedGenerator final : public SkImageGenerator {
130 public:
131 BitmapBackedGenerator()
133 kImageSize.height(),
136 }
137
138 bool onGetPixels(const SkImageInfo& dstInfo,
139 void* pixels,
140 size_t rowBytes,
141 const Options&) override {
142
143 if (dstInfo.dimensions() != kImageSize) {
144 return false;
145 }
146
147 SkBitmap bm;
148 if (!bm.tryAllocPixels(dstInfo)) {
149 return false;
150 }
151
152 bm.eraseColor(kBaseImageColor);
153
154 return bm.readPixels(dstInfo, pixels, rowBytes, 0, 0);
155 }
156 };
157
158 std::unique_ptr<SkImageGenerator> gen(new BitmapBackedGenerator());
159
160 return SkImages::DeferredFromGenerator(std::move(gen));
161}
162
163bool check_img(skiatest::Reporter* reporter,
164 Context* context,
165 Recorder* recorder,
166 SkImage* imageToDraw,
167 Mipmapped mipmapped,
168 const char* testcase,
169 const SkColor4f& expectedColor) {
171
173 result.allocPixels(ii);
174 SkPixmap pm;
175
176 SkAssertResult(result.peekPixels(&pm));
177
178 {
180 if (!surface) {
181 ERRORF(reporter, "Surface creation failed");
182 return false;
183 }
184
185 SkCanvas* canvas = surface->getCanvas();
186
187 canvas->clear(kBackgroundColor);
188
192
193 canvas->drawImageRect(imageToDraw,
194 SkRect::MakeWH(kSurfaceSize.width(), kSurfaceSize.height()),
195 sampling);
196
197 if (!surface->readPixels(pm, 0, 0)) {
198 ERRORF(reporter, "readPixels failed");
199 return false;
200 }
201 }
202
203 auto error = std::function<ComparePixmapsErrorReporter>(
204 [&](int x, int y, const float diffs[4]) {
206 "case %s %s: expected (%.1f %.1f %.1f %.1f) got (%.1f, %.1f, %.1f, %.1f)",
207 testcase,
208 (mipmapped == Mipmapped::kYes) ? "w/ mipmaps" : "w/o mipmaps",
209 expectedColor.fR, expectedColor.fG, expectedColor.fB, expectedColor.fA,
210 expectedColor.fR-diffs[0], expectedColor.fG-diffs[1],
211 expectedColor.fB-diffs[2], expectedColor.fA-diffs[3]);
212 });
213 static constexpr float kTol[] = {0, 0, 0, 0};
214 CheckSolidPixels(expectedColor, pm, kTol, error);
215
216 return true;
217}
218
219using FactoryT = sk_sp<SkImage> (*)(Recorder*);
220
221struct TestCase {
222 const char* fTestCase;
223 FactoryT fFactory;
224 SkColor4f fExpectedColors[2]; /* [ w/o mipmaps, w/ mipmaps ] */
225};
226
228 Context* context,
229 Recorder* recorder,
230 SkSpan<const TestCase> testcases) {
231
232 for (auto t : testcases) {
233 for (auto mm : { Mipmapped::kNo, Mipmapped::kYes }) {
234 sk_sp<SkImage> image = t.fFactory(recorder);
235
236 check_img(reporter, context, recorder, image.get(), mm,
237 t.fTestCase, t.fExpectedColors[static_cast<int>(mm)]);
238 }
239 }
240}
241
242} // anonymous namespace
243
244// This test creates a bunch of solid yellow images in different ways and then draws them into a
245// smaller surface (w/ src mode) that has been initialized to solid blue. When mipmap levels
246// are possible to be specified the first mipmap level is made red. Thus, when mipmapping
247// is allowed and it is specified as the sample mode, the drawn image will be red.
248
249// For the Default ImageProvider (which does _no_ caching and conversion) the expectations are:
250//
251// 0) raster-backed image w/o mipmaps
252// drawn w/o mipmapping --> dropped draw (blue)
253// drawn w/ mipmapping --> dropped draw (blue)
254//
255// 1) raster-backed image w/ mipmaps
256// drawn w/o mipmapping --> dropped draw (blue)
257// drawn w/ mipmapping --> dropped draw (blue)
258//
259// 2) Graphite-backed w/o mipmaps
260// drawn w/o mipmapping --> drawn (yellow)
261// drawn w/ mipmapping --> drawn (yellow) - mipmap filtering is dropped
262//
263// 3) Graphite-backed w/ mipmaps
264// drawn w/o mipmapping --> drawn (yellow)
265// drawn w/ mipmapping --> drawn (red)
266//
267// 4) picture-backed image
268// drawn w/o mipmapping --> dropped draw (blue)
269// drawn w/ mipmapping --> dropped draw (blue)
270//
271// 5) bitmap-backed-generator based image
272// drawn w/o mipmapping --> dropped draw (blue)
273// drawn w/ mipmapping --> dropped draw (blue)
274//
275DEF_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS(ImageProviderTest_Graphite_Default, reporter, context,
277 TestCase testcases[] = {
278 { "0", create_raster_backed_image_no_mipmaps, { kBackgroundColor, kBackgroundColor } },
279 { "1", create_raster_backed_image_with_mipmaps, { kBackgroundColor, kBackgroundColor } },
280 { "2", create_gpu_backed_image_no_mipmaps, { kBaseImageColor, kBaseImageColor } },
281 { "3", create_gpu_backed_image_with_mipmaps, { kBaseImageColor, kFirstMipLevelColor } },
282 { "4", create_picture_backed_image, { kBackgroundColor, kBackgroundColor } },
283 { "5", create_bitmap_generator_backed_image, { kBackgroundColor, kBackgroundColor } },
284 };
285
286 std::unique_ptr<Recorder> recorder = context->makeRecorder();
287
288 run_test(reporter, context, recorder.get(), testcases);
289}
290
291// For the Testing ImageProvider (which does some caching and conversion) the expectations are:
292//
293// 0) raster-backed image w/o mipmaps
294// drawn w/o mipmapping --> drawn (yellow) - auto-converted
295// drawn w/ mipmapping --> drawn (yellow) - auto-converted
296//
297// 1) raster-backed image w/ mipmaps
298// drawn w/o mipmapping --> drawn (yellow) - auto-converted
299// drawn w/ mipmapping --> drawn (red) - auto-converted
300//
301// 2) Graphite-backed w/o mipmaps
302// drawn w/o mipmapping --> drawn (yellow)
303// drawn w/ mipmapping --> drawn (yellow) - mipmap filtering is dropped
304//
305// 3) Graphite-backed w/ mipmaps
306// drawn w/o mipmapping --> drawn (yellow)
307// drawn w/ mipmapping --> drawn (red)
308//
309// 4) picture-backed image
310// drawn w/o mipmapping --> drawn (yellow) - auto-converted
311// drawn w/ mipmapping --> drawn (yellow) - mipmaps auto generated
312//
313// 5) bitmap-backed-generator based image
314// drawn w/o mipmapping --> drawn (yellow) - auto-converted
315// drawn w/ mipmapping --> drawn (yellow) - auto-converted
316//
317DEF_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS(ImageProviderTest_Graphite_Testing, reporter, context,
319 static const TestCase testcases[] = {
320 { "0", create_raster_backed_image_no_mipmaps, { kBaseImageColor, kBaseImageColor } },
321 { "1", create_raster_backed_image_with_mipmaps, { kBaseImageColor, kFirstMipLevelColor } },
322 { "2", create_gpu_backed_image_no_mipmaps, { kBaseImageColor, kBaseImageColor } },
323 { "3", create_gpu_backed_image_with_mipmaps, { kBaseImageColor, kFirstMipLevelColor } },
324 { "4", create_picture_backed_image, { kBaseImageColor, kBaseImageColor } },
325 { "5", create_bitmap_generator_backed_image, { kBaseImageColor, kBaseImageColor } },
326 };
327
328 RecorderOptions options = ToolUtils::CreateTestingRecorderOptions();
329 std::unique_ptr<skgpu::graphite::Recorder> recorder = context->makeRecorder(options);
330
331 run_test(reporter, context, recorder.get(), testcases);
332}
333
334// Here we're testing that the RequiredProperties parameter to makeTextureImage and makeSubset
335// works as expected.
336DEF_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS(Make_TextureImage_Subset_Test, reporter, context,
338 static const struct {
339 std::string name;
340 FactoryT fFactory;
341 } testcases[] = {
342 { "raster_no_mips", create_raster_backed_image_no_mipmaps },
343 { "raster_with_mips", create_raster_backed_image_with_mipmaps },
344 { "texture_no_mips", create_gpu_backed_image_no_mipmaps },
345 { "texture_with_mips", create_gpu_backed_image_with_mipmaps },
346 { "picture_backed", create_picture_backed_image },
347 { "image_generator", create_bitmap_generator_backed_image },
348 };
349
350 const SkIRect kFakeSubset = SkIRect::MakeWH(kImageSize.width(), kImageSize.height());
351 const SkIRect kTrueSubset = kFakeSubset.makeInset(4, 4);
352
353 std::unique_ptr<Recorder> recorderUP = context->makeRecorder();
354 auto recorder = recorderUP.get();
355
356 for (const auto& test : testcases) {
357 sk_sp<SkImage> orig = test.fFactory(recorder);
359 for (bool mipmapped : {false, true}) {
361 SkStringPrintf("mipmaps: %d", (int)mipmapped));
362 sk_sp<SkImage> i = SkImages::TextureFromImage(recorder, orig, {mipmapped});
363
364 // makeTextureImage has an optimization which allows Mipmaps on an Image if it
365 // would take extra work to remove them.
366 bool mipmapOptAllowed = orig->hasMipmaps() && !mipmapped;
367
368 REPORTER_ASSERT(reporter, i->isTextureBacked());
370 reporter,
371 (i->hasMipmaps() == mipmapped) || (i->hasMipmaps() && mipmapOptAllowed));
372
373 // SkImage::makeSubset should "leave an image where it is", that is, return a
374 // texture backed image iff the original image was texture backed. Otherwise,
375 // it will return a raster image.
376 i = orig->makeSubset(recorder, kTrueSubset, {mipmapped});
377 REPORTER_ASSERT(reporter, orig->isTextureBacked() == i->isTextureBacked(),
378 "orig texture status %d != subset texture status %d",
379 orig->isTextureBacked(), i->isTextureBacked());
380 if (i->isTextureBacked()) {
381 REPORTER_ASSERT(reporter, i->dimensions() == kTrueSubset.size());
382 REPORTER_ASSERT(reporter, i->hasMipmaps() == mipmapped);
383 }
384
385 i = orig->makeSubset(recorder, kFakeSubset, {mipmapped});
386 REPORTER_ASSERT(reporter, orig->isTextureBacked() == i->isTextureBacked(),
387 "orig texture status %d != subset texture status %d",
388 orig->isTextureBacked(), i->isTextureBacked());
389 if (i->isTextureBacked()) {
390 REPORTER_ASSERT(reporter, i->dimensions() == kFakeSubset.size());
392 reporter,
393 i->hasMipmaps() == mipmapped || (i->hasMipmaps() && mipmapOptAllowed));
394 }
395
396 // SubsetTextureFrom should always return a texture-backed image
397 i = SkImages::SubsetTextureFrom(recorder, orig.get(), kTrueSubset, {mipmapped});
398 REPORTER_ASSERT(reporter, i->isTextureBacked());
399 REPORTER_ASSERT(reporter, i->dimensions() == kTrueSubset.size());
400 REPORTER_ASSERT(reporter, i->hasMipmaps() == mipmapped);
401
402 if (!orig->isTextureBacked()) {
403 i = SkImages::TextureFromImage(nullptr, orig, {mipmapped});
405
406 // Make sure makeSubset w/o a recorder works as expected
407 i = orig->makeSubset(nullptr, kTrueSubset, {mipmapped});
408 REPORTER_ASSERT(reporter, !i->isTextureBacked());
409 REPORTER_ASSERT(reporter, i->dimensions() == kTrueSubset.size());
410 REPORTER_ASSERT(reporter, i->hasMipmaps() == mipmapped);
411
412 i = orig->makeSubset(nullptr, kFakeSubset, {mipmapped});
413 REPORTER_ASSERT(reporter, !i->isTextureBacked());
414 REPORTER_ASSERT(reporter, i->dimensions() == kFakeSubset.size());
415 REPORTER_ASSERT(reporter, i->hasMipmaps() == mipmapped);
416 }
417 }
418 }
419}
420
421namespace {
422
423SkColorType pick_colortype(const Caps* caps, bool mipmapped) {
424 auto mm = mipmapped ? skgpu::Mipmapped::kYes : skgpu::Mipmapped::kNo;
427 if (info.isValid()) {
429 }
430
433 if (info.isValid()) {
435 }
436
438}
439
440} // anonymous namespace
441
442// Here we're testing that the RequiredProperties parameter of:
443// SkImage::makeColorSpace and
444// SkImage::makeColorTypeAndColorSpace
445// works as expected.
448 static const struct {
449 std::string name;
450 FactoryT fFactory;
451 bool fTextureBacked;
452 } testcases[] = {
453 { "raster_no_mips", create_raster_backed_image_no_mipmaps, false },
454 { "raster_with_mips", create_raster_backed_image_with_mipmaps, false },
455 { "texture_no_mips", create_gpu_backed_image_no_mipmaps, true },
456 { "texture_with_mips", create_gpu_backed_image_with_mipmaps, true },
457 { "picture_backed", create_picture_backed_image, false },
458 { "image_generator", create_bitmap_generator_backed_image, false },
459 };
460
462
463 std::unique_ptr<Recorder> recorder = context->makeRecorder();
464
465 const Caps* caps = recorder->priv().caps();
466
467 for (const auto& testcase : testcases) {
468 skiatest::ReporterContext subtest(reporter, testcase.name);
469 sk_sp<SkImage> orig = testcase.fFactory(recorder.get());
470
473 SkASSERT(!orig->colorSpace() || orig->colorSpace() == SkColorSpace::MakeSRGB().get());
474
475 for (bool mipmapped : {false, true}) {
477 SkStringPrintf("mipmaps: %d", (int)mipmapped));
478 sk_sp<SkImage> i = orig->makeColorSpace(recorder.get(), spin, {mipmapped});
479
480 REPORTER_ASSERT(reporter, i != nullptr);
481 REPORTER_ASSERT(reporter, i->isTextureBacked() == testcase.fTextureBacked);
482 REPORTER_ASSERT(reporter, i->colorSpace() == spin.get());
483 if (testcase.fTextureBacked) {
484 REPORTER_ASSERT(reporter, i->hasMipmaps() == mipmapped);
485 } else {
486 REPORTER_ASSERT(reporter, !i->hasMipmaps());
487 }
488
489 SkColorType altCT = pick_colortype(caps, mipmapped);
490 i = orig->makeColorTypeAndColorSpace(recorder.get(), altCT, spin, {mipmapped});
491
492 REPORTER_ASSERT(reporter, i != nullptr);
493 REPORTER_ASSERT(reporter, i->isTextureBacked() == testcase.fTextureBacked);
494 REPORTER_ASSERT(reporter, i->colorType() == altCT);
495 REPORTER_ASSERT(reporter, i->colorSpace() == spin.get());
496 if (testcase.fTextureBacked) {
497 REPORTER_ASSERT(reporter, i->hasMipmaps() == mipmapped);
498 } else {
499 REPORTER_ASSERT(reporter, !i->hasMipmaps());
500 }
501 }
502 }
503}
static void run_test(GrDirectContext *dContext, skiatest::Reporter *reporter, BulkRectTest test)
const char * options
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
reporter
Definition: FontMgrTest.cpp:39
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
int count
Definition: FontMgrTest.cpp:50
DEF_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS(ImageProviderTest_Graphite_Default, reporter, context, CtsEnforcement::kNextRelease)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
#define SkASSERT_RELEASE(cond)
Definition: SkAssert.h:100
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkColorType
Definition: SkColorType.h:19
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
Definition: SkColorType.h:26
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
Definition: SkColorType.h:38
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
Definition: SkColorType.h:22
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
@ kUnknown_SkColorType
uninitialized
Definition: SkColorType.h:20
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
constexpr int SkToInt(S x)
Definition: SkTo.h:29
bool CheckSolidPixels(const SkColor4f &col, const SkPixmap &pixmap, const float tolRGBA[4], std::function< ComparePixmapsErrorReporter > &error)
Definition: TestUtils.cpp:191
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
#define ERRORF(r,...)
Definition: Test.h:293
bool readPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY) const
Definition: SkBitmap.cpp:488
bool tryAllocPixels(const SkImageInfo &info, size_t rowBytes)
Definition: SkBitmap.cpp:271
void eraseColor(SkColor4f) const
Definition: SkBitmap.cpp:442
void drawIRect(const SkIRect &rect, const SkPaint &paint)
Definition: SkCanvas.h:1358
void clear(SkColor color)
Definition: SkCanvas.h:1199
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
Definition: SkCanvas.cpp:2333
static sk_sp< SkColorSpace > MakeSRGB()
sk_sp< SkColorSpace > makeColorSpin() const
SkImageGenerator(const SkImageInfo &info, uint32_t uniqueId=kNeedNewImageUniqueID)
virtual bool onGetPixels(const SkImageInfo &, void *, size_t, const Options &)
virtual sk_sp< SkImage > makeColorSpace(GrDirectContext *direct, sk_sp< SkColorSpace > target) const =0
const SkImageInfo & imageInfo() const
Definition: SkImage.h:279
SkColorSpace * colorSpace() const
Definition: SkImage.cpp:156
SkColorType colorType() const
Definition: SkImage.cpp:152
virtual sk_sp< SkImage > makeColorTypeAndColorSpace(GrDirectContext *direct, SkColorType targetColorType, sk_sp< SkColorSpace > targetCS) const =0
virtual bool isTextureBacked() const =0
bool hasMipmaps() const
Definition: SkImage.cpp:292
virtual sk_sp< SkImage > makeSubset(GrDirectContext *direct, const SkIRect &subset) const =0
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
bool erase(SkColor color, const SkIRect &subset) const
Definition: SkPixmap.cpp:742
T * get() const
Definition: SkRefCnt.h:303
virtual TextureInfo getDefaultSampledTextureInfo(SkColorType, Mipmapped mipmapped, Protected, Renderable) const =0
const Paint & paint
Definition: color_source.cc:38
VkSurfaceKHR surface
Definition: main.cc:49
const uint8_t uint32_t uint32_t GError ** error
GAsyncResult * result
static const int kImageSize
Definition: flippity.cpp:44
double y
double x
constexpr SkColor4f kMagenta
Definition: SkColor.h:445
constexpr SkColor4f kGreen
Definition: SkColor.h:441
constexpr SkColor4f kRed
Definition: SkColor.h:440
constexpr SkColor4f kWhite
Definition: SkColor.h:439
constexpr SkColor4f kCyan
Definition: SkColor.h:444
constexpr SkColor4f kBlue
Definition: SkColor.h:442
constexpr SkColor4f kYellow
Definition: SkColor.h:443
SK_API sk_sp< SkImage > DeferredFromPicture(sk_sp< SkPicture > picture, const SkISize &dimensions, const SkMatrix *matrix, const SkPaint *paint, BitDepth bitDepth, sk_sp< SkColorSpace > colorSpace, SkSurfaceProps props)
SK_API sk_sp< SkImage > DeferredFromGenerator(std::unique_ptr< SkImageGenerator > imageGenerator)
SK_API sk_sp< SkImage > TextureFromImage(GrDirectContext *, const SkImage *, skgpu::Mipmapped=skgpu::Mipmapped::kNo, skgpu::Budgeted=skgpu::Budgeted::kYes)
SK_API sk_sp< SkImage > SubsetTextureFrom(GrDirectContext *context, const SkImage *img, const SkIRect &subset)
SK_API sk_sp< SkImage > RasterFromBitmap(const SkBitmap &bitmap)
@ kU8
uses 8-bit unsigned int per color component
sk_sp< const SkImage > image
Definition: SkRecords.h:269
sk_sp< const SkPicture > picture
Definition: SkRecords.h:299
SkSamplingOptions sampling
Definition: SkRecords.h:337
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)
def gen()
Definition: dom.py:77
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
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
Definition: switches.h:259
Definition: gen.py:1
Mipmapped
Definition: GpuTypes.h:53
SkSamplingOptions(SkFilterMode::kLinear))
Definition: SkRect.h:32
constexpr SkISize size() const
Definition: SkRect.h:172
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
Definition: SkRect.h:56
SkIRect makeInset(int32_t dx, int32_t dy) const
Definition: SkRect.h:332
Definition: SkSize.h:16
constexpr int32_t width() const
Definition: SkSize.h:36
constexpr int32_t height() const
Definition: SkSize.h:37
SkISize dimensions() const
Definition: SkImageInfo.h:421
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static SkRect Make(const SkISize &size)
Definition: SkRect.h:669
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609
static sk_sp< SkColorFilter > spin(sk_sp< SkColorFilter > cf)