[Rezilla-commits] RezillaSource/Rezilla_SDK/ImagePlugin RezImagePlugin.c, 1.11, 1.12
Brought to you by:
bdesgraupes
From: Bernard D. <bde...@us...> - 2006-11-24 08:56:57
|
Update of /cvsroot/rezilla/RezillaSource/Rezilla_SDK/ImagePlugin In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv4164 Modified Files: RezImagePlugin.c Log Message: Removed resize image code Index: RezImagePlugin.c =================================================================== RCS file: /cvsroot/rezilla/RezillaSource/Rezilla_SDK/ImagePlugin/RezImagePlugin.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- RezImagePlugin.c 19 Sep 2006 12:13:24 -0000 1.11 +++ RezImagePlugin.c 24 Nov 2006 08:56:52 -0000 1.12 @@ -2,7 +2,7 @@ // File: "RezImagePlugin.c" // // Created: 2006-02-20 14:15:30 -// Last modification: 2006-09-18 10:00:25 +// Last modification: 2006-11-24 09:06:35 // Author: Bernard Desgraupes // e-mail: <bde...@us...> // www: <http://rezilla.sourceforge.net/> @@ -26,9 +26,6 @@ #define kRezImg_WinBoundsBottom 600; #define kRezImg_WinBoundsRight 500; -#define MAX_IMAGE_WIDTH 700 -#define MAX_IMAGE_HEIGHT 600 - // Image plugin record typedef struct RezImg_Rec { @@ -90,7 +87,6 @@ static OSErr _RezImg_getImageInfo(Handle inDataH, OSType imgType, StringPtr mimeTypeString, RezImg_EditInfo * editInfo); static OSErr _RezImg_readBitmapInfo(GraphicsImportComponent gi, RezImg_EditInfo *bi); static OSErr _RezImg_getBitmapData(GraphicsImportComponent gi, RezImg_EditInfo *bi); -static void _RezImg_rescaleImage( size_t* imageWidthPtr, size_t* imageHeightPtr, size_t maxWidth, size_t maxHeight ); static Handle _RezImg_createHandleDataRef(Handle dataHandle, OSType fileType, StringPtr mimeTypeString); static OSStatus _RezImg_openImageFile(CFURLRef * outURL); static CGImageRef _RezImg_getImageRef(RezImg_EditInfo * editInfo); @@ -287,7 +283,6 @@ editInfo->bitmapData = NULL; editInfo->width = 0; editInfo->height = 0; - if (GetHandleSize(inDataH) > 0) { error = _RezImg_getImageInfo(inDataH, imgType, NULL, editInfo); @@ -298,11 +293,6 @@ outInfo->error = error; return false; } - - // Make sure that the image isn't too large to fit comfortably onscreen - if ( editInfo->width > MAX_IMAGE_WIDTH || editInfo->height > MAX_IMAGE_HEIGHT ) { - _RezImg_rescaleImage( &editInfo->width, &editInfo->height, MAX_IMAGE_WIDTH, MAX_IMAGE_HEIGHT ); - } } // Fill the RezPlugInfo @@ -397,7 +387,7 @@ // // The implementation by the Image plugin of the RevertResource function // declared in the interface (SPluginEditorInterface structure) -// +// // ------------------------------------------------------------------------------------------- OSErr @@ -969,32 +959,6 @@ // ------------------------------------------------------------------------------------------- // -// Adapted from Apple's QTtoCG sample code -// -// ------------------------------------------------------------------------------------------- - -void -_RezImg_rescaleImage( size_t* imageWidthPtr, size_t* imageHeightPtr, size_t maxWidth, size_t maxHeight ) -{ - size_t width = *imageWidthPtr; - size_t height = *imageHeightPtr; - double widthFactor = (double)width / (double)maxWidth; - double heightFactor = (double)height / (double)maxHeight; - - if ( widthFactor > heightFactor ) { - // We're further off in the x axis than we are in the y - *imageWidthPtr = width / widthFactor; - *imageHeightPtr = height / widthFactor; - } else { - // We're further off in the y axis than we are in the x - *imageWidthPtr = width / heightFactor; - *imageHeightPtr = height / heightFactor; - } -} - - -// ------------------------------------------------------------------------------------------- -// // Adapted from Apple's Technical Q&A QTMTB56 // // ------------------------------------------------------------------------------------------- |