Revision: 56381
http://sourceforge.net/p/brlcad/code/56381
Author: mohitdaga
Date: 2013-07-31 09:27:14 +0000 (Wed, 31 Jul 2013)
Log Message:
-----------
Changed icv_writeline to not allocate memory. Although the functionality
remains same.
Modified Paths:
--------------
brlcad/trunk/src/libicv/fileformat.c
Modified: brlcad/trunk/src/libicv/fileformat.c
===================================================================
--- brlcad/trunk/src/libicv/fileformat.c 2013-07-31 05:15:45 UTC (rev
56380)
+++ brlcad/trunk/src/libicv/fileformat.c 2013-07-31 09:27:14 UTC (rev
56381)
@@ -460,27 +460,27 @@
int
icv_writeline(icv_image_t *bif, int y, void *data, ICV_DATA type)
{
- double *dst, *p;
+ double *dst;
size_t width_size;
- int flag=0;
+ unsigned char *p=NULL;
if (bif == NULL) {
bu_log("ERROR: trying to write a line to null bif\n");
return -1;
}
- if (type == ICV_DATA_UCHAR) {
- p = uchar2double(data, bif->width*bif->channels);
- flag= 1;
- } else
- p = data;
-
width_size = (size_t) bif->width*bif->channels;
dst = bif->data + width_size*y;
- memcpy(dst, p, width_size*sizeof(double));
+ if (type == ICV_DATA_UCHAR) {
+ p = data;
+ for (; width_size > 0; width_size--) {
+ *dst = (*p)/255.0;
+ p++;
+ dst++;
+ }
+ } else
+ memcpy(dst, data, width_size*sizeof(double));
- if (flag)
- bu_free(p, "icv__writeline : double data");
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits