blob: c80af22379229500e693914eaf559093d557b2f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
--- src/plugins/imagemagick.cpp 2013-03-18 14:21:49.848848166 +0900
+++ src/plugins/imagemagick.cpp.new 2013-03-18 15:37:57.502107423 +0900
@@ -124,10 +124,10 @@
for(int x = 0; x < width; ++x)
{
- dst_pixels[4*x + 0] = static_cast<uint8_t>(src_pixels[x].red >> shift);
- dst_pixels[4*x + 1] = static_cast<uint8_t>(src_pixels[x].green >> shift);
- dst_pixels[4*x + 2] = static_cast<uint8_t>(src_pixels[x].blue >> shift);
- dst_pixels[4*x + 3] = static_cast<uint8_t>(255 - (src_pixels[x].opacity >> shift));
+ dst_pixels[4*x + 0] = static_cast<uint8_t>(src_pixels[x].red / QuantumRange * QuantumRange);
+ dst_pixels[4*x + 1] = static_cast<uint8_t>(src_pixels[x].green / QuantumRange * QuantumRange);
+ dst_pixels[4*x + 2] = static_cast<uint8_t>(src_pixels[x].blue / QuantumRange * QuantumRange);
+ dst_pixels[4*x + 3] = static_cast<uint8_t>(255 - (src_pixels[x].opacity / QuantumRange * QuantumRange));
}
}
}
@@ -142,9 +142,9 @@
for(int x = 0; x < width; ++x)
{
- dst_pixels[3*x + 0] = static_cast<uint8_t>(src_pixels[x].red >> shift);
- dst_pixels[3*x + 1] = static_cast<uint8_t>(src_pixels[x].green >> shift);
- dst_pixels[3*x + 2] = static_cast<uint8_t>(src_pixels[x].blue >> shift);
+ dst_pixels[3*x + 0] = static_cast<uint8_t>(src_pixels[x].red / QuantumRange * QuantumRange);
+ dst_pixels[3*x + 1] = static_cast<uint8_t>(src_pixels[x].green / QuantumRange * QuantumRange);
+ dst_pixels[3*x + 2] = static_cast<uint8_t>(src_pixels[x].blue / QuantumRange * QuantumRange);
}
}
}
|