On Sun, Mar 09, 2003 at 09:27:43PM +0000, Michael Nordstr�m wrote:
> I know from past experience that Adam has a different view than me
> when it comes to the viewer's memory use; IMO, we should use as
> little memory as possible to be able to support also older devices
> and not only the latest and greatest ;-)
Thanks alot.. :) .. I've attached a diff as a preliminary
implementation of horizontally layering images. Obviously it would
need to be re-worked for my revision (the squares) but this idea would
be the same.
Fortunatly, I see no reason as of why this would take up any more
memory this way then if there were actually that many images nativly
references in the document itself..., other than the linked list but
that's only temporary.
By the way, I doubt if this code actually works, as well even if it
did it certainly isn't optimized .. You'll get the basic idea..
Index: document.h
===================================================================
RCS file: /cvs/plucker/plucker_src/viewer/document.h,v
retrieving revision 1.41
diff -u -r1.41 document.h
--- document.h 29 Jan 2003 15:16:15 -0000 1.41
+++ document.h 9 Mar 2003 21:33:14 -0000
@@ -42,7 +42,8 @@
DATATYPE_STYLE_SHEET = 11,
DATATYPE_FONT_PAGE = 12,
DATATYPE_TABLE = 13,
- DATATYPE_TABLE_COMPRESSED = 14
+ DATATYPE_TABLE_COMPRESSED = 14,
+ DATATYPE_MULTIRECORD = 15
} PluckerDataType;
Index: image.c
===================================================================
RCS file: /cvs/plucker/plucker_src/viewer/image.c,v
retrieving revision 1.53
diff -u -r1.53 image.c
--- image.c 22 Feb 2003 13:52:27 -0000 1.53
+++ image.c 9 Mar 2003 21:33:15 -0000
@@ -29,6 +29,7 @@
#include "genericfile.h"
#include "history.h"
#include "hires.h"
+#include "list.h"
#include "mainform.h"
#include "os.h"
#include "paragraph.h"
@@ -67,6 +68,11 @@
* Local Functions
*
***********************************************************************/
+static void DrawMultiInlineImage( const Header* imageRecord,
+ const TextContext* tContext, Int16* width ) IMAGE_SECTION;
+static void GetMultiImageMetrics( const Header* imageRecord, Int16* width,
+ Int16* height ) IMAGE_SECTION;
+static LinkedList ReadMultiRecord( const Header* multiRecord ) IMAGE_SECTION;
/***********************************************************************
@@ -184,6 +190,10 @@
imagePtr = (BitmapType*) ( imageRecord + 1 );
break;
+ case DATATYPE_MULTIRECORD:
+ DrawMultiInlineImage( imageRecord, tContext, width );
+ /* FALLTHROUGH */
+
default:
MemHandleUnlock( imageHandle );
FreeRecordHandle( &imageHandle );
@@ -229,6 +239,33 @@
+static void DrawMultiInlineImage
+ (
+ const Header* imageRecord,
+ const TextContext* tContext,
+ Int16* width
+ )
+{
+ LinkedList referenceList;
+ Int16* reference;
+
+ referenceList = ReadMultiRecord( imageRecord );
+ reference = ListFirst( referenceList );
+ while ( reference != NULL ) {
+ Int16 singleWidth;
+
+ DrawInlineImage( *reference, tContext, &singleWidth );
+ *width += singleWidth;
+
+ ListTakeOut( referenceList, reference );
+ SafeMemPtrFree( reference );
+ reference = ListNext( referenceList, reference );
+ }
+ ListRelease( referenceList );
+}
+
+
+
/* Get the height and width of the image */
void GetImageMetrics
(
@@ -297,6 +334,10 @@
imagePtr = (BitmapType*) ( imageRecord + 1 );
break;
+ case DATATYPE_MULTIRECORD:
+ GetMultiImageMetrics( imageRecord, width, height );
+ /* FALLTHROUGH */
+
default:
MemHandleUnlock( imageHandle );
FreeRecordHandle( &imageHandle );
@@ -343,6 +384,35 @@
+static void GetMultiImageMetrics
+ (
+ const Header* imageRecord,
+ Int16* width,
+ Int16* height
+ )
+{
+ LinkedList referenceList;
+ Int16* reference;
+
+ referenceList = ReadMultiRecord( imageRecord );
+ reference = ListFirst( referenceList );
+ while ( reference != NULL ) {
+ Int16 singleWidth;
+ Int16 singleHeight;
+
+ GetImageMetrics( *reference, &singleWidth, &singleHeight );
+ *width += singleWidth;
+ *height += singleHeight;
+
+ ListTakeOut( referenceList, reference );
+ SafeMemPtrFree( reference );
+ reference = ListNext( referenceList, reference );
+ }
+ ListRelease( referenceList );
+}
+
+
+
/* Optimize an image based upon screendepth and OS */
Boolean OptimizeImage_None
(
@@ -601,3 +671,27 @@
largeImage = false;
}
+
+
+static LinkedList ReadMultiRecord
+ (
+ const Header* multiRecord
+ )
+{
+ LinkedList referenceList;
+ UInt16 totalParts;
+ UInt16 position;
+ Int16* reference;
+
+ referenceList = ListCreate();
+ totalParts = multiRecord->size / 2;
+ reference = NULL;
+
+ for ( position = 0; position < totalParts; position += 2 ) {
+ reference = SafeMemPtrNew( sizeof( Int16 ) );
+ MemMove( reference, multiRecord + position, 2 );
+ ListAppend( referenceList, reference );
+ }
+
+ return referenceList;
+}
--
Adam McDaniel
Array.org
Calgary, AB, Canada
_______________________________________________
plucker-dev mailing list
[EMAIL PROTECTED]
http://lists.rubberchicken.org/mailman/listinfo/plucker-dev