You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Hervé Girod <he...@club-internet.fr> on 2007/03/31 10:11:45 UTC

answer to a comment on some code in WMFRecordStore

Hello !!

I just saw that someone has made a comment about some part of the code 
handling META_DIBBITBLT operand in WMFRecordStore class. Basically, the 
code does :

 *case* WMFConstants.META_DIBBITBLT:
   {
     ..., get operand characteristics
     *int* len = 2*recSize - 18;
     *if* (len > 0) {
       *byte*[] bitmap = *new* *byte*[len];
       *for* (*int* i = 0; i < len; i++)
       bitmap[i] = is.readByte();
     } *else* {
       /// what does this mean?? len <= 0 ??
/       mr.numPoints = recSize;
       mr.functionId = functionId;
       *for* (*int* i = 0; i < len; i++) is.readByte();
     }
  ...

The (//len <= 0//) stuff is here because often, "in the wild", WMF records are found
faulty (sometimes even when generated with PPT !!). The test is to be sure that there
is really something in the bitmap, to avoid a possible Exception. To be honest, I did not
found exemples of faulty WMF files for the DIBBITBLT operand, but for another ones, and I had in that case to add this sort of code to handle it.

Herve




---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org