Ticket #1688: warpchunkorder.patch

File warpchunkorder.patch, 1.2 kB (added by nowakpl, 5 months ago)
  • alg/gdalwarpoperation.cpp

    old new  
    583583 * @return CE_None on success or CE_Failure if an error occurs. 
    584584 */ 
    585585 
     586struct WarpChunk { 
     587    int dx, dy, dsx, dsy; 
     588    int sx, sy, ssx, ssy; 
     589}; 
     590 
     591bool OrderWarpChunk(const WarpChunk& a, const WarpChunk &b) { 
     592    if (a.dy < b.dy) return true; 
     593    else if (a.dy > b.dy) return false; 
     594    else if (a.dx < b.dx) return true; 
     595    else if (a.dx > b.dx) return false; 
     596    else return false; 
     597} 
     598 
    586599CPLErr GDALWarpOperation::ChunkAndWarpImage( 
    587600    int nDstXOff, int nDstYOff,  int nDstXSize, int nDstYSize ) 
    588601 
     
    592605/* -------------------------------------------------------------------- */ 
    593606    WipeChunkList(); 
    594607    CollectChunkList( nDstXOff, nDstYOff, nDstXSize, nDstYSize ); 
     608    std::sort(reinterpret_cast<WarpChunk *>(panChunkList), reinterpret_cast<WarpChunk *>(panChunkList) + nChunkListCount, OrderWarpChunk); 
    595609 
    596610/* -------------------------------------------------------------------- */ 
    597611/*      Total up output pixels to process.                              */