Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-07-17 17:29:55 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-07-17 17:29:55 +0400
commit22c6b7d174ec7158acc526821b002d9703cf4f56 (patch)
tree68ac54748cefe19c105709230be79e1deb7b6812 /source
parent30b712ed68dd72583357180741e845efb5952ad9 (diff)
PNG Compression can now be set, writing uncompressed PNG's is significantly faster for high resolution images - 2k.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/image.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c8
-rw-r--r--source/blender/imbuf/intern/png.c9
-rw-r--r--source/blender/makesrna/intern/rna_scene.c4
4 files changed, 17 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index b66b5c60916..ffd0b378f07 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1180,6 +1180,10 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, char *name, int imtype, int subimt
}
else if (ELEM5(imtype, R_PNG, R_FFMPEG, R_H264, R_THEORA, R_XVID)) {
ibuf->ftype= PNG;
+
+ if(imtype==R_PNG)
+ ibuf->ftype |= quality; /* quality is actually compression 0-100 --> 0-9 */
+
}
#ifdef WITH_DDS
else if ((imtype==R_DDS)) {
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 221e144ed60..62fe9dc96b7 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -850,8 +850,6 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
/* border */
setlinestyle(3);
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-
UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 1.0, 0);
glBegin(GL_LINE_LOOP);
@@ -873,14 +871,16 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
y1+= a;
y2-= a;
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+
uiSetRoundBox(15);
gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, 12.0);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+
}
setlinestyle(0);
-
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
/* draw grease-pencil (image aligned) */
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index 68a3324816c..4df8d8a2271 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -103,6 +103,11 @@ int imb_savepng(struct ImBuf *ibuf, char *name, int flags)
int i, bytesperpixel, color_type = PNG_COLOR_TYPE_GRAY;
FILE *fp = 0;
+ /* use the jpeg quality setting for compression */
+ int compression;
+ compression= (int)(((float)(ibuf->ftype & 0xff) / 11.1111f));
+ compression= compression < 0 ? 0 : (compression > 9 ? 9 : compression);
+
bytesperpixel = (ibuf->depth + 7) >> 3;
if ((bytesperpixel > 4) || (bytesperpixel == 2)) {
printf("imb_savepng: unsupported bytes per pixel: %d\n", bytesperpixel);
@@ -201,10 +206,10 @@ int imb_savepng(struct ImBuf *ibuf, char *name, int flags)
PNG_FILTER_AVG | PNG_FILTER_VALUE_AVG |
PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
PNG_ALL_FILTERS);
-
- png_set_compression_level(png_ptr, Z_BEST_COMPRESSION);
*/
+ png_set_compression_level(png_ptr, compression);
+
// png image settings
png_set_IHDR(png_ptr,
info_ptr,
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 7c2037be6e0..1b733efd7cf 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2037,8 +2037,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop= RNA_def_property(srna, "file_quality", PROP_INT, PROP_PERCENTAGE);
RNA_def_property_int_sdna(prop, NULL, "quality");
- RNA_def_property_range(prop, 1, 100);
- RNA_def_property_ui_text(prop, "Quality", "Quality of JPEG images, AVI Jpeg and SGI movies");
+ RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
+ RNA_def_property_ui_text(prop, "Quality", "Quality of JPEG images, AVI Jpeg and SGI movies, Compression for PNG's");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
/* Tiff */