Changeset 66450


Ignore:
Timestamp:
Oct 9, 2015, 9:55:34 AM (9 years ago)
Author:
wenzeslaus
Message:

r.patch: call Rast_cell_size just once, not for every cell (backport r64877 and part of 66449)

Location:
grass/branches/releasebranch_7_0/raster/r.patch
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • grass/branches/releasebranch_7_0/raster/r.patch/do_patch.c

    r61338 r66450  
    2222int do_patch(void *result, void *patch,
    2323             struct Cell_stats *statf, int ncols,
    24              RASTER_MAP_TYPE out_type, int use_zero)
     24             RASTER_MAP_TYPE out_type, size_t out_cell_size, int use_zero)
    2525{
    2626    int more;
     
    5757            }                   /* NULL support */
    5858        }
    59         result = G_incr_void_ptr(result, Rast_cell_size(out_type));
    60         patch = G_incr_void_ptr(patch, Rast_cell_size(out_type));
     59        result = G_incr_void_ptr(result, out_cell_size);
     60        patch = G_incr_void_ptr(patch, out_cell_size);
    6161    }
    6262    return more;
  • grass/branches/releasebranch_7_0/raster/r.patch/local_proto.h

    r32526 r66450  
    11/* do_patch.c */
    22int do_patch(void *result, void *, struct Cell_stats *, int, RASTER_MAP_TYPE,
    3             int);
     3             size_t, int);
    44/* support.c */
    55int support(char **, struct Cell_stats *, int, struct Categories *,
  • grass/branches/releasebranch_7_0/raster/r.patch/main.c

    r63346 r66450  
    3232    int outfd;
    3333    RASTER_MAP_TYPE out_type, map_type;
     34    size_t out_cell_size;
    3435    struct History history;
    3536    void *presult, *patch;
     
    5556    G_add_keyword(_("geometry"));
    5657    G_add_keyword(_("mosaicking"));
     58    G_add_keyword(_("merge"));
     59    G_add_keyword(_("patching"));
    5760    module->description =
    5861        _("Creates a composite raster map layer by using "
     
    112115    }
    113116
     117    out_cell_size = Rast_cell_size(out_type);
     118
    114119    rname = opt2->answer;
    115120    outfd = Rast_open_new(new_name = rname, out_type);
     
    144149            Rast_get_row(infd[i], patch, row, out_type);
    145150            if (!do_patch
    146                 (presult, patch, &statf[i], ncols, out_type, use_zero))
     151                (presult, patch, &statf[i], ncols, out_type, out_cell_size,
     152                 use_zero))
    147153                break;
    148154        }
  • grass/branches/releasebranch_7_0/raster/r.patch/r.patch.html

    r63776 r66450  
    2222"no data" cells.
    2323
    24 <h2>EXAMPLE</h2>
     24<h3>Example of filling areas</h3>
    2525
    26 Below, the raster map layer on the far left is <b>patched</b>
    27 with the middle (<em>patching</em>) raster map layer,
    28 to produce the <em>composite</em> raster map layer on the right.
     26<!-- this example is also used in the tests -->
     27
     28Below, the raster map layer on the far left is <b>patched</b>
     29with the middle (<em>patching</em>) raster map layer,
     30to produce the <em>composite</em> raster map layer on the right.
     31The example assumes zero values to be treated as NULLs (<b>-z</b> flag).
    2932
    3033<div class="code"><pre>
     
    4851  4 4 4 4 4 4 4 4    0 0 0 0 0 0 0 0    4 4 4 4 4 4 4 4
    4952</pre></div>
     53
    5054
    5155<h2>NOTES</h2>
Note: See TracChangeset for help on using the changeset viewer.