modules/graphics/src/main/java/com/sun/prism/impl/QueuedPixelSource.java
Print this page
*** 111,124 ****
* used (but not active) {@code Pixels} object.
* Or it may be a brand new object.
*
* @param w the width of the desired Pixels object
* @param h the height of the desired Pixels object
! * @param scale the scale of the desired Pixels object
* @return an unused {@code Pixels} object
*/
! public synchronized Pixels getUnusedPixels(int w, int h, float scale) {
int i = 0;
IntBuffer reuseBuffer = null;
while (i < saved.size()) {
WeakReference<Pixels> ref = saved.get(i);
Pixels p = ref.get();
--- 111,125 ----
* used (but not active) {@code Pixels} object.
* Or it may be a brand new object.
*
* @param w the width of the desired Pixels object
* @param h the height of the desired Pixels object
! * @param scalex the horizontal scale of the desired Pixels object
! * @param scaley the vertical scale of the desired Pixels object
* @return an unused {@code Pixels} object
*/
! public synchronized Pixels getUnusedPixels(int w, int h, float scalex, float scaley) {
int i = 0;
IntBuffer reuseBuffer = null;
while (i < saved.size()) {
WeakReference<Pixels> ref = saved.get(i);
Pixels p = ref.get();
*** 130,140 ****
i++;
continue;
}
if (p.getWidthUnsafe() == w &&
p.getHeightUnsafe() == h &&
! p.getScaleUnsafe() == scale)
{
return p;
}
// Whether or not we reuse its buffer, this Pixels object is going away.
saved.remove(i);
--- 131,142 ----
i++;
continue;
}
if (p.getWidthUnsafe() == w &&
p.getHeightUnsafe() == h &&
! p.getScaleXUnsafe() == scalex &&
! p.getScaleYUnsafe() == scaley)
{
return p;
}
// Whether or not we reuse its buffer, this Pixels object is going away.
saved.remove(i);
*** 153,163 ****
reuseBuffer = BufferUtil.newIntBuffer(bufsize);
} else {
reuseBuffer = IntBuffer.allocate(bufsize);
}
}
! Pixels p = Application.GetApplication().createPixels(w, h, reuseBuffer, scale);
saved.add(new WeakReference<>(p));
return p;
}
/**
--- 155,165 ----
reuseBuffer = BufferUtil.newIntBuffer(bufsize);
} else {
reuseBuffer = IntBuffer.allocate(bufsize);
}
}
! Pixels p = Application.GetApplication().createPixels(w, h, reuseBuffer, scalex, scaley);
saved.add(new WeakReference<>(p));
return p;
}
/**