Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SurfaceProducerPlatformViewRenderTarget.java
Go to the documentation of this file.
1package io.flutter.plugin.platform;
2
3import static io.flutter.Build.API_LEVELS;
4
5import android.annotation.TargetApi;
6import android.view.Surface;
7import io.flutter.view.TextureRegistry.SurfaceProducer;
8
9@TargetApi(API_LEVELS.API_29)
11 private static final String TAG = "SurfaceProducerRenderTarget";
12 private SurfaceProducer producer;
13
14 public SurfaceProducerPlatformViewRenderTarget(SurfaceProducer producer) {
15 this.producer = producer;
16 }
17
18 // Called when the render target should be resized.
19 public void resize(int width, int height) {
20 this.producer.setSize(width, height);
21 }
22
23 // Returns the currently specified width.
24 public int getWidth() {
25 return this.producer.getWidth();
26 }
27
28 // Returns the currently specified height.
29 public int getHeight() {
30 return this.producer.getHeight();
31 }
32
33 // The id of this render target.
34 public long getId() {
35 return this.producer.id();
36 }
37
38 // Releases backing resources.
39 public void release() {
40 this.producer.release();
41 this.producer = null;
42 }
43
44 // Returns true in the case that backing resource have been released.
45 public boolean isReleased() {
46 return this.producer == null;
47 }
48
49 // Returns the Surface to be rendered on to.
51 return this.producer.getSurface();
52 }
53
54 public void scheduleFrame() {
55 this.producer.scheduleFrame();
56 }
57}
#define TAG()
int32_t height
int32_t width