~ubuntu-branches/ubuntu/maverick/blender/maverick

« back to all changes in this revision

Viewing changes to source/blender/blenkernel/intern/image.c

  • Committer: Bazaar Package Importer
  • Author(s): Khashayar Naderehvandi, Khashayar Naderehvandi, Alessio Treglia
  • Date: 2009-01-22 16:53:59 UTC
  • mfrom: (14.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090122165359-v0996tn7fbit64ni
Tags: 2.48a+dfsg-1ubuntu1
[ Khashayar Naderehvandi ]
* Merge from debian experimental (LP: #320045), Ubuntu remaining changes:
  - Add patch correcting header file locations.
  - Add libvorbis-dev and libgsm1-dev to Build-Depends.
  - Use avcodec_decode_audio2() in source/blender/src/hddaudio.c

[ Alessio Treglia ]
* Add missing previous changelog entries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*  image.c        
2
2
 * 
3
 
 * $Id: image.c 14877 2008-05-17 00:35:30Z aligorith $
 
3
 * $Id: image.c 16975 2008-10-08 16:50:06Z ton $
4
4
 *
5
5
 * ***** BEGIN GPL LICENSE BLOCK *****
6
6
 *
53
53
#include "DNA_packedFile_types.h"
54
54
#include "DNA_scene_types.h"
55
55
#include "DNA_camera_types.h"
 
56
#include "DNA_sequence_types.h"
56
57
#include "DNA_texture_types.h"
57
58
#include "DNA_userdef_types.h"
58
59
 
77
78
 
78
79
#include "RE_pipeline.h"
79
80
 
80
 
/* bad level; call to free_realtime_image */
81
 
#include "BKE_bad_level_calls.h"        
82
 
 
83
81
/* for stamp drawing to an image */
84
82
#include "BMF_Api.h"
85
83
 
86
84
#include "blendef.h"
87
85
#include "BSE_time.h"
88
86
 
 
87
#include "GPU_extensions.h"
 
88
#include "GPU_draw.h"
 
89
 
 
90
#include "BLO_sys_types.h" // for intptr_t support
 
91
 
89
92
/* max int, to indicate we don't store sequences in ibuf */
90
93
#define IMA_NO_INDEX    0x7FEFEFEF
91
94
 
238
241
                ima->rr= NULL;
239
242
        }       
240
243
        
241
 
        free_realtime_image(ima);
 
244
        GPU_free_image(ima);
242
245
        
243
246
        ima->ok= IMA_OK;
244
247
}
582
585
                ima->lastused = (int)PIL_check_seconds_timer();
583
586
}
584
587
 
585
 
void tag_all_images_time() 
 
588
static void tag_all_images_time() 
586
589
{
587
590
        Image *ima;
588
591
        int ctime = (int)PIL_check_seconds_timer();
618
621
                           This gives textures a "second chance" to be used before dying.
619
622
                        */
620
623
                        if(ima->bindcode || ima->repbind) {
621
 
                                free_realtime_image(ima);
 
624
                                GPU_free_image(ima);
622
625
                                ima->lastused = ctime;
623
626
                        }
624
627
                        /* Otherwise, just kill the buffers */
630
633
        }
631
634
}
632
635
 
633
 
static unsigned long image_mem_size(Image *ima)
 
636
static uintptr_t image_mem_size(Image *ima)
634
637
{
635
638
        ImBuf *ibuf, *ibufm;
636
639
        int level;
637
 
        unsigned long size = 0;
 
640
        uintptr_t size = 0;
638
641
 
639
642
        size= 0;
640
643
        for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) {
656
659
void BKE_image_print_memlist(void)
657
660
{
658
661
        Image *ima;
659
 
        unsigned long size, totsize= 0;
 
662
        uintptr_t size, totsize= 0;
660
663
 
661
664
        for(ima= G.main->image.first; ima; ima= ima->id.next)
662
665
                totsize += image_mem_size(ima);
848
851
                if(!BLI_testextensie(string, ".tga"))
849
852
                        extension= ".tga";
850
853
        }
851
 
        else if(ELEM5(imtype, R_MOVIE, R_AVICODEC, R_AVIRAW, R_AVIJPEG, R_JPEG90)) {
852
 
                if(!( BLI_testextensie(string, ".jpg") || BLI_testextensie(string, ".jpeg")))
853
 
                        extension= ".jpg";
854
 
        }
855
854
        else if(imtype==R_BMP) {
856
855
                if(!BLI_testextensie(string, ".bmp"))
857
856
                        extension= ".bmp";
858
857
        }
859
858
        else if(G.have_libtiff && (imtype==R_TIFF)) {
860
 
                if(!BLI_testextensie(string, ".tif"))
861
 
                        extension= ".tif";
 
859
                if(!BLI_testextensie(string, ".tif") && 
 
860
                        !BLI_testextensie(string, ".tiff")) extension= ".tif";
862
861
        }
863
862
#ifdef WITH_OPENEXR
864
863
        else if( ELEM(imtype, R_OPENEXR, R_MULTILAYER)) {
874
873
                if (!BLI_testextensie(string, ".dpx"))
875
874
                        extension= ".dpx";
876
875
        }
877
 
        else {  /* targa default */
 
876
        else if(imtype==R_TARGA) {
878
877
                if(!BLI_testextensie(string, ".tga"))
879
878
                        extension= ".tga";
880
879
        }
 
880
        else { //   R_MOVIE, R_AVICODEC, R_AVIRAW, R_AVIJPEG, R_JPEG90, R_QUICKTIME etc
 
881
                if(!( BLI_testextensie(string, ".jpg") || BLI_testextensie(string, ".jpeg")))
 
882
                        extension= ".jpg";
 
883
        }
881
884
 
882
885
        strcat(string, extension);
883
886
}
1512
1515
                image_initialize_after_load(ima, ibuf);
1513
1516
                image_assign_ibuf(ima, ibuf, 0, frame);
1514
1517
#endif
 
1518
                
 
1519
                if(ima->flag & IMA_DO_PREMUL)
 
1520
                        converttopremul(ibuf);
 
1521
                
1515
1522
        }
1516
1523
        else
1517
1524
                ima->ok= 0;
1564
1571
                        ibuf->channels= rpass->channels;
1565
1572
                        
1566
1573
                        image_initialize_after_load(ima, ibuf);
1567
 
                        image_assign_ibuf(ima, ibuf, iuser->multi_index, frame);
 
1574
                        image_assign_ibuf(ima, ibuf, iuser?iuser->multi_index:0, frame);
1568
1575
                        
1569
1576
                }
1570
1577
                // else printf("pass not found\n");