1 /* 2 * Copyright (C) 2003 2004, Magnus Hjorth 3 * 4 * This file is part of mhWaveEdit. 5 * 6 * mhWaveEdit is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * mhWaveEdit is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with mhWaveEdit; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 */ 20 21 22 #ifndef VIEWCACHE_H_INCLUDED 23 #define VIEWCACHE_H_INCLUDED 24 25 #include "chunk.h" 26 27 typedef struct { 28 Chunk *chunk; 29 ChunkHandle *handle; 30 gboolean chunk_error; 31 off_t start,end; 32 gint xres; 33 sample_t *values; 34 off_t *offsets; 35 gchar *calced; 36 } ViewCache; 37 38 ViewCache *view_cache_new(void); 39 void view_cache_free(ViewCache *vc); 40 41 /* Updates the cache. 42 * chunk : The chunk we're viewing 43 * start_samp,end_samp : The part of the chunk we're viewing 44 * xres : Width of view in pixels 45 * low_updated,high_updated : Set to left and right endpoint of 46 * updated region. If nothing was updated, both are set to 0. The 47 * pointers may be NULL. Not modified if function returns FALSE. 48 * Returns TRUE if any work was done. 49 */ 50 gboolean view_cache_update(ViewCache *cache, Chunk *chunk, off_t start_samp, 51 off_t end_samp, gint xres, 52 gint *low_updated, gint *high_updated); 53 54 gboolean view_cache_uptodate(ViewCache *cache); 55 56 void view_cache_draw(ViewCache *cache, GdkDrawable *d, gint yres, 57 GtkWidget *wid, gfloat scale); 58 void view_cache_draw_part(ViewCache *cache, GdkDrawable *d, gint xs, gint xe, 59 gint yres, GtkWidget *wid, gfloat scale); 60 61 #endif 62