tabs -> spaces and removed windows newline
This commit is contained in:
@@ -23,7 +23,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "overviewer.h"
|
#include "overviewer.h"
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
@@ -504,7 +503,7 @@ resize_half(PyObject *dest, PyObject *src) {
|
|||||||
/* temp color variables */
|
/* temp color variables */
|
||||||
unsigned int r, g, b, a;
|
unsigned int r, g, b, a;
|
||||||
/* size values for source and destination */
|
/* size values for source and destination */
|
||||||
int src_width, src_height, dest_width, dest_height;
|
int src_width, src_height, dest_width, dest_height;
|
||||||
|
|
||||||
imDest = imaging_python_to_c(dest);
|
imDest = imaging_python_to_c(dest);
|
||||||
imSrc = imaging_python_to_c(src);
|
imSrc = imaging_python_to_c(src);
|
||||||
@@ -525,10 +524,10 @@ resize_half(PyObject *dest, PyObject *src) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
src_width = imSrc->xsize;
|
src_width = imSrc->xsize;
|
||||||
src_height = imSrc->ysize;
|
src_height = imSrc->ysize;
|
||||||
dest_width = imDest->xsize;
|
dest_width = imDest->xsize;
|
||||||
dest_height = imDest->ysize;
|
dest_height = imDest->ysize;
|
||||||
|
|
||||||
/* make sure destination size is 1/2 src size */
|
/* make sure destination size is 1/2 src size */
|
||||||
if (src_width / 2 != dest_width || src_height / 2 != dest_height) {
|
if (src_width / 2 != dest_width || src_height / 2 != dest_height) {
|
||||||
@@ -548,8 +547,8 @@ resize_half(PyObject *dest, PyObject *src) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* set to fully opaque if source has no alpha channel */
|
/* set to fully opaque if source has no alpha channel */
|
||||||
if(!src_has_alpha)
|
if(!src_has_alpha)
|
||||||
a = 0xFF << 2;
|
a = 0xFF << 2;
|
||||||
|
|
||||||
for (y = 0; y < dest_height; y++) {
|
for (y = 0; y < dest_height; y++) {
|
||||||
|
|
||||||
@@ -559,51 +558,51 @@ resize_half(PyObject *dest, PyObject *src) {
|
|||||||
|
|
||||||
for (x = 0; x < dest_width; x++) {
|
for (x = 0; x < dest_width; x++) {
|
||||||
|
|
||||||
// read first column
|
// read first column
|
||||||
r = *in_row1;
|
r = *in_row1;
|
||||||
r += *in_row2;
|
r += *in_row2;
|
||||||
in_row1++;
|
in_row1++;
|
||||||
in_row2++;
|
in_row2++;
|
||||||
g = *in_row1;
|
g = *in_row1;
|
||||||
g += *in_row2;
|
g += *in_row2;
|
||||||
in_row1++;
|
in_row1++;
|
||||||
in_row2++;
|
in_row2++;
|
||||||
b = *in_row1;
|
b = *in_row1;
|
||||||
b += *in_row2;
|
b += *in_row2;
|
||||||
in_row1++;
|
in_row1++;
|
||||||
in_row2++;
|
in_row2++;
|
||||||
|
|
||||||
if (src_has_alpha)
|
if (src_has_alpha)
|
||||||
{
|
{
|
||||||
a = *in_row1;
|
a = *in_row1;
|
||||||
a += *in_row2;
|
a += *in_row2;
|
||||||
in_row1++;
|
in_row1++;
|
||||||
in_row2++;
|
in_row2++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// read second column
|
// read second column
|
||||||
r += *in_row1;
|
r += *in_row1;
|
||||||
r += *in_row2;
|
r += *in_row2;
|
||||||
in_row1++;
|
in_row1++;
|
||||||
in_row2++;
|
in_row2++;
|
||||||
g += *in_row1;
|
g += *in_row1;
|
||||||
g += *in_row2;
|
g += *in_row2;
|
||||||
in_row1++;
|
in_row1++;
|
||||||
in_row2++;
|
in_row2++;
|
||||||
b += *in_row1;
|
b += *in_row1;
|
||||||
b += *in_row2;
|
b += *in_row2;
|
||||||
in_row1++;
|
in_row1++;
|
||||||
in_row2++;
|
in_row2++;
|
||||||
|
|
||||||
if (src_has_alpha)
|
if (src_has_alpha)
|
||||||
{
|
{
|
||||||
a += *in_row1;
|
a += *in_row1;
|
||||||
a += *in_row2;
|
a += *in_row2;
|
||||||
in_row1++;
|
in_row1++;
|
||||||
in_row2++;
|
in_row2++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// write blended color
|
// write blended color
|
||||||
*out = (UINT8)(r >> 2);
|
*out = (UINT8)(r >> 2);
|
||||||
out++;
|
out++;
|
||||||
*out = (UINT8)(g >> 2);
|
*out = (UINT8)(g >> 2);
|
||||||
@@ -613,9 +612,9 @@ resize_half(PyObject *dest, PyObject *src) {
|
|||||||
|
|
||||||
if (dest_has_alpha)
|
if (dest_has_alpha)
|
||||||
{
|
{
|
||||||
*out = (UINT8)(a >> 2);
|
*out = (UINT8)(a >> 2);
|
||||||
out++;
|
out++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user