-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a PlatformViewRenderTarget abstraction (#43813)
- Introduce PlatformViewRenderTarget interface. - Refactor VirtualDisplayController and PlatformViewWrapper to extract SurfaceTexturePlatformViewRenderTarget into a separate class. In a future CL I will add an ImageReaderPlatformViewRenderTarget which will enable Platform Views on Impeller/Vulkan. Tracking issue: flutter/flutter#130892
- Loading branch information
1 parent
7997970
commit af2df6f
Showing
9 changed files
with
459 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
shell/platform/android/io/flutter/plugin/platform/PlatformViewRenderTarget.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package io.flutter.plugin.platform; | ||
|
||
import android.graphics.Canvas; | ||
import android.view.Surface; | ||
|
||
/** | ||
* A PlatformViewRenderTarget interface allows an Android Platform View to be rendered into an | ||
* offscreen buffer (usually a texture is involved) that the engine can compose into the | ||
* FlutterView. | ||
*/ | ||
public interface PlatformViewRenderTarget { | ||
// Called when the render target should be resized. | ||
public void resize(int width, int height); | ||
|
||
// Returns the currently specified width. | ||
public int getWidth(); | ||
|
||
// Returns the currently specified height. | ||
public int getHeight(); | ||
|
||
// Forwards call to Surface returned by getSurface. | ||
// NOTE: If this returns null the RenderTarget is "full" and has no room for a | ||
// new frame. | ||
Canvas lockHardwareCanvas(); | ||
|
||
// Forwards call to Surface returned by getSurface. | ||
// NOTE: Must be called if lockHardwareCanvas returns a non-null Canvas. | ||
void unlockCanvasAndPost(Canvas canvas); | ||
|
||
// The id of this render target. | ||
public long getId(); | ||
|
||
// Releases backing resources. | ||
public void release(); | ||
|
||
// Returns true in the case that backing resource have been released. | ||
public boolean isReleased(); | ||
|
||
// Returns the Surface to be rendered on to. | ||
public Surface getSurface(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.