Package icyllis.arc3d.granite
Class GraniteSurface
java.lang.Object
icyllis.arc3d.core.RefCnt
icyllis.arc3d.sketch.Surface
icyllis.arc3d.granite.GraniteSurface
- All Implemented Interfaces:
RefCounted
The surface that is backed by GPU.
-
Field Summary
Fields inherited from class icyllis.arc3d.sketch.Surface
kDiscard_ContentChangeMode, kPreserve_ContentChangeMode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidOverride this method to invoke de-allocation of the underlying resource.voidflush()@NonNull ImageInfoReturns an ImageInfo describing the Surface.static @Nullable @SharedPtr GraniteSurfacemake(RecordingContext rc, ImageInfo info, boolean budgeted, boolean mipmapped, boolean approxFit, int surfaceOrigin, String label) @Nullable @SharedPtr GraniteImagemakeImageCopy(@Nullable Rect2ic subset, boolean mipmapped) static @Nullable @SharedPtr GraniteSurfacemakeRenderTarget(RecordingContext rc, @NonNull ImageInfo info, boolean mipmapped, int surfaceOrigin, @Nullable String label) While clients hold a ref on a Surface, the backing gpu object does not count against the budget.protected booleanonCopyOnWrite(int changeMode) If the surface is about to change, we call this so that our subclass can optionally fork their backend (copy-on-write) in case it was being shared with the cachedImage.protected RecordingContextprotected CanvasAllocate a canvas that will draw into this surface.protected @Nullable ImageonNewImageSnapshot(@Nullable Rect2ic subset) Allocate an Image that represents the current contents of the surface.Methods inherited from class icyllis.arc3d.sketch.Surface
getCachedCanvas, getCachedImage, getCanvas, getCommandContext, getGenerationID, getHeight, getWidth, hasCachedImage, makeFromBackendTexture, makeImageSnapshot, makeImageSnapshot, makeRenderTarget, notifyWillChange, onDiscard, onRestoreBackingMutability
-
Constructor Details
-
GraniteSurface
-
-
Method Details
-
make
@SharedPtr public static @Nullable @SharedPtr GraniteSurface make(RecordingContext rc, ImageInfo info, boolean budgeted, boolean mipmapped, boolean approxFit, int surfaceOrigin, String label) -
makeRenderTarget
@SharedPtr public static @Nullable @SharedPtr GraniteSurface makeRenderTarget(RecordingContext rc, @NonNull ImageInfo info, boolean mipmapped, int surfaceOrigin, @Nullable String label) While clients hold a ref on a Surface, the backing gpu object does not count against the budget. Once a Surface is freed, the backing gpu object may or may not become a scratch (i.e., reusable) resource but, if it does, it will be counted against the budget. -
deallocate
protected void deallocate()Description copied from class:RefCntOverride this method to invoke de-allocation of the underlying resource.- Overrides:
deallocatein classSurface
-
flush
public void flush() -
getImageInfo
Description copied from class:SurfaceReturns an ImageInfo describing the Surface.- Specified by:
getImageInfoin classSurface
-
onNewCanvas
Description copied from class:SurfaceAllocate a canvas that will draw into this surface. We will cache this canvas, to return the same object to the caller multiple times. We take ownership, and will call unref() on the canvas when we go out of scope.- Specified by:
onNewCanvasin classSurface
-
onNewImageSnapshot
Description copied from class:SurfaceAllocate an Image that represents the current contents of the surface. This needs to be able to outlive the surface itself (if need be), and must faithfully represent the current contents, even if the surface is changed after this called (e.g. it is drawn to via its canvas).If a subset is specified, the impl must make a copy, rather than try to wait on copy-on-write.
- Specified by:
onNewImageSnapshotin classSurface
-
onCopyOnWrite
protected boolean onCopyOnWrite(int changeMode) Description copied from class:SurfaceIf the surface is about to change, we call this so that our subclass can optionally fork their backend (copy-on-write) in case it was being shared with the cachedImage.Returns false if the backing cannot be un-shared.
- Specified by:
onCopyOnWritein classSurface
-
makeImageCopy
@SharedPtr public @Nullable @SharedPtr GraniteImage makeImageCopy(@Nullable Rect2ic subset, boolean mipmapped) -
onGetCommandContext
- Overrides:
onGetCommandContextin classSurface
-
getDevice
-