From: "Rodolfo García Peñas (kix)" <[email protected]>
The optimize_for_speed was used to set the Alpha channel for jpeg.
The alpha channel for jpeg should be used always. The current CPUs/GPUs can do
it without problems and this is an old behaviour.
---
wrlib/context.c | 8 --------
wrlib/jpeg.c | 28 ++++++----------------------
wrlib/wraster.h | 1 -
3 files changed, 6 insertions(+), 31 deletions(-)
diff --git a/wrlib/context.c b/wrlib/context.c
index bc02183..3fdaafe 100644
--- a/wrlib/context.c
+++ b/wrlib/context.c
@@ -502,14 +502,6 @@ static void gatherconfig(RContext * context, int screen_n)
context->attribs->colors_per_channel = i;
}
}
-
- ptr = mygetenv("WRASTER_OPTIMIZE_FOR_SPEED", screen_n);
- if (ptr) {
- context->flags.optimize_for_speed = 1;
- } else {
- context->flags.optimize_for_speed = 0;
- }
-
}
static void getColormap(RContext * context, int screen_number)
diff --git a/wrlib/jpeg.c b/wrlib/jpeg.c
index 2339f51..08fa47d 100644
--- a/wrlib/jpeg.c
+++ b/wrlib/jpeg.c
@@ -149,10 +149,7 @@ RImage *RLoadJPEG(RContext * context, const char
*file_name)
cinfo.do_block_smoothing = FALSE;
jpeg_calc_output_dimensions(&cinfo);
- if (context->flags.optimize_for_speed)
- image = RCreateImage(cinfo.image_width, cinfo.image_height,
True);
- else
- image = RCreateImage(cinfo.image_width, cinfo.image_height,
False);
+ image = RCreateImage(cinfo.image_width, cinfo.image_height, False);
if (!image) {
RErrorCode = RERR_NOMEMORY;
@@ -163,24 +160,11 @@ RImage *RLoadJPEG(RContext * context, const char
*file_name)
ptr = image->data;
if (cinfo.out_color_space == JCS_RGB) {
- if (context->flags.optimize_for_speed) {
- while (cinfo.output_scanline < cinfo.output_height) {
- jpeg_read_scanlines(&cinfo, buffer,
(JDIMENSION) 1);
- bptr = buffer[0];
- for (i = 0; i < cinfo.image_width; i++) {
- *ptr++ = *bptr++;
- *ptr++ = *bptr++;
- *ptr++ = *bptr++;
- ptr++; /* skip alpha channel */
- }
- }
- } else {
- while (cinfo.output_scanline < cinfo.output_height) {
- jpeg_read_scanlines(&cinfo, buffer,
(JDIMENSION) 1);
- bptr = buffer[0];
- memcpy(ptr, bptr, cinfo.image_width * 3);
- ptr += cinfo.image_width * 3;
- }
+ while (cinfo.output_scanline < cinfo.output_height) {
+ jpeg_read_scanlines(&cinfo, buffer, (JDIMENSION) 1);
+ bptr = buffer[0];
+ memcpy(ptr, bptr, cinfo.image_width * 3);
+ ptr += cinfo.image_width * 3;
}
} else {
while (cinfo.output_scanline < cinfo.output_height) {
diff --git a/wrlib/wraster.h b/wrlib/wraster.h
index b5e360e..ff2b2c3 100644
--- a/wrlib/wraster.h
+++ b/wrlib/wraster.h
@@ -147,7 +147,6 @@ typedef struct RContext {
struct {
unsigned int use_shared_pixmap:1;
- unsigned int optimize_for_speed:1;
} flags;
} RContext;
--
1.7.10.4
--
To unsubscribe, send mail to [email protected].