X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Futil%2Fcommon.c;h=f0f6b54886c807615de62abb7b0a27b3adb027a2;hb=501a421b337b6e08b58904b1c008bd05dbbf954b;hp=31c2d2eb2d67cafc67d39777bde97a41f9da5672;hpb=883046095800fc78649d943d2b0da22f8732d31e;p=chaz%2Ftint2 diff --git a/src/util/common.c b/src/util/common.c index 31c2d2e..f0f6b54 100644 --- a/src/util/common.c +++ b/src/util/common.c @@ -30,20 +30,19 @@ -void adjust_hsb(unsigned int *data, int w, int h, float hu, float satur, float bright) +void adjust_hsb(DATA32 *data, int w, int h, float hu, float satur, float bright) { - unsigned int *pt = data; - int x, y; + unsigned int x, y; unsigned int a, r, g, b, argb; + unsigned long id; int cmax, cmin; float h2, f, p, q, t; float hue, saturation, brightness; float redc, greenc, bluec; - for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - argb = pt[y * h + x]; + for(id = y * w, x = 0; x < w; x++, id++) { + argb = data[id]; a = (argb >> 24) & 0xff; r = (argb >> 16) & 0xff; g = (argb >> 8) & 0xff; @@ -134,7 +133,7 @@ void adjust_hsb(unsigned int *data, int w, int h, float hu, float satur, float b argb = (argb << 8) + r; argb = (argb << 8) + g; argb = (argb << 8) + b; - pt[y * h + x] = argb; + data[id] = argb; } } }