From 6af7568675e3fce883a1d08878dfef7f4e412053 Mon Sep 17 00:00:00 2001 From: Mike Wey Date: Mon, 19 Sep 2011 23:01:35 +0200 Subject: Reuse the Color in Pixels.opApply, Creating a new color every time considerably slows down the loop. --- dmagick/ImageView.d | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'dmagick/ImageView.d') diff --git a/dmagick/ImageView.d b/dmagick/ImageView.d index fbce73c..709c81f 100644 --- a/dmagick/ImageView.d +++ b/dmagick/ImageView.d @@ -362,9 +362,12 @@ struct Pixels */ int opApply(int delegate(ref Color) dg) { + Color color = new Color(); + foreach ( ref PixelPacket pixel; pixels ) { - Color color = new Color(pixel); + color.pixelPacket = pixel; + int result = dg(color); pixel = color.pixelPacket; -- cgit v1.2.3