mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-05 20:45:29 -04:00
Clean-up of 1-bit subsampling.
This commit is contained in:
parent
a8a48473ff
commit
8be8f286f3
@ -548,18 +548,20 @@ public class PSDImageReader extends ImageReaderBase {
|
|||||||
// Copy line sub sampled into real data
|
// Copy line sub sampled into real data
|
||||||
int x = pSource.x;
|
int x = pSource.x;
|
||||||
for (int i = 0; i < destWidth; i++) {
|
for (int i = 0; i < destWidth; i++) {
|
||||||
// TODO: FIXME!
|
|
||||||
byte result = 0;
|
byte result = 0;
|
||||||
|
|
||||||
for (int j = 0; j < 8; j++) {
|
for (int j = 0; j < 8; j++) {
|
||||||
int pos = x / 8;
|
int pos = x / 8;
|
||||||
|
|
||||||
if (pos >= row.length) {
|
if (pos >= row.length) {
|
||||||
break;
|
break; // Stay inside bounds...
|
||||||
}
|
}
|
||||||
|
|
||||||
int sourceBitOff = x % 8;
|
int sourceBitOff = x % 8;
|
||||||
int mask = 0x80 >> sourceBitOff;
|
int mask = 0x80 >> sourceBitOff;
|
||||||
|
int destBitOff = 7 - j;
|
||||||
|
|
||||||
result |= (((row[pos] & mask) != 0) ? 1 : 0) << 7 - j;
|
result |= (((row[pos] & mask) != 0) ? 1 : 0) << destBitOff;
|
||||||
|
|
||||||
x += pXSub;
|
x += pXSub;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user