Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
io.flutter.plugin.platform.ImageReaderPlatformViewRenderTargetTest Class Reference

Classes

class  TestImageTextureEntry
 

Public Member Functions

void viewDraw_writesToBuffer ()
 

Detailed Description

Definition at line 30 of file ImageReaderPlatformViewRenderTargetTest.java.

Member Function Documentation

◆ viewDraw_writesToBuffer()

void io.flutter.plugin.platform.ImageReaderPlatformViewRenderTargetTest.viewDraw_writesToBuffer ( )
inline

Definition at line 61 of file ImageReaderPlatformViewRenderTargetTest.java.

61 {
62 final TestImageTextureEntry textureEntry = new TestImageTextureEntry();
63 final ImageReaderPlatformViewRenderTarget renderTarget =
64 new ImageReaderPlatformViewRenderTarget(textureEntry);
65 // Custom view.
66 final View platformView =
67 new View(ctx) {
68 @Override
69 public void draw(Canvas canvas) {
70 super.draw(canvas);
71 canvas.drawColor(Color.RED);
72 }
73 };
74 final int size = 100;
75 platformView.measure(size, size);
76 platformView.layout(0, 0, size, size);
77 renderTarget.resize(size, size);
78
79 // We don't have an image in the texture entry.
80 assertNull(textureEntry.acquireLatestImage());
81
82 // Start rendering a frame.
83 final Surface s = renderTarget.getSurface();
84 assertNotNull(s);
85 final Canvas targetCanvas = s.lockHardwareCanvas();
86 assertNotNull(targetCanvas);
87
88 try {
89 // Fill the render target with transparent pixels. This is needed for platform views that
90 // expect a transparent background.
91 targetCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
92 // Override the canvas that this subtree of views will use to draw.
93 platformView.draw(targetCanvas);
94 } finally {
95 // Finish rendering a frame.
96 s.unlockCanvasAndPost(targetCanvas);
97 }
98
99 // Pump the UI thread task loop. This is needed so that the OnImageAvailable callback
100 // gets invoked (resulting in textureEntry.pushImage being invoked).
101 shadowOf(getMainLooper()).idle();
102
103 // An image was pushed into the texture entry and it has the correct dimensions.
104 Image pushedImage = textureEntry.acquireLatestImage();
105 assertNotNull(pushedImage);
106 assertEquals(pushedImage.getWidth(), size);
107 assertEquals(pushedImage.getHeight(), size);
108 }
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
struct MyStruct s
SK_API sk_sp< SkShader > Color(SkColor)
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
CanvasImage Image
Definition: dart_ui.cc:55

The documentation for this class was generated from the following file: