142 public boolean supportBlockFlags() {
143 return true;
144 }
145
146 @Override
147 public void clearAlphas(final int pix_y) {
148 final int w = width;
149 final int off = (pix_y - y) * w;
150
151 // Clear complete row:
152 Arrays.fill(this.alphas, off, off + w, (byte)0);
153 }
154
155 @Override
156 public void setAndClearRelativeAlphas(final int[] alphaDeltas, final int pix_y,
157 final int pix_from, final int pix_to)
158 {
159 // System.out.println("setting row "+(pix_y - y)+
160 // " out of "+width+" x "+height);
161
162 final byte out[] = this.alphas;
163 final int w = width;
164 final int off = (pix_y - y) * w;
165
166 final Unsafe _unsafe = OffHeapArray.UNSAFE;
167 final long addr_alpha = ALPHA_MAP_USED.address;
168
169 final int from = pix_from - x;
170
171 // skip useless pixels above boundary
172 final int to = pix_to - x;
173 final int ato = Math.min(to, width);
174
175 // fast fill ?
176 final boolean fast = useFastFill && ((ato - from) < fastFillThreshold);
177
178 if (fast) {
179 // Zero-fill complete row:
180 Arrays.fill(out, off, off + w, (byte) 0);
181
182 int i = from;
206 i++;
207 }
208
209 while (i < w) {
210 out[off + i] = 0;
211 i++;
212 }
213 }
214
215 // Clear alpha row for reuse:
216 IntArrayCache.fill(alphaDeltas, from, to + 1, 0);
217 }
218
219 @Override
220 public void setAndClearRelativeAlphas(final int[] blkFlags, final int[] alphaDeltas, final int pix_y,
221 final int pix_from, final int pix_to)
222 {
223 // System.out.println("setting row "+(pix_y - y)+
224 // " out of "+width+" x "+height);
225
226 final byte out[] = this.alphas;
227 final int w = width;
228 final int off = (pix_y - y) * w;
229
230 final Unsafe _unsafe = OffHeapArray.UNSAFE;
231 final long addr_alpha = ALPHA_MAP_USED.address;
232
233 final int from = pix_from - x;
234
235 // skip useless pixels above boundary
236 final int to = pix_to - x;
237 final int ato = Math.min(to, width);
238
239 // fast fill ?
240 final boolean fast = useFastFill && ((ato - from) < fastFillThreshold);
241
242 final int _BLK_SIZE_LG = MarlinConst.BLOCK_SIZE_LG;
243
244 // traverse flagged blocks:
245 final int blkW = (from >> _BLK_SIZE_LG);
246 final int blkE = (ato >> _BLK_SIZE_LG) + 1;
|
142 public boolean supportBlockFlags() {
143 return true;
144 }
145
146 @Override
147 public void clearAlphas(final int pix_y) {
148 final int w = width;
149 final int off = (pix_y - y) * w;
150
151 // Clear complete row:
152 Arrays.fill(this.alphas, off, off + w, (byte)0);
153 }
154
155 @Override
156 public void setAndClearRelativeAlphas(final int[] alphaDeltas, final int pix_y,
157 final int pix_from, final int pix_to)
158 {
159 // System.out.println("setting row "+(pix_y - y)+
160 // " out of "+width+" x "+height);
161
162 final byte[] out = this.alphas;
163 final int w = width;
164 final int off = (pix_y - y) * w;
165
166 final Unsafe _unsafe = OffHeapArray.UNSAFE;
167 final long addr_alpha = ALPHA_MAP_USED.address;
168
169 final int from = pix_from - x;
170
171 // skip useless pixels above boundary
172 final int to = pix_to - x;
173 final int ato = Math.min(to, width);
174
175 // fast fill ?
176 final boolean fast = useFastFill && ((ato - from) < fastFillThreshold);
177
178 if (fast) {
179 // Zero-fill complete row:
180 Arrays.fill(out, off, off + w, (byte) 0);
181
182 int i = from;
206 i++;
207 }
208
209 while (i < w) {
210 out[off + i] = 0;
211 i++;
212 }
213 }
214
215 // Clear alpha row for reuse:
216 IntArrayCache.fill(alphaDeltas, from, to + 1, 0);
217 }
218
219 @Override
220 public void setAndClearRelativeAlphas(final int[] blkFlags, final int[] alphaDeltas, final int pix_y,
221 final int pix_from, final int pix_to)
222 {
223 // System.out.println("setting row "+(pix_y - y)+
224 // " out of "+width+" x "+height);
225
226 final byte[] out = this.alphas;
227 final int w = width;
228 final int off = (pix_y - y) * w;
229
230 final Unsafe _unsafe = OffHeapArray.UNSAFE;
231 final long addr_alpha = ALPHA_MAP_USED.address;
232
233 final int from = pix_from - x;
234
235 // skip useless pixels above boundary
236 final int to = pix_to - x;
237 final int ato = Math.min(to, width);
238
239 // fast fill ?
240 final boolean fast = useFastFill && ((ato - from) < fastFillThreshold);
241
242 final int _BLK_SIZE_LG = MarlinConst.BLOCK_SIZE_LG;
243
244 // traverse flagged blocks:
245 final int blkW = (from >> _BLK_SIZE_LG);
246 final int blkE = (ato >> _BLK_SIZE_LG) + 1;
|