@@ -246,13 +246,26 @@ public static byte[] createHornyJailImage(User user) throws IOException {
246
246
* @throws IOException if the link is not a valid Image.
247
247
*/
248
248
public static BufferedImage convertToCircleShape (URL url ) throws IOException {
249
+ long start = System .currentTimeMillis ();
250
+ long actionPerformance = System .currentTimeMillis ();
251
+
252
+ Main .getInstance ().getAnalyticsLogger ().debug ("Started User Image creation." );
249
253
250
254
BufferedImage mainImage = ImageIO .read (url );
251
255
256
+ Main .getInstance ().getAnalyticsLogger ().debug ("Loading Image from URL. ({}ms)" , System .currentTimeMillis () - actionPerformance );
257
+ actionPerformance = System .currentTimeMillis ();
258
+
252
259
BufferedImage output = new BufferedImage (mainImage .getWidth (), mainImage .getHeight (), BufferedImage .TYPE_INT_ARGB );
253
260
261
+ Main .getInstance ().getAnalyticsLogger ().debug ("Creating Output BufferedImage. ({}ms)" , System .currentTimeMillis () - actionPerformance );
262
+ actionPerformance = System .currentTimeMillis ();
263
+
254
264
Graphics2D g2 = output .createGraphics ();
255
265
266
+ Main .getInstance ().getAnalyticsLogger ().debug ("Created Graphics2D. ({}ms)" , System .currentTimeMillis () - actionPerformance );
267
+ actionPerformance = System .currentTimeMillis ();
268
+
256
269
// This is what we want, but it only does hard-clipping, i.e. aliasing
257
270
// g2.setClip(new RoundRectangle2D ...)
258
271
@@ -261,15 +274,26 @@ public static BufferedImage convertToCircleShape(URL url) throws IOException {
261
274
g2 .setComposite (AlphaComposite .Src );
262
275
g2 .setRenderingHint (RenderingHints .KEY_ANTIALIASING , RenderingHints .VALUE_ANTIALIAS_ON );
263
276
g2 .setColor (Color .WHITE );
277
+ Main .getInstance ().getAnalyticsLogger ().debug ("Set Graphic Presets. ({}ms)" , System .currentTimeMillis () - actionPerformance );
278
+ actionPerformance = System .currentTimeMillis ();
264
279
g2 .fill (new Ellipse2D .Float (0 , 0 , mainImage .getHeight (), mainImage .getHeight ()));
280
+ Main .getInstance ().getAnalyticsLogger ().debug ("Filled Graphic Base with Image. ({}ms)" , System .currentTimeMillis () - actionPerformance );
281
+ actionPerformance = System .currentTimeMillis ();
265
282
266
283
// ... then compositing the image on top,
267
284
// using the white shape from above as alpha source
268
285
g2 .setComposite (AlphaComposite .SrcAtop );
269
286
g2 .drawImage (mainImage , 0 , 0 , null );
270
287
288
+ Main .getInstance ().getAnalyticsLogger ().debug ("Drawing Image finished. ({}ms)" , System .currentTimeMillis () - actionPerformance );
289
+ actionPerformance = System .currentTimeMillis ();
290
+
271
291
g2 .dispose ();
272
292
293
+ Main .getInstance ().getAnalyticsLogger ().debug ("Disposing Graphics2D finished. ({}ms)" , System .currentTimeMillis () - actionPerformance );
294
+ actionPerformance = System .currentTimeMillis ();
295
+
296
+ Main .getInstance ().getAnalyticsLogger ().debug ("Finished creation. ({}ms)" , System .currentTimeMillis () - start );
273
297
return resize (output , 250 , 250 );
274
298
}
275
299
0 commit comments