Package org.mozilla.geckoview
Class GeckoDisplay.SurfaceInfo.Builder
Object
org.mozilla.geckoview.GeckoDisplay.SurfaceInfo.Builder
- Enclosing class:
- GeckoDisplay.SurfaceInfo
Helper class for constructing a
GeckoDisplay.SurfaceInfo
object.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds theGeckoDisplay.SurfaceInfo
object with the specified properties.newSurfaceProvider
(GeckoDisplay.NewSurfaceProvider newSurfaceProvider) Sets a NewSurfaceProvider from which Gecko can request a new Surface.offset
(int left, int top) Sets the new compositor origin offset.size
(int width, int height) Sets the new surface size.surfaceControl
(SurfaceControl surfaceControl) Sets the SurfaceControl associated with the new Surface's SurfaceView.
-
Constructor Details
-
Builder
Creates a new Builder and sets the new Surface.- Parameters:
surface
- The new Surface.
-
-
Method Details
-
surfaceControl
@UiThread @NonNull public GeckoDisplay.SurfaceInfo.Builder surfaceControl(@Nullable SurfaceControl surfaceControl) Sets the SurfaceControl associated with the new Surface's SurfaceView.This must be called when rendering in to a
SurfaceView
on SDK level 29 or above. On earlier SDK levels, or when rendering in to something other than a SurfaceView, this call can be omitted or the value can be null.- Parameters:
surfaceControl
- The SurfaceControl associated with the new Surface's SurfaceView, or null.- Returns:
- The builder object
-
newSurfaceProvider
@UiThread @NonNull public GeckoDisplay.SurfaceInfo.Builder newSurfaceProvider(@Nullable GeckoDisplay.NewSurfaceProvider newSurfaceProvider) Sets a NewSurfaceProvider from which Gecko can request a new Surface.This allows Gecko to recover from situations where the current Surface is for whatever reason invalid and Gecko is unable to render in to it. Failure to set this field correctly may result in Gecko either crashing or not rendering correctly should it encounter an invalid Surface.
- Parameters:
newSurfaceProvider
- A NewSurfaceProvider from which Gecko can request a new Surface.- Returns:
- The builder object
-
offset
Sets the new compositor origin offset.- Parameters:
left
- The compositor origin offset in the X axis. Can not be negative.top
- The compositor origin offset in the Y axis. Can not be negative.- Returns:
- The builder object
-
size
Sets the new surface size.- Parameters:
width
- New width of the Surface. Can not be negative.height
- New height of the Surface. Can not be negative.- Returns:
- The builder object
-
build
Builds theGeckoDisplay.SurfaceInfo
object with the specified properties.- Returns:
- The SurfaceInfo object
-