Merge branch 'stbiw-fix-jpeg-flipping' of https://github.com/DanielGibson/stb into working
This commit is contained in:
commit
b2bde485a2
@ -1470,14 +1470,16 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in
|
||||
float YDU[64], UDU[64], VDU[64];
|
||||
for(row = y, pos = 0; row < y+8; ++row) {
|
||||
for(col = x; col < x+8; ++col, ++pos) {
|
||||
int p = (stbi__flip_vertically_on_write ? height-1-row : row)*width*comp + col*comp;
|
||||
float r, g, b;
|
||||
if(row >= height) {
|
||||
p -= width*comp*(row+1 - height);
|
||||
}
|
||||
if(col >= width) {
|
||||
p -= comp*(col+1 - width);
|
||||
int p;
|
||||
if(row < height) {
|
||||
p = (stbi__flip_vertically_on_write ? (height-1-row) : row)*width*comp;
|
||||
} else {
|
||||
// row >= height => use last input row (=> first if flipping)
|
||||
p = stbi__flip_vertically_on_write ? 0 : ((height-1)*width*comp);
|
||||
}
|
||||
// if col >= width => use pixel from last input column
|
||||
p += ((col < width) ? col : (width-1))*comp;
|
||||
|
||||
r = imageData[p+0];
|
||||
g = imageData[p+ofsG];
|
||||
|
Loading…
Reference in New Issue
Block a user