Class PingPongBufferPool
java.lang.Object
cloud.opencode.base.image.buffer.PingPongBufferPool
Two-slot Raster buffer pool for pipeline-style operator chains.
管线式算子链使用的双槽 Raster 缓冲池。
Typical usage — alternate acquireRasterA() / acquireRasterB()
between stages so each operator reads from one slot and writes to the
other, reusing the same pair of Raster instances for the whole
chain.
典型用法:相邻阶段交替用 acquireRasterA() / acquireRasterB(),
每个算子从一个槽读、写入另一个槽,整条链共用一对 Raster。
Thread safety | 线程安全:否 — 实例按线程/请求作用域使用。
- Since:
- JDK 25, opencode-base-image V1.0.4
- Author:
- Leon Soo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionacquireRasterA(int w, int h, PixelFormat format) Acquire raster slot A, reallocating if required.acquireRasterB(int w, int h, PixelFormat format) Acquire raster slot B, reallocating if required.voidrelease()Release both slots, allowing GC to reclaim backing memory.
-
Constructor Details
-
PingPongBufferPool
public PingPongBufferPool()
-
-
Method Details
-
acquireRasterA
Acquire raster slot A, reallocating if required. 获取 raster 槽 A,按需重新分配。- Parameters:
w- required width | 所需宽度h- required height | 所需高度format- pixel format | 像素格式- Returns:
- raster slot A matching the spec | 匹配规格的 raster 槽 A
- Since:
- opencode-base-image V1.0.4
-
acquireRasterB
Acquire raster slot B, reallocating if required. 获取 raster 槽 B,按需重新分配。- Parameters:
w- required width | 所需宽度h- required height | 所需高度format- pixel format | 像素格式- Returns:
- raster slot B matching the spec | 匹配规格的 raster 槽 B
- Since:
- opencode-base-image V1.0.4
-
release
public void release()Release both slots, allowing GC to reclaim backing memory. 释放两个槽,使底层内存可被 GC 回收。
-