# HG changeset patch # User John W. Eaton # Date 1264196641 18000 # Node ID a552859b009af9df1807c090362638b9ada9253e # Parent 30aeda033364fef4405d01d55cc9a01ecbbefc47 rename member functions in prog_args class to avoid conflicts with gnulib definitions diff -r 30aeda033364 -r a552859b009a liboctave/ChangeLog --- a/liboctave/ChangeLog Fri Jan 22 16:34:07 2010 -0500 +++ b/liboctave/ChangeLog Fri Jan 22 16:44:01 2010 -0500 @@ -1,3 +1,9 @@ +2010-01-22 John W. Eaton + + * prog-args.h (prog_args::get_option): Rename from getopt. Now const. + (prog_args::option_argument): Rename from optarg. Now const. + (prog_args::option_index): Rename from optind. Now const. + 2010-01-22 John W. Eaton * file-ops.cc: Don't include statdefs.h. diff -r 30aeda033364 -r a552859b009a liboctave/prog-args.cc --- a/liboctave/prog-args.cc Fri Jan 22 16:34:07 2010 -0500 +++ b/liboctave/prog-args.cc Fri Jan 22 16:44:01 2010 -0500 @@ -29,7 +29,7 @@ #include "prog-args.h" int -prog_args::getopt (void) +prog_args::get_option (void) const { if (long_opts) return ::octave_getopt_long @@ -40,13 +40,13 @@ } const char * -prog_args::optarg (void) +prog_args::option_argument (void) const { return ::optarg; } int -prog_args::optind (void) +prog_args::option_index (void) const { return ::optind; } diff -r 30aeda033364 -r a552859b009a liboctave/prog-args.h --- a/liboctave/prog-args.h Fri Jan 22 16:34:07 2010 -0500 +++ b/liboctave/prog-args.h Fri Jan 22 16:44:01 2010 -0500 @@ -55,11 +55,11 @@ ~prog_args (void) { } - int getopt (void); + int get_option (void) const; - const char *optarg (void); + const char *option_argument (void) const; - int optind (void); + int option_index (void) const; private: diff -r 30aeda033364 -r a552859b009a src/ChangeLog --- a/src/ChangeLog Fri Jan 22 16:34:07 2010 -0500 +++ b/src/ChangeLog Fri Jan 22 16:44:01 2010 -0500 @@ -1,3 +1,8 @@ +2010-01-22 John W. Eaton + + * octave.cc (octave_main): Use new names for prog_args member + functions. + 2010-01-22 John W. Eaton * octave.cc: Don't include sys/types.h, unistd.h, or fstream. diff -r 30aeda033364 -r a552859b009a src/DLD-FUNCTIONS/__magick_read__.cc --- a/src/DLD-FUNCTIONS/__magick_read__.cc Fri Jan 22 16:34:07 2010 -0500 +++ b/src/DLD-FUNCTIONS/__magick_read__.cc Fri Jan 22 16:44:01 2010 -0500 @@ -35,7 +35,29 @@ #include -unsigned int +template +inline P +scale_quantum_to_depth (const Magick::Quantum& quantum) +{ + return (static_cast

