Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
io.flutter.embedding.engine.renderer.SurfaceTextureSurfaceProducerTest Class Reference

Public Member Functions

void createsSurfaceTextureOfGivenSizeAndResizesWhenRequested ()
 

Detailed Description

Definition at line 22 of file SurfaceTextureSurfaceProducerTest.java.

Member Function Documentation

◆ createsSurfaceTextureOfGivenSizeAndResizesWhenRequested()

void io.flutter.embedding.engine.renderer.SurfaceTextureSurfaceProducerTest.createsSurfaceTextureOfGivenSizeAndResizesWhenRequested ( )
inline

Definition at line 26 of file SurfaceTextureSurfaceProducerTest.java.

26 {
27 final FlutterRenderer flutterRenderer = new FlutterRenderer(fakeJNI);
28
29 // Create a surface and set the initial size.
30 final Handler handler = new Handler(Looper.getMainLooper());
31 final SurfaceTextureSurfaceProducer producer =
32 new SurfaceTextureSurfaceProducer(
33 0, handler, fakeJNI, flutterRenderer.registerSurfaceTexture(new SurfaceTexture(0)));
34 final Surface surface = producer.getSurface();
35 AtomicInteger frames = new AtomicInteger();
36 producer
37 .getSurfaceTexture()
38 .setOnFrameAvailableListener(
39 (texture) -> {
40 if (texture.isReleased()) {
41 return;
42 }
43 frames.getAndIncrement();
44 });
45 producer.setSize(100, 200);
46
47 // Draw.
48 Canvas canvas = surface.lockHardwareCanvas();
49 canvas.drawARGB(255, 255, 0, 0);
50 surface.unlockCanvasAndPost(canvas);
51 shadowOf(Looper.getMainLooper()).idle();
52 assertEquals(frames.get(), 1);
53
54 // Resize and redraw.
55 producer.setSize(400, 800);
56 canvas = surface.lockHardwareCanvas();
57 canvas.drawARGB(255, 255, 0, 0);
58 surface.unlockCanvasAndPost(canvas);
59 shadowOf(Looper.getMainLooper()).idle();
60 assertEquals(frames.get(), 2);
61
62 // Done.
64 producer.release();
65 }
VkSurfaceKHR surface
Definition: main.cc:49
FlTexture * texture

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