Flutter Impeller
impeller_unittests.cc
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 #include "flutter/fml/native_library.h"
6 #include "flutter/testing/testing.h"
23 
25 
28 
29 TEST_P(InteropPlaygroundTest, CanCreateContext) {
30  auto context = CreateContext();
31  ASSERT_TRUE(context);
32 }
33 
34 TEST_P(InteropPlaygroundTest, CanCreateDisplayListBuilder) {
35  hpp::DisplayListBuilder builder;
36  ASSERT_TRUE(builder);
37  ASSERT_TRUE(ToImpellerType(builder.GetTransform()).IsIdentity());
38  ASSERT_EQ(builder.GetSaveCount(), 1u);
39  builder.Save();
40  ASSERT_EQ(builder.GetSaveCount(), 2u);
41  builder.Restore();
42  ASSERT_EQ(builder.GetSaveCount(), 1u);
43 }
44 
45 TEST_P(InteropPlaygroundTest, CanCreateSurface) {
46  auto context = CreateContext();
47  ASSERT_TRUE(context);
48  const auto window_size = GetWindowSize();
49  ImpellerISize size = {window_size.width, window_size.height};
50  auto surface = Adopt<Surface>(ImpellerSurfaceCreateWrappedFBONew(
51  context.GetC(), //
52  0u, //
54  &size) //
55  );
56  ASSERT_TRUE(surface);
57 }
58 
60  auto builder =
61  Adopt<DisplayListBuilder>(ImpellerDisplayListBuilderNew(nullptr));
62  auto paint = Adopt<Paint>(ImpellerPaintNew());
63  ImpellerColor color = {0.0, 0.0, 1.0, 1.0};
64  ImpellerPaintSetColor(paint.GetC(), &color);
65  ImpellerRect rect = {10, 20, 100, 200};
66  ImpellerDisplayListBuilderDrawRect(builder.GetC(), &rect, paint.GetC());
67  color = {1.0, 0.0, 0.0, 1.0};
68  ImpellerPaintSetColor(paint.GetC(), &color);
69  ImpellerDisplayListBuilderTranslate(builder.GetC(), 110, 210);
70  ImpellerMatrix scale_transform = {
71  // clang-format off
72  2.0, 0.0, 0.0, 0.0, //
73  0.0, 2.0, 0.0, 0.0, //
74  0.0, 0.0, 1.0, 0.0, //
75  0.0, 0.0, 0.0, 1.0, //
76  // clang-format on
77  };
78  ImpellerDisplayListBuilderTransform(builder.GetC(), &scale_transform);
79  ImpellerDisplayListBuilderDrawRect(builder.GetC(), &rect, paint.GetC());
80  auto dl = Adopt<DisplayList>(
82  ASSERT_TRUE(dl);
83  ASSERT_TRUE(
84  OpenPlaygroundHere([&](const auto& context, const auto& surface) -> bool {
85  ImpellerSurfaceDrawDisplayList(surface.GetC(), dl.GetC());
86  return true;
87  }));
88 }
89 
90 TEST_P(InteropPlaygroundTest, CanDrawImage) {
91  auto compressed = LoadFixtureImageCompressed(
92  flutter::testing::OpenFixtureAsMapping("boston.jpg"));
93  ASSERT_NE(compressed, nullptr);
94  auto decompressed = compressed->Decode().ConvertToRGBA();
95  ASSERT_TRUE(decompressed.IsValid());
96  ImpellerMapping mapping = {};
97  mapping.data = decompressed.GetAllocation()->GetMapping();
98  mapping.length = decompressed.GetAllocation()->GetSize();
99 
100  auto context = GetInteropContext();
101  ImpellerTextureDescriptor desc = {};
103  desc.size = {decompressed.GetSize().width, decompressed.GetSize().height};
104  desc.mip_count = 1u;
105  auto texture = Adopt<Texture>(ImpellerTextureCreateWithContentsNew(
106  context.GetC(), &desc, &mapping, nullptr));
107  ASSERT_TRUE(texture);
108  auto builder =
109  Adopt<DisplayListBuilder>(ImpellerDisplayListBuilderNew(nullptr));
110  ImpellerPoint point = {100, 100};
111  ImpellerDisplayListBuilderDrawTexture(builder.GetC(), texture.GetC(), &point,
113  nullptr);
114  auto dl = Adopt<DisplayList>(
116  ASSERT_TRUE(
117  OpenPlaygroundHere([&](const auto& context, const auto& surface) -> bool {
118  ImpellerSurfaceDrawDisplayList(surface.GetC(), dl.GetC());
119  return true;
120  }));
121 }
122 
123 TEST_P(InteropPlaygroundTest, CanCreateOpenGLImage) {
124  auto context = GetInteropContext();
125 
126  auto impeller_context = context->GetContext();
127 
128  if (impeller_context->GetBackendType() !=
130  GTEST_SKIP() << "This test works with OpenGL handles is only suitable for "
131  "that backend.";
132  return;
133  }
134 
135  const auto& gl_context = ContextGLES::Cast(*impeller_context);
136  const auto& gl = gl_context.GetReactor()->GetProcTable();
137 
138  constexpr ISize external_texture_size = {200, 300};
139 
140  Allocation texture_data;
141  ASSERT_TRUE(
142  texture_data.Truncate(Bytes{external_texture_size.Area() * 4u}, false));
143 
144  const auto kClearColor = Color::Fuchsia().ToR8G8B8A8();
145 
146  for (size_t i = 0; i < external_texture_size.Area() * 4u; i += 4u) {
147  memcpy(texture_data.GetBuffer() + i, kClearColor.data(), 4);
148  }
149 
150  GLuint external_texture = GL_NONE;
151  gl.GenTextures(1u, &external_texture);
152  ASSERT_NE(external_texture, 0u);
153  gl.BindTexture(GL_TEXTURE_2D, external_texture);
154  gl.TexImage2D(GL_TEXTURE_2D, //
155  0, //
156  GL_RGBA, //
157  external_texture_size.width, //
158  external_texture_size.height, //
159  0, //
160  GL_RGBA, //
161  GL_UNSIGNED_BYTE, //
162  texture_data.GetBuffer() //
163  );
164 
165  ImpellerTextureDescriptor desc = {};
167  desc.size = {external_texture_size.width, external_texture_size.height};
168  desc.mip_count = 1u;
169  auto texture = Adopt<Texture>(ImpellerTextureCreateWithOpenGLTextureHandleNew(
170  context.GetC(), //
171  &desc, //
172  external_texture //
173  ));
174  ASSERT_TRUE(texture);
175 
176  ASSERT_EQ(ImpellerTextureGetOpenGLHandle(texture.GetC()), external_texture);
177 
178  auto builder =
179  Adopt<DisplayListBuilder>(ImpellerDisplayListBuilderNew(nullptr));
180  ImpellerPoint point = {100, 100};
181  ImpellerDisplayListBuilderDrawTexture(builder.GetC(), texture.GetC(), &point,
183  nullptr);
184  auto dl = Adopt<DisplayList>(
186  ASSERT_TRUE(
187  OpenPlaygroundHere([&](const auto& context, const auto& surface) -> bool {
188  ImpellerSurfaceDrawDisplayList(surface.GetC(), dl.GetC());
189  return true;
190  }));
191 }
192 
193 TEST_P(InteropPlaygroundTest, ClearsOpenGLStancilStateAfterTransition) {
194  auto context = GetInteropContext();
195  auto impeller_context = context->GetContext();
196  if (impeller_context->GetBackendType() !=
198  GTEST_SKIP() << "This test works with OpenGL handles is only suitable for "
199  "that backend.";
200  return;
201  }
202  const auto& gl_context = ContextGLES::Cast(*impeller_context);
203  const auto& gl = gl_context.GetReactor()->GetProcTable();
204  auto builder =
205  Adopt<DisplayListBuilder>(ImpellerDisplayListBuilderNew(nullptr));
206  auto paint = Adopt<Paint>(ImpellerPaintNew());
207  ImpellerColor color = {0.0, 0.0, 1.0, 1.0};
208  ImpellerPaintSetColor(paint.GetC(), &color);
209  ImpellerRect rect = {10, 20, 100, 200};
210  ImpellerDisplayListBuilderDrawRect(builder.GetC(), &rect, paint.GetC());
211  color = {1.0, 0.0, 0.0, 1.0};
212  ImpellerPaintSetColor(paint.GetC(), &color);
213  ImpellerDisplayListBuilderTranslate(builder.GetC(), 110, 210);
214  ImpellerDisplayListBuilderClipRect(builder.GetC(), &rect,
216  ImpellerDisplayListBuilderDrawRect(builder.GetC(), &rect, paint.GetC());
217  auto dl = Adopt<DisplayList>(
219  ASSERT_TRUE(dl);
220  ASSERT_TRUE(
221  OpenPlaygroundHere([&](const auto& context, const auto& surface) -> bool {
222  ImpellerSurfaceDrawDisplayList(surface.GetC(), dl.GetC());
223  // OpenGL state is reset even though the operations above enable a
224  // stencil check.
225  GLboolean stencil_enabled = true;
226  gl.GetBooleanv(GL_STENCIL_TEST, &stencil_enabled);
227  return stencil_enabled == GL_FALSE;
228  }));
229 }
230 
231 TEST_P(InteropPlaygroundTest, CanCreateParagraphs) {
232  // Create a typography context.
233  hpp::TypographyContext type_context;
234  ASSERT_TRUE(type_context);
235 
236  // Create a builder.
237  hpp::ParagraphBuilder builder(type_context);
238  ASSERT_TRUE(builder);
239 
240  // Create a paragraph style with the font size and foreground and background
241  // colors.
242  hpp::ParagraphStyle style;
243  ASSERT_TRUE(style);
244  style.SetFontSize(150.0f);
245  style.SetHeight(2.0f);
246 
247  {
248  hpp::Paint paint;
249  ASSERT_TRUE(paint);
250  paint.SetColor({1.0, 0.0, 0.0, 1.0});
251  style.SetForeground(paint);
252  }
253 
254  {
255  hpp::Paint paint;
256  paint.SetColor({1.0, 1.0, 1.0, 1.0});
257  style.SetBackground(paint);
258  }
259 
260  // Push the style onto the style stack.
261  builder.PushStyle(style);
262  std::string text = "the ⚡️ quick ⚡️ brown 🦊 fox jumps over the lazy dog 🐶.";
263 
264  // Add the paragraph text data.
265  builder.AddText(text);
266 
267  // Layout and build the paragraph.
268  auto paragraph = builder.Build(1200.0f);
269  ASSERT_TRUE(paragraph);
270 
271  // Create a display list with just the paragraph drawn into it.
272  hpp::DisplayListBuilder dl_builder;
273  dl_builder.DrawParagraph(paragraph, {20, 20});
274 
275  // Build the display list.
276  auto dl = dl_builder.Build();
277 
278  ASSERT_TRUE(
279  OpenPlaygroundHere([&](const auto& context, const auto& surface) -> bool {
280  hpp::Surface window(surface.GetC());
281  window.Draw(dl);
282  return true;
283  }));
284 }
285 
286 TEST_P(InteropPlaygroundTest, CanCreateShapes) {
287  hpp::DisplayListBuilder builder;
288 
289  hpp::Paint red_paint;
290  red_paint.SetColor({1.0, 0.0, 0.0, 1.0});
291  red_paint.SetStrokeWidth(10.0);
292 
293  builder.Translate(10, 10);
294  builder.DrawRect({0, 0, 100, 100}, red_paint);
295  builder.Translate(100, 100);
296  builder.DrawOval({0, 0, 100, 100}, red_paint);
297  builder.Translate(100, 100);
298  builder.DrawLine({0, 0}, {100, 100}, red_paint);
299 
300  builder.Translate(100, 100);
301  ImpellerRoundingRadii radii = {};
302  radii.top_left = {10, 10};
303  radii.bottom_right = {10, 10};
304  builder.DrawRoundedRect({0, 0, 100, 100}, radii, red_paint);
305 
306  builder.Translate(100, 100);
307  builder.DrawPath(hpp::PathBuilder{}.AddOval({0, 0, 100, 100}).Build(),
308  red_paint);
309 
310  auto dl = builder.Build();
311  ASSERT_TRUE(
312  OpenPlaygroundHere([&](const auto& context, const auto& surface) -> bool {
313  hpp::Surface window(surface.GetC());
314  window.Draw(dl);
315  return true;
316  }));
317 }
318 
319 TEST_P(InteropPlaygroundTest, CanCreateParagraphsWithCustomFont) {
320  // Create a typography context.
321  auto type_context = Adopt<TypographyContext>(ImpellerTypographyContextNew());
322  ASSERT_TRUE(type_context);
323 
324  // Open the custom font file.
325  std::unique_ptr<fml::Mapping> font_data =
326  flutter::testing::OpenFixtureAsMapping("wtf.otf");
327  ASSERT_NE(font_data, nullptr);
328  ASSERT_GT(font_data->GetSize(), 0u);
329  ImpellerMapping font_data_mapping = {
330  .data = font_data->GetMapping(),
331  .length = font_data->GetSize(),
332  .on_release = [](auto ctx) {
333  delete reinterpret_cast<fml::Mapping*>(ctx);
334  }};
335  auto registered =
336  ImpellerTypographyContextRegisterFont(type_context.GetC(), //
337  &font_data_mapping, //
338  font_data.release(), //
339  nullptr //
340  );
341  ASSERT_TRUE(registered);
342 
343  // Create a builder.
344  auto builder =
345  Adopt<ParagraphBuilder>(ImpellerParagraphBuilderNew(type_context.GetC()));
346  ASSERT_TRUE(builder);
347 
348  // Create a paragraph style with the font size and foreground and background
349  // colors.
350  auto style = Adopt<ParagraphStyle>(ImpellerParagraphStyleNew());
351  ASSERT_TRUE(style);
352  ImpellerParagraphStyleSetFontSize(style.GetC(), 150.0f);
353  ImpellerParagraphStyleSetFontFamily(style.GetC(), "WhatTheFlutter");
354 
355  {
356  auto paint = Adopt<Paint>(ImpellerPaintNew());
357  ASSERT_TRUE(paint);
358  ImpellerColor color = {0.0, 1.0, 1.0, 1.0};
359  ImpellerPaintSetColor(paint.GetC(), &color);
360  ImpellerParagraphStyleSetForeground(style.GetC(), paint.GetC());
361  }
362 
363  // Push the style onto the style stack.
364  ImpellerParagraphBuilderPushStyle(builder.GetC(), style.GetC());
365  std::string text = "0F0F0F0";
366 
367  // Add the paragraph text data.
368  ImpellerParagraphBuilderAddText(builder.GetC(),
369  reinterpret_cast<const uint8_t*>(text.data()),
370  text.size());
371 
372  // Layout and build the paragraph.
373  auto paragraph = Adopt<Paragraph>(
374  ImpellerParagraphBuilderBuildParagraphNew(builder.GetC(), 1200.0f));
375  ASSERT_TRUE(paragraph);
376 
377  // Create a display list with just the paragraph drawn into it.
378  auto dl_builder =
379  Adopt<DisplayListBuilder>(ImpellerDisplayListBuilderNew(nullptr));
380  ImpellerPoint point = {20, 20};
381  ImpellerDisplayListBuilderDrawParagraph(dl_builder.GetC(), paragraph.GetC(),
382  &point);
383  auto dl = Adopt<DisplayList>(
385 
386  ASSERT_TRUE(
387  OpenPlaygroundHere([&](const auto& context, const auto& surface) -> bool {
388  ImpellerSurfaceDrawDisplayList(surface.GetC(), dl.GetC());
389  return true;
390  }));
391 } // namespace impeller::interop::testing
392 
393 static void DrawTextFrame(const hpp::TypographyContext& tc,
394  hpp::DisplayListBuilder& builder,
395  hpp::ParagraphStyle& p_style,
396  const hpp::Paint& bg,
397  ImpellerColor color,
398  ImpellerTextAlignment align,
399  float x_offset) {
400  const char text[] =
401  "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
402 
403  hpp::Paint fg;
404 
405  // Draw a box.
406  fg.SetColor(color);
407  fg.SetDrawStyle(kImpellerDrawStyleStroke);
408  ImpellerRect box_rect = {10 + x_offset, 10, 200, 200};
409  builder.DrawRect(box_rect, fg);
410 
411  // Draw text.
412  fg.SetDrawStyle(kImpellerDrawStyleFill);
413  p_style.SetForeground(fg);
414  p_style.SetBackground(bg);
415  p_style.SetTextAlignment(align);
416 
417  hpp::ParagraphBuilder p_builder(tc);
418  p_builder.PushStyle(p_style);
419  p_builder.AddText(reinterpret_cast<const uint8_t*>(text), sizeof(text));
420 
421  auto left_p = p_builder.Build(box_rect.width - 20.0);
422  ImpellerPoint pt = {20.0f + x_offset, 20.0f};
423  float w = left_p.GetMaxWidth();
424  float h = left_p.GetHeight();
425  builder.DrawParagraph(left_p, pt);
426  fg.SetDrawStyle(kImpellerDrawStyleStroke);
427 
428  // Draw an inner box around the paragraph layout.
429  ImpellerRect inner_box_rect = {pt.x, pt.y, w, h};
430  builder.DrawRect(inner_box_rect, fg);
431 }
432 
433 TEST_P(InteropPlaygroundTest, CanRenderTextAlignments) {
434  hpp::TypographyContext tc;
435 
436  hpp::DisplayListBuilder builder;
437  hpp::Paint bg;
438  hpp::ParagraphStyle p_style;
439  p_style.SetFontFamily("Roboto");
440  p_style.SetFontSize(24.0);
441  p_style.SetFontWeight(kImpellerFontWeight400);
442 
443  // Clear the background to a white color.
444  ImpellerColor clear_color = {1.0, 1.0, 1.0, 1.0};
445  bg.SetColor(clear_color);
446  builder.DrawPaint(bg);
447 
448  // Draw red, left-aligned text.
449  ImpellerColor red = {1.0, 0.0, 0.0, 1.0};
450  DrawTextFrame(tc, builder, p_style, bg, red, kImpellerTextAlignmentLeft, 0.0);
451 
452  // Draw green, centered text.
453  ImpellerColor green = {0.0, 1.0, 0.0, 1.0};
454  DrawTextFrame(tc, builder, p_style, bg, green, kImpellerTextAlignmentCenter,
455  220.0);
456 
457  // Draw blue, right-aligned text.
458  ImpellerColor blue = {0.0, 0.0, 1.0, 1.0};
459  DrawTextFrame(tc, builder, p_style, bg, blue, kImpellerTextAlignmentRight,
460  440.0);
461 
462  auto dl = builder.Build();
463 
464  ASSERT_TRUE(
465  OpenPlaygroundHere([&](const auto& context, const auto& surface) -> bool {
466  hpp::Surface window(surface.GetC());
467  window.Draw(dl);
468  return true;
469  }));
470 }
471 
472 } // namespace impeller::interop::testing
Describes an allocation on the heap.
Definition: allocation.h:22
uint8_t * GetBuffer() const
Gets the pointer to the start of the allocation.
Definition: allocation.cc:20
bool Truncate(Bytes length, bool npot=true)
Resize the underlying allocation to at least given number of bytes.
Definition: allocation.cc:32
static ContextGLES & Cast(Context &base)
Definition: backend_cast.h:13
@ kImpellerTextureSamplingLinear
Definition: impeller.h:383
@ kImpellerFontWeight400
Definition: impeller.h:410
@ kImpellerDrawStyleStroke
Definition: impeller.h:361
@ kImpellerDrawStyleFill
Definition: impeller.h:360
ImpellerTextAlignment
Definition: impeller.h:423
@ kImpellerTextAlignmentLeft
Definition: impeller.h:424
@ kImpellerTextAlignmentCenter
Definition: impeller.h:426
@ kImpellerTextAlignmentRight
Definition: impeller.h:425
@ kImpellerClipOperationDifference
Definition: impeller.h:323
@ kImpellerPixelFormatRGBA8888
Definition: impeller.h:378
TEST_P(InteropPlaygroundTest, CanCreateContext)
static void DrawTextFrame(const hpp::TypographyContext &tc, hpp::DisplayListBuilder &builder, hpp::ParagraphStyle &p_style, const hpp::Paint &bg, ImpellerColor color, ImpellerTextAlignment align, float x_offset)
INSTANTIATE_OPENGLES_PLAYGROUND_SUITE(InteropPlaygroundTest)
IMPELLER_EXTERN_C uint64_t ImpellerTextureGetOpenGLHandle(ImpellerTexture texture)
Definition: impeller.cc:566
IMPELLER_EXTERN_C ImpellerSurface ImpellerSurfaceCreateWrappedFBONew(ImpellerContext context, uint64_t fbo, ImpellerPixelFormat format, const ImpellerISize *size)
Definition: impeller.cc:607
IMPELLER_EXTERN_C ImpellerDisplayList ImpellerDisplayListBuilderCreateDisplayListNew(ImpellerDisplayListBuilder builder)
Definition: impeller.cc:589
IMPELLER_EXTERN_C ImpellerParagraphBuilder ImpellerParagraphBuilderNew(ImpellerTypographyContext context)
Definition: impeller.cc:1012
IMPELLER_EXTERN_C ImpellerDisplayListBuilder ImpellerDisplayListBuilderNew(const ImpellerRect *cull_rect)
Definition: impeller.cc:108
IMPELLER_EXTERN_C ImpellerPaint ImpellerPaintNew()
Definition: impeller.cc:340
IMPELLER_EXTERN_C ImpellerParagraph ImpellerParagraphBuilderBuildParagraphNew(ImpellerParagraphBuilder paragraph_builder, float width)
Definition: impeller.cc:1062
IMPELLER_EXTERN_C void ImpellerParagraphBuilderPushStyle(ImpellerParagraphBuilder paragraph_builder, ImpellerParagraphStyle style)
Definition: impeller.cc:1036
IMPELLER_EXTERN_C ImpellerTypographyContext ImpellerTypographyContextNew()
Definition: impeller.cc:1119
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderClipRect(ImpellerDisplayListBuilder builder, const ImpellerRect *rect, ImpellerClipOperation op)
Definition: impeller.cc:307
constexpr Matrix ToImpellerType(const ImpellerMatrix &m)
Definition: formats.h:201
IMPELLER_EXTERN_C ImpellerTexture ImpellerTextureCreateWithOpenGLTextureHandleNew(ImpellerContext context, const ImpellerTextureDescriptor *descriptor, uint64_t external_gl_handle)
Definition: impeller.cc:517
IMPELLER_EXTERN_C ImpellerTexture ImpellerTextureCreateWithContentsNew(ImpellerContext context, const ImpellerTextureDescriptor *descriptor, const ImpellerMapping *contents, void *contents_on_release_user_data)
Definition: impeller.cc:472
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderTransform(ImpellerDisplayListBuilder builder, const ImpellerMatrix *transform)
Definition: impeller.cc:171
IMPELLER_EXTERN_C bool ImpellerTypographyContextRegisterFont(ImpellerTypographyContext context, const ImpellerMapping *contents, void *contents_on_release_user_data, const char *family_name_alias)
Definition: impeller.cc:1139
IMPELLER_EXTERN_C void ImpellerParagraphStyleSetFontSize(ImpellerParagraphStyle paragraph_style, float size)
Definition: impeller.cc:967
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderDrawParagraph(ImpellerDisplayListBuilder builder, ImpellerParagraph paragraph, const ImpellerPoint *point)
Definition: impeller.cc:1005
IMPELLER_EXTERN_C void ImpellerParagraphStyleSetFontFamily(ImpellerParagraphStyle paragraph_style, const char *family_name)
Definition: impeller.cc:961
IMPELLER_EXTERN_C bool ImpellerSurfaceDrawDisplayList(ImpellerSurface surface, ImpellerDisplayList display_list)
Definition: impeller.cc:629
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderTranslate(ImpellerDisplayListBuilder builder, float x_translation, float y_translation)
Definition: impeller.cc:158
IMPELLER_EXTERN_C void ImpellerParagraphStyleSetForeground(ImpellerParagraphStyle paragraph_style, ImpellerPaint paint)
Definition: impeller.cc:930
IMPELLER_EXTERN_C ImpellerParagraphStyle ImpellerParagraphStyleNew()
Definition: impeller.cc:915
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderDrawTexture(ImpellerDisplayListBuilder builder, ImpellerTexture texture, const ImpellerPoint *point, ImpellerTextureSampling sampling, ImpellerPaint paint)
Definition: impeller.cc:635
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderDrawRect(ImpellerDisplayListBuilder builder, const ImpellerRect *rect, ImpellerPaint paint)
Definition: impeller.cc:423
IMPELLER_EXTERN_C void ImpellerPaintSetColor(ImpellerPaint paint, const ImpellerColor *color)
Definition: impeller.cc:355
IMPELLER_EXTERN_C void ImpellerParagraphBuilderAddText(ImpellerParagraphBuilder paragraph_builder, const uint8_t *data, uint32_t length)
Definition: impeller.cc:1049
int64_t width
Definition: impeller.h:458
uint64_t length
Definition: impeller.h:561
const uint8_t *IMPELLER_NONNULL data
Definition: impeller.h:560
float width
Definition: impeller.h:443
ImpellerPoint top_left
Definition: impeller.h:539
ImpellerPoint bottom_right
Definition: impeller.h:542
ImpellerPixelFormat pixel_format
Definition: impeller.h:554
ImpellerISize size
Definition: impeller.h:555
constexpr std::array< uint8_t, 4 > ToR8G8B8A8() const
Convert to R8G8B8A8 representation.
Definition: color.h:245
static constexpr Color Fuchsia()
Definition: color.h:465
constexpr bool IsIdentity() const
Definition: matrix.h:401