summaryrefslogtreecommitdiff
path: root/rect.c
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2015-03-01 20:51:37 +0100
committerLars-Dominik Braun <lars@6xq.net>2015-05-02 21:36:45 +0200
commit4c21b2ea8d42a92e2f1cbfd93346ff77041ea44d (patch)
tree32b955a06368886d4df77c0e2bfb53ef137580ef /rect.c
parent4d2d896e28446928d820bf1353abcf40e3f66ed8 (diff)
downloadpucket-4c21b2ea8d42a92e2f1cbfd93346ff77041ea44d.tar.gz
pucket-4c21b2ea8d42a92e2f1cbfd93346ff77041ea44d.tar.bz2
pucket-4c21b2ea8d42a92e2f1cbfd93346ff77041ea44d.zip
Fix colormap segfault
The segfaults due to unaligned vector access should have happened before the recent changes. Not sure why it worked before. Reverts colormap vectorization. This is going to be restored once I rework the colormaps.
Diffstat (limited to 'rect.c')
-rw-r--r--rect.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/rect.c b/rect.c
index 0d9a9db..d988ed1 100644
--- a/rect.c
+++ b/rect.c
@@ -31,9 +31,6 @@ typedef struct {
unsigned int sub_batch_size, fuse;
unsigned short *xform_distrib;
- flam3_palette dmap;
- unsigned int cmap_size;
-
/* camera stuff */
double ws0, wb0s0, hs1, hb1s1; /* shortcuts for indexing */
double bounds[4]; /* Corner coords of viewable area */
@@ -44,7 +41,7 @@ typedef struct {
/* Lookup color [0,1]
*/
static double4 color_palette_lookup (const double color,
- const color_palette_mode mode, const flam3_palette map,
+ const color_palette_mode mode, const flam3_palette_entry * const map,
const unsigned int map_count) {
assert (color >= 0.0 && color <= 1.0);
@@ -56,17 +53,18 @@ static double4 color_palette_lookup (const double color,
const unsigned int intix = bottomix;
if (intix == map_count-1) {
- return map[intix].color;
+ return vector_d4 (map[intix].color);
} else {
- return map[intix].color * (1.0-frac) +
- map[intix+1].color * frac;
+ const double4 c1 = vector_d4 (map[intix].color);
+ const double4 c2 = vector_d4 (map[intix+1].color);
+ return c1 * (1.0-frac) + c2 * frac;
}
break;
}
case PALETTE_MODE_STEP: {
- const unsigned int intix = nearbyint (color * map_count);
- return map[intix].color;
+ const unsigned int intix = nearbyint (color * (map_count-1));
+ return vector_d4 (map[intix].color);
break;
}
@@ -137,7 +135,8 @@ static void iter_thread (flam3_genome * const input_genome,
#endif
double4 interpcolor = color_palette_lookup (p[2],
- genome.palette_mode, c->dmap, c->cmap_size);
+ genome.palette_mode, input_genome->palette,
+ 256);
const double logvis = p[3];
if (logvis != 1.0) {
@@ -243,16 +242,6 @@ bool render_bucket (flam3_genome * const genome, bucket * const bucket,
};
assert (c.xform_distrib != NULL);
- /* compute the colormap entries. */
- /* the input colormap is 256 long with entries from 0 to 1.0 */
- for (unsigned int j = 0; j < CMAP_SIZE; j++) {
- c.dmap[j].index = genome->palette[(j * 256) / CMAP_SIZE].index / 256.0;
- for (unsigned int k = 0; k < 4; k++) {
- c.dmap[j].color[k] = genome->palette[(j * 256) / CMAP_SIZE].color[k];
- }
- }
- c.cmap_size = 256;
-
/* compute camera */
compute_camera (genome, bucket, &c);