Flutter Engine
The Flutter Engine
embedder_metal_unittests.mm
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#define FML_USED_ON_EMBEDDER
6
7#include <string>
8#include <vector>
9
10#import <Metal/Metal.h>
11
12#include "embedder.h"
13#include "flutter/display_list/skia/dl_sk_canvas.h"
14#include "flutter/fml/synchronization/count_down_latch.h"
15#include "flutter/shell/platform/embedder/tests/embedder_assertions.h"
16#include "flutter/shell/platform/embedder/tests/embedder_config_builder.h"
17#include "flutter/shell/platform/embedder/tests/embedder_test.h"
18#include "flutter/shell/platform/embedder/tests/embedder_test_context_metal.h"
19#include "flutter/shell/platform/embedder/tests/embedder_unittests_util.h"
20#include "flutter/testing/assertions_skia.h"
21#include "flutter/testing/testing.h"
22
29
30// CREATE_NATIVE_ENTRY is leaky by design
31// NOLINTBEGIN(clang-analyzer-core.StackAddressEscape)
32
33namespace flutter {
34namespace testing {
35
37
38TEST_F(EmbedderTest, CanRenderGradientWithMetal) {
39 auto& context = GetEmbedderContext(EmbedderTestContextType::kMetalContext);
40
42
43 builder.SetDartEntrypoint("render_gradient");
44 builder.SetMetalRendererConfig(SkISize::Make(800, 600));
45
46 auto rendered_scene = context.GetNextSceneImage();
47
48 auto engine = builder.LaunchEngine();
49 ASSERT_TRUE(engine.is_valid());
50
51 // Send a window metrics events so frames may be scheduled.
53 event.struct_size = sizeof(event);
54 event.width = 800;
55 event.height = 600;
56 event.pixel_ratio = 1.0;
58
59 // TODO (https://github.com/flutter/flutter/issues/73590): re-enable once
60 // we are able to figure out why this fails on the bots.
61 // ASSERT_TRUE(ImageMatchesFixture("gradient_metal.png", rendered_scene));
62}
63
65 SkISize texture_size,
66 void* texture) {
67 GrMtlTextureInfo info;
68 info.fTexture.reset([(id<MTLTexture>)texture retain]);
70 texture_size.width(), texture_size.height(), skgpu::Mipmapped::kNo, info);
71
72 return SkSurfaces::WrapBackendTexture(skia_context.get(), backend_texture,
74 nullptr, nullptr);
75}
76
77TEST_F(EmbedderTest, ExternalTextureMetal) {
78 EmbedderTestContextMetal& context = reinterpret_cast<EmbedderTestContextMetal&>(
79 GetEmbedderContext(EmbedderTestContextType::kMetalContext));
80
81 const auto texture_size = SkISize::Make(800, 600);
82 const int64_t texture_id = 1;
83
84 TestMetalContext* metal_context = context.GetTestMetalContext();
85 TestMetalContext::TextureInfo texture_info = metal_context->CreateMetalTexture(texture_size);
86
88 GetSurfaceFromTexture(metal_context->GetSkiaContext(), texture_size, texture_info.texture);
89 auto canvas = surface->getCanvas();
90 canvas->clear(SK_ColorRED);
91 metal_context->GetSkiaContext()->flushAndSubmit();
92
93 std::vector<FlutterMetalTextureHandle> textures{texture_info.texture};
94
96 [&](int64_t id, size_t w, size_t h, FlutterMetalExternalTexture* output) {
97 EXPECT_TRUE(w == texture_size.width());
98 EXPECT_TRUE(h == texture_size.height());
100 output->num_textures = 1;
101 output->height = h;
102 output->width = w;
104 output->textures = textures.data();
105 return true;
106 });
107
109
110 builder.SetDartEntrypoint("render_texture");
111 builder.SetMetalRendererConfig(texture_size);
112
113 auto engine = builder.LaunchEngine();
114 ASSERT_TRUE(engine.is_valid());
115
117
118 auto rendered_scene = context.GetNextSceneImage();
119
120 // Send a window metrics events so frames may be scheduled.
121 FlutterWindowMetricsEvent event = {};
122 event.struct_size = sizeof(event);
123 event.width = texture_size.width();
124 event.height = texture_size.height();
125 event.pixel_ratio = 1.0;
127
128 ASSERT_TRUE(ImageMatchesFixture("external_texture_metal.png", rendered_scene));
129}
130
131TEST_F(EmbedderTest, MetalCompositorMustBeAbleToRenderPlatformViews) {
132 auto& context = GetEmbedderContext(EmbedderTestContextType::kMetalContext);
133
135 builder.SetMetalRendererConfig(SkISize::Make(800, 600));
136 builder.SetCompositor();
137 builder.SetDartEntrypoint("can_composite_platform_views");
138
140
141 fml::CountDownLatch latch(3);
142 context.GetCompositor().SetNextPresentCallback(
143 [&](FlutterViewId view_id, const FlutterLayer** layers, size_t layers_count) {
144 ASSERT_EQ(layers_count, 3u);
145
146 {
147 FlutterBackingStore backing_store = *layers[0]->backing_store;
148 backing_store.struct_size = sizeof(backing_store);
149 backing_store.type = kFlutterBackingStoreTypeMetal;
150 backing_store.did_update = true;
151
152 FlutterRect paint_region_rects[] = {
153 FlutterRectMakeLTRB(0, 0, 800, 600),
154 };
155 FlutterRegion paint_region = {
156 .struct_size = sizeof(FlutterRegion),
157 .rects_count = 1,
158 .rects = paint_region_rects,
159 };
160 FlutterBackingStorePresentInfo present_info = {
162 .paint_region = &paint_region,
163 };
164
165 FlutterLayer layer = {};
166 layer.struct_size = sizeof(layer);
168 layer.backing_store = &backing_store;
169 layer.size = FlutterSizeMake(800.0, 600.0);
170 layer.offset = FlutterPointMake(0, 0);
171 layer.backing_store_present_info = &present_info;
172
173 ASSERT_EQ(*layers[0], layer);
174 }
175
176 {
178 platform_view.struct_size = sizeof(platform_view);
179 platform_view.identifier = 42;
180
181 FlutterLayer layer = {};
182 layer.struct_size = sizeof(layer);
185 layer.size = FlutterSizeMake(123.0, 456.0);
186 layer.offset = FlutterPointMake(1.0, 2.0);
187
188 ASSERT_EQ(*layers[1], layer);
189 }
190
191 {
192 FlutterBackingStore backing_store = *layers[2]->backing_store;
193 backing_store.struct_size = sizeof(backing_store);
194 backing_store.type = kFlutterBackingStoreTypeMetal;
195 backing_store.did_update = true;
196
197 FlutterRect paint_region_rects[] = {
198 FlutterRectMakeLTRB(2, 3, 800, 600),
199 };
200 FlutterRegion paint_region = {
201 .struct_size = sizeof(FlutterRegion),
202 .rects_count = 1,
203 .rects = paint_region_rects,
204 };
205 FlutterBackingStorePresentInfo present_info = {
207 .paint_region = &paint_region,
208 };
209
210 FlutterLayer layer = {};
211 layer.struct_size = sizeof(layer);
213 layer.backing_store = &backing_store;
214 layer.size = FlutterSizeMake(800.0, 600.0);
215 layer.offset = FlutterPointMake(0.0, 0.0);
216 layer.backing_store_present_info = &present_info;
217
218 ASSERT_EQ(*layers[2], layer);
219 }
220
221 latch.CountDown();
222 });
223
224 context.AddNativeCallback(
225 "SignalNativeTest",
227
228 auto engine = builder.LaunchEngine();
229
230 // Send a window metrics events so frames may be scheduled.
231 FlutterWindowMetricsEvent event = {};
232 event.struct_size = sizeof(event);
233 event.width = 800;
234 event.height = 600;
235 event.pixel_ratio = 1.0;
237 ASSERT_TRUE(engine.is_valid());
238
239 latch.Wait();
240}
241
242TEST_F(EmbedderTest, CanRenderSceneWithoutCustomCompositorMetal) {
243 auto& context = GetEmbedderContext(EmbedderTestContextType::kMetalContext);
244
246
247 builder.SetDartEntrypoint("can_render_scene_without_custom_compositor");
248 builder.SetMetalRendererConfig(SkISize::Make(800, 600));
249
250 auto rendered_scene = context.GetNextSceneImage();
251
252 auto engine = builder.LaunchEngine();
253 ASSERT_TRUE(engine.is_valid());
254
255 // Send a window metrics events so frames may be scheduled.
256 FlutterWindowMetricsEvent event = {};
257 event.struct_size = sizeof(event);
258 event.width = 800;
259 event.height = 600;
260 event.pixel_ratio = 1.0;
262
263 ASSERT_TRUE(ImageMatchesFixture("scene_without_custom_compositor.png", rendered_scene));
264}
265
266TEST_F(EmbedderTest, TextureDestructionCallbackCalledWithoutCustomCompositorMetal) {
267 EmbedderTestContextMetal& context = reinterpret_cast<EmbedderTestContextMetal&>(
268 GetEmbedderContext(EmbedderTestContextType::kMetalContext));
270 builder.SetMetalRendererConfig(SkISize::Make(800, 600));
271 builder.SetDartEntrypoint("texture_destruction_callback_called_without_custom_compositor");
272
273 struct CollectContext {
274 int present_count = 0;
275 int collect_count = 0;
277 };
278
279 auto collect_context = std::make_unique<CollectContext>();
280 context.SetNextDrawableCallback([&context, &collect_context](const FlutterFrameInfo* frame_info) {
281 auto texture_info = context.GetTestMetalSurface()->GetTextureInfo();
282
284 texture.struct_size = sizeof(FlutterMetalTexture);
285 texture.texture_id = texture_info.texture_id;
286 texture.texture = reinterpret_cast<FlutterMetalTextureHandle>(texture_info.texture);
287 texture.user_data = collect_context.get();
288 texture.destruction_callback = [](void* user_data) {
289 CollectContext* callback_collect_context = reinterpret_cast<CollectContext*>(user_data);
290 ASSERT_TRUE(callback_collect_context->present_count > 0);
291 callback_collect_context->collect_count++;
292 callback_collect_context->latch.Signal();
293 };
294 return texture;
295 });
296 context.SetPresentCallback([&context, &collect_context](int64_t texture_id) {
297 collect_context->present_count++;
298 return context.GetTestMetalContext()->Present(texture_id);
299 });
300
301 auto engine = builder.LaunchEngine();
302
303 // Send a window metrics events so frames may be scheduled.
304 FlutterWindowMetricsEvent event = {};
305 event.struct_size = sizeof(event);
306 event.width = 800;
307 event.height = 600;
308 event.pixel_ratio = 1.0;
310 ASSERT_TRUE(engine.is_valid());
311
312 collect_context->latch.Wait();
313 EXPECT_EQ(collect_context->collect_count, 1);
314}
315
316TEST_F(EmbedderTest, CompositorMustBeAbleToRenderKnownSceneMetal) {
317 auto& context = GetEmbedderContext(EmbedderTestContextType::kMetalContext);
318
320 builder.SetMetalRendererConfig(SkISize::Make(800, 600));
321 builder.SetCompositor();
322 builder.SetDartEntrypoint("can_composite_platform_views_with_known_scene");
323
325
326 fml::CountDownLatch latch(5);
327
328 auto scene_image = context.GetNextSceneImage();
329
330 context.GetCompositor().SetNextPresentCallback(
331 [&](FlutterViewId view_id, const FlutterLayer** layers, size_t layers_count) {
332 ASSERT_EQ(layers_count, 5u);
333
334 // Layer Root
335 {
336 FlutterBackingStore backing_store = *layers[0]->backing_store;
337 backing_store.type = kFlutterBackingStoreTypeMetal;
338 backing_store.did_update = true;
339
340 FlutterRect paint_region_rects[] = {
341 FlutterRectMakeLTRB(0, 0, 800, 600),
342 };
343 FlutterRegion paint_region = {
344 .struct_size = sizeof(FlutterRegion),
345 .rects_count = 1,
346 .rects = paint_region_rects,
347 };
348 FlutterBackingStorePresentInfo present_info = {
350 .paint_region = &paint_region,
351 };
352
353 FlutterLayer layer = {};
354 layer.struct_size = sizeof(layer);
356 layer.backing_store = &backing_store;
357 layer.size = FlutterSizeMake(800.0, 600.0);
358 layer.offset = FlutterPointMake(0.0, 0.0);
359 layer.backing_store_present_info = &present_info;
360
361 ASSERT_EQ(*layers[0], layer);
362 }
363
364 // Layer 1
365 {
367 platform_view.struct_size = sizeof(platform_view);
368 platform_view.identifier = 1;
369
370 FlutterLayer layer = {};
371 layer.struct_size = sizeof(layer);
374 layer.size = FlutterSizeMake(50.0, 150.0);
375 layer.offset = FlutterPointMake(20.0, 20.0);
376
377 ASSERT_EQ(*layers[1], layer);
378 }
379
380 // Layer 2
381 {
382 FlutterBackingStore backing_store = *layers[2]->backing_store;
383 backing_store.type = kFlutterBackingStoreTypeMetal;
384 backing_store.did_update = true;
385
386 FlutterRect paint_region_rects[] = {
387 FlutterRectMakeLTRB(30, 30, 80, 180),
388 };
389 FlutterRegion paint_region = {
390 .struct_size = sizeof(FlutterRegion),
391 .rects_count = 1,
392 .rects = paint_region_rects,
393 };
394 FlutterBackingStorePresentInfo present_info = {
396 .paint_region = &paint_region,
397 };
398
399 FlutterLayer layer = {};
400 layer.struct_size = sizeof(layer);
402 layer.backing_store = &backing_store;
403 layer.size = FlutterSizeMake(800.0, 600.0);
404 layer.offset = FlutterPointMake(0.0, 0.0);
405 layer.backing_store_present_info = &present_info;
406
407 ASSERT_EQ(*layers[2], layer);
408 }
409
410 // Layer 3
411 {
413 platform_view.struct_size = sizeof(platform_view);
414 platform_view.identifier = 2;
415
416 FlutterLayer layer = {};
417 layer.struct_size = sizeof(layer);
420 layer.size = FlutterSizeMake(50.0, 150.0);
421 layer.offset = FlutterPointMake(40.0, 40.0);
422
423 ASSERT_EQ(*layers[3], layer);
424 }
425
426 // Layer 4
427 {
428 FlutterBackingStore backing_store = *layers[4]->backing_store;
429 backing_store.type = kFlutterBackingStoreTypeMetal;
430 backing_store.did_update = true;
431
432 FlutterRect paint_region_rects[] = {
433 FlutterRectMakeLTRB(50, 50, 100, 200),
434 };
435 FlutterRegion paint_region = {
436 .struct_size = sizeof(FlutterRegion),
437 .rects_count = 1,
438 .rects = paint_region_rects,
439 };
440 FlutterBackingStorePresentInfo present_info = {
442 .paint_region = &paint_region,
443 };
444
445 FlutterLayer layer = {};
446 layer.struct_size = sizeof(layer);
448 layer.backing_store = &backing_store;
449 layer.size = FlutterSizeMake(800.0, 600.0);
450 layer.offset = FlutterPointMake(0.0, 0.0);
451 layer.backing_store_present_info = &present_info;
452
453 ASSERT_EQ(*layers[4], layer);
454 }
455
456 latch.CountDown();
457 });
458
459 context.GetCompositor().SetPlatformViewRendererCallback(
460 [&](const FlutterLayer& layer, GrDirectContext* context) -> sk_sp<SkImage> {
461 auto surface = CreateRenderSurface(layer, context);
462 auto canvas = surface->getCanvas();
463 FML_CHECK(canvas != nullptr);
464
465 switch (layer.platform_view->identifier) {
466 case 1: {
468 // See dart test for total order.
469 paint.setColor(SK_ColorGREEN);
470 paint.setAlpha(127);
471 const auto& rect = SkRect::MakeWH(layer.size.width, layer.size.height);
472 canvas->drawRect(rect, paint);
473 latch.CountDown();
474 } break;
475 case 2: {
477 // See dart test for total order.
478 paint.setColor(SK_ColorMAGENTA);
479 paint.setAlpha(127);
480 const auto& rect = SkRect::MakeWH(layer.size.width, layer.size.height);
481 canvas->drawRect(rect, paint);
482 latch.CountDown();
483 } break;
484 default:
485 // Asked to render an unknown platform view.
486 FML_CHECK(false) << "Test was asked to composite an unknown platform view.";
487 }
488
489 return surface->makeImageSnapshot();
490 });
491
492 context.AddNativeCallback(
493 "SignalNativeTest",
495
496 auto engine = builder.LaunchEngine();
497
498 // Send a window metrics events so frames may be scheduled.
499 FlutterWindowMetricsEvent event = {};
500 event.struct_size = sizeof(event);
501 // Flutter still thinks it is 800 x 600. Only the root surface is rotated.
502 event.width = 800;
503 event.height = 600;
504 event.pixel_ratio = 1.0;
506 ASSERT_TRUE(engine.is_valid());
507
508 latch.Wait();
509
510 ASSERT_TRUE(ImageMatchesFixture("compositor.png", scene_image));
511}
512
513TEST_F(EmbedderTest, CreateInvalidBackingstoreMetalTexture) {
514 auto& context = GetEmbedderContext(EmbedderTestContextType::kMetalContext);
516 builder.SetMetalRendererConfig(SkISize::Make(800, 600));
517 builder.SetCompositor();
519 builder.SetDartEntrypoint("invalid_backingstore");
520
521 class TestCollectOnce {
522 public:
523 // Collect() should only be called once
524 void Collect() {
525 ASSERT_FALSE(collected_);
526 collected_ = true;
527 }
528
529 private:
530 bool collected_ = false;
531 };
533
534 builder.GetCompositor().create_backing_store_callback =
535 [](const FlutterBackingStoreConfig* config, //
536 FlutterBackingStore* backing_store_out, //
537 void* user_data //
538 ) {
539 backing_store_out->type = kFlutterBackingStoreTypeMetal;
540 // Deliberately set this to be invalid
541 backing_store_out->user_data = nullptr;
542 backing_store_out->metal.texture.texture = 0;
543 backing_store_out->metal.struct_size = sizeof(FlutterMetalBackingStore);
544 backing_store_out->metal.texture.user_data = new TestCollectOnce();
545 backing_store_out->metal.texture.destruction_callback = [](void* user_data) {
546 reinterpret_cast<TestCollectOnce*>(user_data)->Collect();
547 };
548 return true;
549 };
550
551 context.AddNativeCallback(
552 "SignalNativeTest",
553 CREATE_NATIVE_ENTRY([&latch](Dart_NativeArguments args) { latch.Signal(); }));
554
555 auto engine = builder.LaunchEngine();
556
557 // Send a window metrics events so frames may be scheduled.
558 FlutterWindowMetricsEvent event = {};
559 event.struct_size = sizeof(event);
560 event.width = 800;
561 event.height = 600;
562 event.pixel_ratio = 1.0;
564 ASSERT_TRUE(engine.is_valid());
565 latch.Wait();
566}
567
568TEST_F(EmbedderTest, ExternalTextureMetalRefreshedTooOften) {
569 EmbedderTestContextMetal& context = reinterpret_cast<EmbedderTestContextMetal&>(
570 GetEmbedderContext(EmbedderTestContextType::kMetalContext));
571
572 TestMetalContext* metal_context = context.GetTestMetalContext();
573 auto metal_texture = metal_context->CreateMetalTexture(SkISize::Make(100, 100));
574
575 std::vector<FlutterMetalTextureHandle> textures{metal_texture.texture};
576
577 bool resolve_called = false;
578
580 resolve_called = true;
581 auto res = std::make_unique<FlutterMetalExternalTexture>();
582 res->struct_size = sizeof(FlutterMetalExternalTexture);
583 res->width = res->height = 100;
585 res->textures = textures.data();
586 res->num_textures = 1;
587 return res;
588 });
590
591 auto surface = TestMetalSurface::Create(*metal_context, SkISize::Make(100, 100));
592 auto skia_surface = surface->GetSurface();
593 DlSkCanvasAdapter canvas(skia_surface->getCanvas());
594
595 Texture* texture_ = &texture;
598 .canvas = &canvas,
599 .gr_context = surface->GetGrContext().get(),
600 };
601 texture_->Paint(ctx, SkRect::MakeXYWH(0, 0, 100, 100), false, sampling);
602
603 EXPECT_TRUE(resolve_called);
604 resolve_called = false;
605
606 texture_->Paint(ctx, SkRect::MakeXYWH(0, 0, 100, 100), false, sampling);
607
608 EXPECT_FALSE(resolve_called);
609
610 texture_->MarkNewFrameAvailable();
611
612 texture_->Paint(ctx, SkRect::MakeXYWH(0, 0, 100, 100), false, sampling);
613
614 EXPECT_TRUE(resolve_called);
615}
616
617} // namespace testing
618} // namespace flutter
619
620// NOLINTEND(clang-analyzer-core.StackAddressEscape)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
std::unique_ptr< flutter::PlatformViewIOS > platform_view
@ kTopLeft_GrSurfaceOrigin
Definition: GrTypes.h:148
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
Definition: SkColorType.h:26
constexpr SkColor SK_ColorMAGENTA
Definition: SkColor.h:147
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
void flushAndSubmit(GrSyncCpu sync=GrSyncCpu::kNo)
Backend implementation of |DlCanvas| for |SkCanvas|.
Definition: dl_sk_canvas.h:20
std::function< std::unique_ptr< FlutterMetalExternalTexture >(int64_t, size_t, size_t)> ExternalTextureCallback
sk_sp< GrDirectContext > GetSkiaContext() const
TextureInfo CreateMetalTexture(const SkISize &size)
Returns texture_id = -1 when texture creation fails.
bool Present(int64_t texture_id)
static std::unique_ptr< TestMetalSurface > Create(const TestMetalContext &test_metal_context, SkISize surface_size=SkISize::MakeEmpty())
virtual void MarkNewFrameAvailable()=0
virtual void Paint(PaintContext &context, const SkRect &bounds, bool freeze, const DlImageSampling sampling)=0
void SetNextDrawableCallback(NextDrawableCallback next_drawable_callback)
void SetPresentCallback(PresentCallback present_callback)
void SetExternalTextureCallback(TestExternalTextureCallback external_texture_frame_callback)
std::future< sk_sp< SkImage > > GetNextSceneImage()
T * get() const
Definition: SkRefCnt.h:303
const Paint & paint
Definition: color_source.cc:38
struct _Dart_NativeArguments * Dart_NativeArguments
Definition: dart_api.h:3019
FlutterEngineResult FlutterEngineRegisterExternalTexture(FLUTTER_API_SYMBOL(FlutterEngine) engine, int64_t texture_identifier)
Register an external texture with a unique (per engine) identifier. Only rendering backends that supp...
Definition: embedder.cc:2769
FlutterEngineResult FlutterEngineSendWindowMetricsEvent(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterWindowMetricsEvent *flutter_metrics)
Definition: embedder.cc:2320
@ kFlutterLayerContentTypePlatformView
Indicates that the contents of this layer are determined by the embedder.
Definition: embedder.h:1795
@ kFlutterLayerContentTypeBackingStore
Definition: embedder.h:1793
@ kRGBA
Definition: embedder.h:607
@ kSuccess
Definition: embedder.h:73
@ kFlutterBackingStoreTypeMetal
Specifies a Metal backing store. This is backed by a Metal texture.
Definition: embedder.h:1746
const void * FlutterMetalTextureHandle
Alias for id<MTLTexture>.
Definition: embedder.h:602
FlutterSize FlutterSizeMake(double width, double height)
FlutterRect FlutterRectMakeLTRB(double l, double t, double r, double b)
FlutterPoint FlutterPointMake(double x, double y)
FlutterEngine engine
Definition: main.cc:68
VkSurfaceKHR surface
Definition: main.cc:49
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
FlKeyEvent * event
#define FML_CHECK(condition)
Definition: logging.h:85
FlTexture * texture
SK_API GrBackendTexture MakeMtl(int width, int height, skgpu::Mipmapped, const GrMtlTextureInfo &mtlInfo, std::string_view label={})
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
SkSamplingOptions sampling
Definition: SkRecords.h:337
SK_API sk_sp< SkSurface > WrapBackendTexture(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, int sampleCnt, SkColorType colorType, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
TEST_F(DisplayListTest, Defaults)
sk_sp< SkSurface > CreateRenderSurface(const FlutterLayer &layer, GrDirectContext *context)
testing::EmbedderTest EmbedderTest
bool ImageMatchesFixture(const std::string &fixture_file_name, const sk_sp< SkImage > &scene_image)
static sk_sp< SkSurface > GetSurfaceFromTexture(const sk_sp< GrDirectContext > &skia_context, SkISize texture_size, void *texture)
int64_t FlutterViewId
Definition: flutter_view.h:13
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 h
Definition: switches.h:59
SkScalar w
FlutterBackingStoreType type
Specifies the type of backing store.
Definition: embedder.h:1762
size_t struct_size
The size of this struct. Must be sizeof(FlutterBackingStore).
Definition: embedder.h:1756
FlutterPoint offset
Definition: embedder.h:1835
FlutterLayerContentType type
Definition: embedder.h:1824
const FlutterBackingStore * backing_store
Definition: embedder.h:1828
FlutterBackingStorePresentInfo * backing_store_present_info
Definition: embedder.h:1841
const FlutterPlatformView * platform_view
Definition: embedder.h:1831
size_t struct_size
This size of this struct. Must be sizeof(FlutterLayer).
Definition: embedder.h:1821
FlutterSize size
The size of the layer (in physical pixels).
Definition: embedder.h:1837
FlutterPlatformViewIdentifier identifier
Definition: embedder.h:1720
A structure to represent a rectangle.
Definition: embedder.h:437
A region represented by a collection of non-overlapping rectangles.
Definition: embedder.h:1799
size_t struct_size
The size of this struct. Must be sizeof(FlutterRegion).
Definition: embedder.h:1801
double height
Definition: embedder.h:425
double width
Definition: embedder.h:424
size_t struct_size
The size of this struct. Must be sizeof(FlutterWindowMetricsEvent).
Definition: embedder.h:843
Definition: SkSize.h:16
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20
constexpr int32_t width() const
Definition: SkSize.h:36
constexpr int32_t height() const
Definition: SkSize.h:37
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609
#define CREATE_NATIVE_ENTRY(native_entry)
void * user_data
int64_t texture_id
#define EXPECT_TRUE(handle)
Definition: unit_test.h:678