mirror of
https://github.com/koreader/koreader
synced 2024-11-10 01:10:34 +00:00
fix: bug in paintRect
When calculating index of byte for rightmost column, it should be (x + w)/2 not (x + w + 1)/2.
This commit is contained in:
parent
a30e92b7a4
commit
936ce2d661
@ -302,7 +302,9 @@ static int paintRect(lua_State *L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(x & 1) {
|
if(x & 1) {
|
||||||
/* this will render the leftmost column */
|
/* This will render the leftmost column
|
||||||
|
* in the case when x is odd. After this,
|
||||||
|
* x will become even. */
|
||||||
dstptr = (uint8_t*)(dst->data +
|
dstptr = (uint8_t*)(dst->data +
|
||||||
y * dst->pitch +
|
y * dst->pitch +
|
||||||
x / 2);
|
x / 2);
|
||||||
@ -322,9 +324,12 @@ static int paintRect(lua_State *L) {
|
|||||||
dstptr += dst->pitch;
|
dstptr += dst->pitch;
|
||||||
}
|
}
|
||||||
if(w & 1) {
|
if(w & 1) {
|
||||||
|
/* This will render the rightmost column
|
||||||
|
* in the case when (w & 1) && !(x & 1) or
|
||||||
|
* !(w & 1) && (x & 1). */
|
||||||
dstptr = (uint8_t*)(dst->data +
|
dstptr = (uint8_t*)(dst->data +
|
||||||
y * dst->pitch +
|
y * dst->pitch +
|
||||||
(x + w + 1) / 2);
|
(x + w) / 2);
|
||||||
for(cy = 0; cy < h; cy++) {
|
for(cy = 0; cy < h; cy++) {
|
||||||
*dstptr &= 0x0F;
|
*dstptr &= 0x0F;
|
||||||
*dstptr |= (c << 4);
|
*dstptr |= (c << 4);
|
||||||
|
Loading…
Reference in New Issue
Block a user