(static_cast (quantum) + / MaxRGB * ((1 << depth) - 1))); +} + +template <> +inline octave_uint8 +scale_quantum_to_depth (const Magick::Quantum& quantum) +{ + return static_cast (quantum); +} + +template <> +inline octave_uint16 +scale_quantum_to_depth (const Magick::Quantum& quantum) +{ + return static_cast (quantum); +} + +inline unsigned int scale_quantum_to_depth (const Magick::Quantum& quantum, unsigned int depth) { return (static_cast (static_cast (quantum) @@ -190,7 +212,7 @@ return output; } -template +template octave_value_list read_images (const std::vector& imvec, const Array& frameidx, unsigned int depth) @@ -269,31 +291,41 @@ case Magick::PaletteType: case Magick::TrueColorType: - idim(2) = 3; - im = T (idim); - for (int frame = 0; frame < nframes; frame++) - { - const Magick::PixelPacket *pix - = imvec[frameidx(frame)].getConstPixels (0, 0, columns, rows); + { + idim(2) = 3; + im = T (idim); + P *vec = reinterpret_cast

(im.fortran_vec ()); - int i = 0; - idx(3) = frame; + for (int frame = 0; frame < nframes; frame++) + { + const Magick::PixelPacket *pix + = imvec[frameidx(frame)].getConstPixels (0, 0, columns, rows); - for (int y = 0; y < rows; y++) - { - idx(0) = y; - for (int x = 0; x < columns; x++) - { - idx(1) = x; - idx(2) = 0; - im(idx) = scale_quantum_to_depth (pix[i].red, depth); - idx(2) = 1; - im(idx) = scale_quantum_to_depth (pix[i].green, depth); - idx(2) = 2; - im(idx) = scale_quantum_to_depth (pix[i].blue, depth); - i++; - } - } + int i = 0; + P *rbuf, *gbuf, *bbuf; + rbuf = vec; + gbuf = vec + rows * columns; + bbuf = vec + rows * columns * 2; + for (int y = 0; y < rows; y++) + { + for (int x = 0; x < columns; x++) + { + *rbuf = scale_quantum_to_depth (pix[i].red); + *gbuf = scale_quantum_to_depth (pix[i].green); + *bbuf = scale_quantum_to_depth (pix[i].blue); + i++; + rbuf += rows; + gbuf += rows; + bbuf += rows; + } + rbuf -= rows * columns - 1; + gbuf -= rows * columns - 1; + bbuf -= rows * columns - 1; + } + + // Next frame. + vec += rows * columns * 3; + } } break; @@ -426,17 +458,23 @@ switch (depth) { case 1: - output = read_images (imvec, frameidx, depth); + output = read_images (imvec, frameidx, depth); break; case 2: + output = read_images (imvec, frameidx, depth) ; + break; + case 4: + output = read_images (imvec, frameidx, depth) ; + break; + case 8: - output = read_images (imvec, frameidx, depth) ; + output = read_images (imvec, frameidx, depth) ; break; case 16: - output = read_images (imvec, frameidx, depth); + output = read_images (imvec, frameidx, depth); break; case 32: diff -r 30aeda033364 -r a552859b009a src/octave.cc --- a/src/octave.cc Fri Jan 22 16:34:07 2010 -0500 +++ b/src/octave.cc Fri Jan 22 16:44:01 2010 -0500 @@ -634,7 +634,7 @@ bool read_history_file = true; int optc; - while ((optc = args.getopt ()) != EOF) + while ((optc = args.get_option ()) != EOF) { switch (optc) { @@ -667,8 +667,8 @@ break; case 'p': - if (args.optarg ()) - load_path::set_command_line_path (args.optarg ()); + if (args.option_argument ()) + load_path::set_command_line_path (args.option_argument ()); break; case 'q': @@ -687,38 +687,38 @@ break; case DOC_CACHE_FILE_OPTION: - if (args.optarg ()) - bind_internal_variable ("doc_cache_file", args.optarg ()); + if (args.option_argument ()) + bind_internal_variable ("doc_cache_file", args.option_argument ()); break; case EVAL_OPTION: - if (args.optarg ()) + if (args.option_argument ()) { if (code_to_eval.empty ()) - code_to_eval = args.optarg (); + code_to_eval = args.option_argument (); else - code_to_eval += std::string (" ") + args.optarg (); + code_to_eval += std::string (" ") + args.option_argument (); } break; case EXEC_PATH_OPTION: - if (args.optarg ()) - set_exec_path (args.optarg ()); + if (args.option_argument ()) + set_exec_path (args.option_argument ()); break; case IMAGE_PATH_OPTION: - if (args.optarg ()) - set_image_path (args.optarg ()); + if (args.option_argument ()) + set_image_path (args.option_argument ()); break; case INFO_FILE_OPTION: - if (args.optarg ()) - bind_internal_variable ("info_file", args.optarg ()); + if (args.option_argument ()) + bind_internal_variable ("info_file", args.option_argument ()); break; case INFO_PROG_OPTION: - if (args.optarg ()) - bind_internal_variable ("info_program", args.optarg ()); + if (args.option_argument ()) + bind_internal_variable ("info_program", args.option_argument ()); break; case LINE_EDITING_OPTION: @@ -817,7 +817,7 @@ // Additional arguments are taken as command line options for the // script. - int last_arg_idx = args.optind (); + int last_arg_idx = args.option_index (); int remaining_args = argc - last_arg_idx;