<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 11/11/2012 9:25 AM, Even Rouault wrote:
    <blockquote type="cite">
      <pre wrap="">
</pre>
      <blockquote type="cite">
        <pre wrap="">The value of a new function is code clarity. It's not just computing
pData, it's that the nBufXSize and nBufYSize become the size of the
cropped region, not the size of the actual buffer,
</pre>
      </blockquote>
      <pre wrap="">
I don't understand what you mean, sorry. Perhaps you should show the code. I 
understand that better than English ;-)</pre>
    </blockquote>
    No problem - your English is a whole lot better than my French :-)<br>
    <blockquote><font face="Courier New, Courier, monospace">GDALRasterBand::WriteCropToBand(int
        nCropSizeX, // width of the cropped region<br>
                                        int nCropSizeY, // height of the
        cropped region<br>
                                        int nXOffset,   // offset to the
        left edge of the cropped region<br>
                                        int nYOffset,   // offset to the
        top of the cropped region<br>
                                        void * pBuf,    // pointer to
        the buffer (uncropped)<br>
                                        GDALDataType eBufType, // data
        type in the buffer<br>
                                        int nPixelSpace, // byte offset
        from one pixel to the next<br>
                                        int nLineSpace)  // byte offset
        from one line to the next<br>
        {<br>
          void * pData = pBuf + nYOffset * nLineSpace + nXOffset *
        nPixelSpace;<br>
          this->RasterIO(GF_Write, 0, 0, this->nRasterXSize,
        this->nRasterYSize, <br>
                         pData, nCropSizeX, nCropSizeY, eBuftype,
        nPixelSpace, nLineSpace);<br>
        }</font><br>
    </blockquote>
    The code is obviously not very complicated. The value is that when
    you're reading code you can tell immediately that what's happening
    is the buffer is being cropped and written. If written directly in
    terms of RasterIO the intent is buried in the computation of the
    parameters, making it less clear.<br>
    <blockquote type="cite">
      <pre wrap="">

</pre>
      <blockquote type="cite">
        <blockquote type="cite">
          <pre wrap="">Not sure to understand that. The presence of nBufXSize, nBufYsize in your
proposal allows subsampling/oversampling. Perhaps you meant something
else with decimation/replication ?
</pre>
        </blockquote>
        <pre wrap="">
You're right.  nPixelSpace and nLineSpace now become required, no
default values will work.
</pre>
      </blockquote>
      <pre wrap="">
Not understanding that either.</pre>
    </blockquote>
    Sorry, not very clear. I agree that nBufXSize, nBufYSize are no
    longer necessary - they are read from the class variables. We could
    leave these vars in and continue to support decimation replication,
    I suppose. <br>
    My comment about nPixelSpace, nLineSpace is that these will have to
    be supplied, because we count on them to step through the buffer.
    They can no longer have default values.<br>
    <blockquote type="cite">
      <pre wrap="">


</pre>
    </blockquote>
    <br>
  </body>
</html>