~ubuntu-branches/debian/sid/mhwaveedit/sid

« back to all changes in this revision

Viewing changes to src/viewcache.c

  • Committer: Bazaar Package Importer
  • Author(s): Free Ekanayaka
  • Date: 2008-01-08 22:20:37 UTC
  • mfrom: (2.1.6 hardy)
  • Revision ID: james.westby@ubuntu.com-20080108222037-tsazhckl5vmc8yih
Tags: 1.4.14-2
Added desktop file (Closes: #457849), thanks to Marco Rodrigues

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2002 2003 2004 2005, Magnus Hjorth
 
2
 * Copyright (C) 2002 2003 2004 2005 2007, Magnus Hjorth
3
3
 *
4
4
 * This file is part of mhWaveEdit.
5
5
 *
102
102
     /* if (xres > end_samp-start_samp) xres=end_samp-start_samp; */
103
103
     if (readflag) return FALSE;
104
104
 
 
105
     /* Special case - empty file */
105
106
     if (end_samp == start_samp) {
106
 
          memset(cache->calced, CALC_UNKNOWN, xres);
 
107
          if (cache->xres != xres) {
 
108
               g_free(cache->calced);
 
109
               cache->calced = g_malloc0(xres);
 
110
               cache->xres = xres;
 
111
          }
107
112
          if (low_updated) {
108
113
               *low_updated = 0;
109
114
               *high_updated = xres-1;
173
178
          if (highq_spp >= real_spp) highq_spp = 0;
174
179
          if (!inifile_get_gboolean("drawImprove",TRUE)) highq_spp=lowq_spp;
175
180
 
176
 
          /* Three cases - scrolling, zooming and no overlap at all */
177
 
          if (chunk_change || 
 
181
          /* Three cases - scrolling, zooming and no overlap at all */    
 
182
          if (chunk_change ||
178
183
              end_samp <= cache->start || start_samp >= cache->end) {
179
184
 
180
185
               /* No overlap - don't do anything more */
201
206
                      k*channels*2*sizeof(sample_t));
202
207
               o = cache->offsets[j] - new_offsets[i];
203
208
               for (l=0; l<=xres; l++) new_offsets[l] += o;
204
 
               memcpy(new_calced+i, cache->calced+j, k);
 
209
               /* When real_spp < 1.0, we may get errors due to offset rounding
 
210
                * therefore, set the cache status to DIRTY */
 
211
 
 
212
               if (real_spp >= 1.0)
 
213
                    memcpy(new_calced+i, cache->calced+j, k);
 
214
               else
 
215
                    memset(new_calced+i, CALC_DIRTY, k);
205
216
               
206
217
          } else if (end_samp-start_samp > cache->end-cache->start) {
207
218
 
319
330
               sbuf = g_malloc(m);
320
331
          }
321
332
          readflag = TRUE;
322
 
          m = chunk_read_array_fp(cache->handle, start_samp, k, sbuf, DITHER_NONE);
 
333
          m = chunk_read_array_fp(cache->handle, start_samp, k, sbuf, 
 
334
                                  DITHER_NONE, NULL);
323
335
          readflag = FALSE;
324
336
          
325
337
          for (n=0; n<xres; n++) {
392
404
          }
393
405
          readflag = TRUE;
394
406
          m=chunk_read_array_fp(cache->handle,cache->offsets[i],k,sbuf,
395
 
                                DITHER_NONE);
 
407
                                DITHER_NONE, NULL);
396
408
          readflag = FALSE;
397
409
          g_assert(m==0 || m==k);
398
410
 
443
455
               }
444
456
               readflag = TRUE;
445
457
               m = chunk_read_array_fp(cache->handle, cache->offsets[i]+impr,
446
 
                                       k, sbuf,DITHER_NONE);
 
458
                                       k, sbuf,DITHER_NONE,NULL);
447
459
               readflag = FALSE;
448
460
               if (m == 0) {
449
461
                    memset(cache->calced, CALC_DONE, xres);
477
489
               }
478
490
               readflag = TRUE;
479
491
               l=chunk_read_array_fp(cache->handle, cache->offsets[i]+impr, 
480
 
                                     new_spp-impr, sbuf, DITHER_NONE);
 
492
                                     new_spp-impr, sbuf, DITHER_NONE,NULL);
481
493
               readflag = FALSE;
482
494
               g_assert(l==new_spp-impr || l==0);
483
495
               if (l == 0) {