Ticket #8650: diff
File diff, 4.6 KB (added by , 18 years ago) |
---|
-
engines/sword1/animation.cpp
405 405 406 406 char filename[20]; 407 407 snprintf(filename, sizeof(filename), "%s.dxa", sequenceList[id]); 408 if (loadFile(filename )) {408 if (loadFile(filename, 640, 480)) { 409 409 // The Broken Sword games always use external audio tracks. 410 410 if (_fd.readUint32BE() != MKID_BE('NULL')) 411 411 return false; -
engines/sword2/animation.cpp
510 510 511 511 snprintf(filename, sizeof(filename), "%s.dxa", _name); 512 512 513 if (loadFile(filename)) { 513 if (loadFile(filename, 514 _vm->_screen->getScreenWide(), 515 _vm->_screen->getScreenDeep())) { 514 516 // The Broken Sword games always use external audio tracks. 515 517 if (_fd.readUint32BE() != MKID_BE('NULL')) 516 518 return false; -
engines/agos/animation.cpp
62 62 // Change file extension to dxa 63 63 sprintf(videoName, "%s.dxa", baseName); 64 64 65 if (!loadFile(videoName)) { 65 if (!loadFile(videoName, 66 _vm->_screen->getScreenWide(), 67 _vm->_screen->getScreenDeep())) { 66 68 // Check short filename to work around 67 69 // bug in a German Windows 2CD version. 68 70 if (baseLen >= 8) { -
graphics/dxa_player.cpp
29 29 #include <zlib.h> 30 30 #endif 31 31 32 static void scaleUpBy2(byte *dst, byte *src, uint16 width, uint16 h) { 33 uint16 x; 34 35 while (h > 0) 36 { 37 for (x=width; x>0; x--) 38 { 39 register byte v; 40 v = *src++; 41 *dst++ = v; 42 *dst++ = v; 43 } 44 memcpy(dst, dst-width*2, width*2); 45 dst += width*2; 46 h--; 47 } 48 } 49 32 50 namespace Graphics { 33 51 34 52 DXAPlayer::DXAPlayer() { … … 36 54 _frameBuffer2 = 0; 37 55 _scaledBuffer = 0; 38 56 _drawBuffer = 0; 57 _scaledBuffer2 = 0; 39 58 40 59 _width = 0; 41 60 _height = 0; … … 48 67 _frameTicks = 0; 49 68 50 69 _scaleMode = S_NONE; 70 71 _scaling = 1; 51 72 } 52 73 53 74 DXAPlayer::~DXAPlayer() { … … 56 77 int DXAPlayer::getWidth() { 57 78 if (!_fd.isOpen()) 58 79 return 0; 59 return _width ;80 return _width*_scaling; 60 81 } 61 82 62 83 int DXAPlayer::getHeight() { 63 84 if (!_fd.isOpen()) 64 85 return 0; 65 return _height ;86 return _height*_scaling; 66 87 } 67 88 68 89 int DXAPlayer::getCurFrame() { … … 77 98 return _framesCount; 78 99 } 79 100 101 bool DXAPlayer::loadFile(const char *filename, uint16 maxWidth, uint16 maxHeight) { 102 bool result = loadFile(filename); 103 104 if (result) 105 { 106 _scaling = MIN(maxWidth/_width, maxHeight/_height); 107 if (_scaling < 1) 108 _scaling = 1; 109 if (_scaling > 2) 110 _scaling = 2; 111 if (_scaling >= 2) 112 { 113 _scaledBuffer2 = (uint8 *)malloc(_width*_height*_scaling*_scaling); 114 if (!_scaledBuffer2) { 115 _scaling = 1; 116 } 117 } 118 } 119 return result; 120 } 80 121 bool DXAPlayer::loadFile(const char *filename) { 81 122 uint32 tag; 82 123 int32 frameRate; … … 147 188 free(_frameBuffer1); 148 189 free(_frameBuffer2); 149 190 free(_scaledBuffer); 191 free(_scaledBuffer2); 150 192 } 151 193 152 194 void DXAPlayer::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) { … … 535 577 _drawBuffer = _frameBuffer1; 536 578 break; 537 579 } 580 581 if (_scaling == 2) { 582 /* Scale up here */ 583 scaleUpBy2(_scaledBuffer2, _drawBuffer, _width, _height); 584 _drawBuffer = _scaledBuffer2; 585 } 538 586 } 539 587 540 588 } // End of namespace Graphics -
graphics/dxa_player.h
46 46 byte *_frameBuffer2; 47 47 byte *_scaledBuffer; 48 48 byte *_drawBuffer; 49 byte *_scaledBuffer2; 49 50 uint16 _width; 50 51 uint16 _height, _curHeight; 51 52 uint16 _framesCount; … … 55 56 uint16 _frameSkipped; 56 57 uint32 _frameTicks; 57 58 ScaleMode _scaleMode; 59 uint32 _scaling; 58 60 59 61 public: 60 62 DXAPlayer(); … … 91 93 bool loadFile(const char *filename); 92 94 93 95 /** 96 * Load a DXA encoded video file and setup scaling if required 97 * @param filename the filename to load 98 * @param maxWidth the maximum width available to the film 99 * @param maxHeight the maximum height available to the film 100 */ 101 bool loadFile(const char *filename, uint16 maxWidth, uint16 maxHeight); 102 103 /** 94 104 * Close a DXA encoded video file 95 105 */ 96 106 void closeFile();