Interface IGraphicsSurface
interface IGraphicsSurface
Extends com.amazon.apmf.IStandard
A rectangular region that can be rendered to
Methods
getWidth()
i32 getWidth()
Returns
i32
Width of this surface in pixels.
getHeight()
i32 getHeight()
Returns
i32
Height of this surface in pixels.
isCurrentSurface()
bool isCurrentSurface()
Returns
bool
Whether this surface is current.
Throws
DeviceError— if IGraphicsSurface is not in valid state
prepareToDraw()
Clients are expected to call this before rendering to the surface for any given frame and perform the needed transformation. For example, if IFrameHint.getRotation() is other than ‘NONE’, client should perform necessary transformation while rendering accounting the needed rotation. The rectangles passed as part of drawRects should be specified relative to the bottom-left of the surface and the x and y components of each rectangle specify the bottom-left position of that rectangle. Note that rectangles passed should be those surface contents that changed since the last frame. The implementation will clear buffer contents marked by the rectangles in drawRects.IFrameHint*prepareToDraw(RectI[]drawRects)
Parameters
drawRects
RectI[] — Required
The rectangle area will use to draw
Returns
IFrameHint*
Frame hint information. Client should use it while rendering.
Throws
DeviceError— if IGraphicsSurface is not in valid stateOutOfMemoryError— if device is out of memoryInvalidArgumentError— if any input argument is invalid
endDraw()
void endDraw()
All needed rendering for this surface is complete for the current frame.
The Surface will either use Flush, Finish or Fence based on platform capabilities
to ensure rendering is done before surface is scanned out.
The Surface needs to be current during this call.
Throws
DeviceError— if IGraphicsSurface is not in valid state
getSurfaceControl()
get surface control associated to current rendering surfaceISurfaceControl*getSurfaceControl()
Returns
ISurfaceControl*
ISurfaceControl
Throws
DeviceError— if IGraphicsSurface is not in valid stateOutOfMemoryError— if device is out of memory
presentBuffer()
For OnScreen Surfaces, the current back buffer will be presented to the display. For OffScreen Surfaces, any needed book-keeping for resources like FBO, Texture and reporting performance metrics will be completed.PresentResultpresentBuffer(RectI[]bufferDamage,u64timeInNanoSecs,boolneedToTransform)
Parameters
bufferDamage
RectI[] — Required
The buffer area that was damaged
timeInNanoSecs
u64 — Required
(no use for now, can be set to 0)
needToTransform
bool — Required
if true, rendered content will be transformed as per the IFrameHint
of the current frame. It is highly recommended that clients set this to ‘false’ and perform
the required transformation indicated by IFrameHint (returned by prepareToDraw) during the
draw call for performance reasons. If it is false, compositor will assume that content is
already transformed.
Returns
PresentResult
PresentResult.Submitted when success
Throws
DeviceError— if IGraphicsSurface is not in valid stateNullPointerError— if any input argument is null pointer while a non-null one is expectedInvalidArgumentError— if any input argument is invalid [PresentResult]
addPresentListener()
Add present listener The listener will continue to receive events until ISubscription#unsubscribe() is called or until the event source is destroyed.com.amazon.apmf.ISubscription*addPresentListener(IPresentListener*listener)
Parameters
listener
IPresentListener* — Required
IPresentListener interface
Returns
com.amazon.apmf.ISubscription*
ISubscription related to this listener interface
Throws
DeviceError— if IGraphicsSurface is not in valid stateNullPointerError— if any input argument is null pointer while a non-null one is expectedOutOfMemoryError— if device is out of memoryInvalidArgumentError— if any input argument is invalid [IPresentListener]
getNativeHandle()
com.amazon.apmf.NativePointer getNativeHandle()
Query the native handle of current surface based on platforms
Returns
com.amazon.apmf.NativePointer
Native handle
Throws
DeviceError— if IGraphicsSurface is not in valid state

