173 /** 174 * Disposes this dasher: 175 * clean up before reusing this instance 176 */ 177 void dispose() { 178 if (DO_CLEAN_DIRTY) { 179 // Force zero-fill dirty arrays: 180 Arrays.fill(curCurvepts, 0f); 181 } 182 // Return arrays: 183 if (recycleDashes) { 184 dash = dashes_ref.putArray(dash); 185 } 186 firstSegmentsBuffer = firstSegmentsBuffer_ref.putArray(firstSegmentsBuffer); 187 } 188 189 public float[] copyDashArray(final float[] dashes) { 190 final int len = dashes.length; 191 final float[] newDashes; 192 if (len <= MarlinConst.INITIAL_ARRAY) { 193 newDashes = rdrCtx.dasher.dashes_ref.initial; 194 } else { 195 if (DO_STATS) { 196 rdrCtx.stats.stat_array_dasher_dasher.add(len); 197 } 198 newDashes = rdrCtx.dasher.dashes_ref.getArray(len); 199 } 200 System.arraycopy(dashes, 0, newDashes, 0, len); 201 return newDashes; 202 } 203 204 @Override 205 public void moveTo(float x0, float y0) { 206 if (firstSegidx > 0) { 207 out.moveTo(sx, sy); 208 emitFirstSegments(); 209 } 210 needsMoveTo = true; 211 this.idx = startIdx; 212 this.dashOn = this.startDashOn; 213 this.phase = this.startPhase; 214 this.sx = this.x0 = x0; 215 this.sy = this.y0 = y0; 216 this.starting = true; 217 } 218 | 173 /** 174 * Disposes this dasher: 175 * clean up before reusing this instance 176 */ 177 void dispose() { 178 if (DO_CLEAN_DIRTY) { 179 // Force zero-fill dirty arrays: 180 Arrays.fill(curCurvepts, 0f); 181 } 182 // Return arrays: 183 if (recycleDashes) { 184 dash = dashes_ref.putArray(dash); 185 } 186 firstSegmentsBuffer = firstSegmentsBuffer_ref.putArray(firstSegmentsBuffer); 187 } 188 189 public float[] copyDashArray(final float[] dashes) { 190 final int len = dashes.length; 191 final float[] newDashes; 192 if (len <= MarlinConst.INITIAL_ARRAY) { 193 newDashes = dashes_ref.initial; 194 } else { 195 if (DO_STATS) { 196 rdrCtx.stats.stat_array_dasher_dasher.add(len); 197 } 198 newDashes = dashes_ref.getArray(len); 199 } 200 System.arraycopy(dashes, 0, newDashes, 0, len); 201 return newDashes; 202 } 203 204 @Override 205 public void moveTo(float x0, float y0) { 206 if (firstSegidx > 0) { 207 out.moveTo(sx, sy); 208 emitFirstSegments(); 209 } 210 needsMoveTo = true; 211 this.idx = startIdx; 212 this.dashOn = this.startDashOn; 213 this.phase = this.startPhase; 214 this.sx = this.x0 = x0; 215 this.sy = this.y0 = y0; 216 this.starting = true; 217 } 218 |