2
0
mirror of https://github.com/boostorg/gil.git synced 2026-02-22 03:22:15 +00:00
Commit Graph

228 Commits

Author SHA1 Message Date
Mateusz Loskot
0e11759d4e Apply clang-tidy modernize-use-using to extension/dynamic_image (#193)
Run clang-tidy 7.0 with `-checks='-*,modernize-use-using' -fix`
against single TU with `#include <boost/gil/concepts/*.hpp>`.

Manually refactor numerous typedef-s
- where missed by modernize-use-using check, not uncommon
- in code snippets in comments

Outcome is that searching for lower-case whole word typedef
in all the extension/dynamic_image/*.hpp should return 5 matches,
in definitions of macros (TODO).
2018-12-16 01:25:12 +01:00
Mateusz Loskot
46939c7b29 Apply clang-tidy modernize-use-using to core headers (#192)
Run clang-tidy 7.0 with `-checks='-*,modernize-use-using' -fix`
against single TU with `#include <boost/gil/concepts/*.hpp>`.

Manually refactor numerous typedef-s
- where missed by modernize-use-using check, not uncommon
- in code snippets in comments

Outcome is that searching for lower-case whole word typedef
in all the top-level core headers should return no matches.
2018-12-15 19:10:30 +01:00
Mateusz Łoskot
4616dc1bdc [numeric] Remove unused type alias from detail::correlate_rows_imp
Fix warning: typedef kernel_type locally defined but not used
[-Wunused-local-typedefs]
2018-12-15 01:03:43 +01:00
Samuel Debionne
6b0b66c0f2 Remove deprecated unary/binary_function (#191)
std::unary_function and std::binary_function are deprecated in C++11
and removed in C++17.
2018-12-14 22:58:55 +01:00
Mateusz Loskot
230158bd66 Fix const on return type not applied to pointee type of typedef (#190)
Replace png_structp and png_infop aliases with regular pointers to
to prevent type qualifiers ignored on function return type.
2018-12-14 08:12:45 +01:00
Mateusz Loskot
2250b7159c Fix conflicting definitions from io/dynamic_io_new.hpp and toolbox/dynamic_images.hpp (#185)
The problem appears to be due to the same definitions copied from one
part of the library to the other.
The definitions have been shuffled to fix the compilation,
but purely based on searching the code for what is used where,
thus without confidence where those belong by author's intention.

Fixes #183
2018-12-12 17:58:57 +01:00
Mateusz Loskot
e0288ece9e Apply clang-tidy modernize-use-nullptr (#180)
Used clang-tidy 7.0 with the command:

  run-clang-tidy.py \
      -header-filter='boost\/gil\/.*' \
      -checks='-*,modernize-use-nullptr' -fix

Update CONTRIBUTING.md on how to generate compile command
database and run clang-tidy.
2018-12-10 09:58:37 +01:00
Mateusz Loskot
682a7264da Include missing headers across boost/gil/extension/io (#179)
Missing headers revealed by compilation of self-contained header tests.
2018-12-09 23:40:38 +01:00
Mateusz Loskot
032a4786bb Remove unnecessary extern C around libraw.h include (#178)
Since libraw is C++ library, not C, it is always built as C++ library.
2018-12-09 21:38:59 +01:00
Mateusz Loskot
057a02ad0a Replace writer<Device,jpeg_tag> where writer_backend<Device,jpeg_tag> expected (#177)
The reference to `writer<Device,jpeg_tag>` is clearly incorrect:
- writer has no members `init_device`, `empty_buffer`, `closed_buffer`
- if use of writer was correct there, it would require
  `#include <boost/gil/extension/io/jpeg/detail/writer.hpp>`, but that
  would impose cyclic-dependency between writer.hpp and writer_backend.hpp.
2018-12-09 15:45:51 +01:00
Mateusz Łoskot
8c26143574 Add missing #include <boost/gil/extension/io/*/tags.hpp>
Fixes compilation error about undeclared *_tag.
2018-12-08 22:20:58 +01:00
Mateusz Łoskot
a0b5767392 Add missing #include <boost/gil/extension/io/raw/tags.hpp>
Fixes compilation error about undeclared raw_tag.
2018-12-08 12:10:59 +01:00
Mateusz Loskot
63e2a1a98a Fix compile-time bugs subchroma_image.hpp definions (#164)
Add missing typename in mpl::if_ condition result.
Restore BOOST_CXX14_CONSTEXPR in boost::algorithm::clamp function
- apparently, GCC 5.5.0 does not compile it with C++11 constexpr.
Still not adding subchroma_image.cpp to toolbox test target
input sources due to run-time failure.

Depends on #176
2018-12-07 23:55:13 +01:00
Mateusz Loskot
443eaa5fae Fix compilation of subchroma_image.hpp as self-contained headers (#176)
Rename `Scaling_Factors` to lower-case, as well as its template parameters.
Move `scaling_factors` to namespace `detail` and before it is use.
Fix access to `scaling_factors` members in derived classes.
Add missing `typename`.
Remove superfluous thus incorrect `typename`.
Remove `subchroma_image_view` implicit friends with self
- Fixes template parameter aliasing for Locator and Factors.

Subset of fixes from pending PR #164
2018-12-07 16:00:17 +01:00
Mateusz Loskot
9e9ed7c239 Add missing #include-s to ensure self-contained headers (#175) 2018-12-07 09:50:52 +01:00
Mateusz Loskot
40241a6efb Reformat boost/gil/concepts/*.hpp to limit line length to 90 characters (#173)
Replace `typedef` with using declaration.
Replace complex return type declared for functions with trailing return type and `auto`.
Format complex metaprogramming constructs in clear and readable way.
Remove superfluous `public` access specifier from `struct` inheritance.
Rename ambiguous type aliases.
Make template parameters
- upper-case (if initials e.g. `CS`)
- camel-case if multi-word (e.g. `ColorSpace`).
2018-12-06 19:11:58 +01:00
Mateusz Loskot
66bb07d02b Trim trailing whitespaces in all source code files (#171)
PowerShell script used to perform the trimming:

Get-ChildItem -Recurse -Include @("*.cpp", "*.hpp") |
  ForEach-Object { (Get-Content $_.FullName)
      | Foreach {$_.TrimEnd()} | Set-Content $_.FullName }
2018-12-05 08:51:33 +01:00
Mateusz Loskot
7b5b01ec14 Split single boost/gil/concepts.hpp into boost/gil/concepts/*.hpp (#169) 2018-11-17 23:36:29 +01:00
Mateusz Łoskot
28df5bc482 Clean up several warnings about unreferenced formal parameters
Add comment to premultiply.hpp:
- FIXME: Is c input paramater not used intentionally?
2018-10-29 15:26:53 +01:00
Mateusz Loskot
3947b798fb Remove dependency on boost/algorithm/clamp.hpp (#159)
Copy boost::algorithm::clamp to where it was solely used in Toolbox.
Remove typename where not needed thus not allowed:
- fixes error: expected nested-name-specifier
- GCC and clang issue diagnostics; latest MSVC does not, seems not even
  parsing templates until they are used.
2018-10-29 13:48:15 +01:00
Mateusz Loskot
a1c966dd9b Fix point<T> divide and multiply to not to hardcode result as point<double> (#157)
The free variants of operator/ and operator* now yield new
type of point<T> with T promoted to type common for both operands.

Add missing member operator*=, for symmetry.
Add template function iround(point<T>) as no-op sink for point
specialisations for T of integer types.
Add explicit casts of arithmetic intermediate results to avoid
compilation warnings.
Replace redundant point<T> construction in return statement with uniform
initialization.
Add static_assert validating range of axis_value integer template parameter.

Update test/point/point.cpp with basic checks of all point<T> members.

Fixes #153
2018-10-24 15:08:39 +02:00
Mateusz Loskot
c1e590591d Remove dependency on boost/config/no_tr1/cmath.hpp (#162) 2018-10-24 10:53:47 +02:00
Mateusz Loskot
e286137e55 Remove dependency on boost/algorithm/string.hpp as unused (#158) 2018-10-24 09:42:17 +02:00
Mateusz Łoskot
3b8398f17c Fix version.hpp include guard name [ci skip] 2018-10-22 15:05:21 +02:00
Mateusz Loskot
ce82941fa2 Rename point2<T> to point<T> (#155)
Add point2<T> alias template for backward compatibility with Boost <=1.68.
Replace multiple point_t aliases of point<ptrdiff_t> with single defined
in point.hpp. The point_t is common used to represent dimensions.
Replace many uses of point<ptrdiff_t> with point_t.

Apply reformatting around point2 changes to respect the line length limit.

Follows up discussion in #154
2018-10-19 09:32:23 +02:00
Mateusz Loskot
b4c3a69479 Extract point2<T> from utilities.hpp to point.hpp (#154)
The point belongs to core basic concepts in GIL, not an optional
utility. The tutorial starts with description of point.
Such core concepts are defined in dedicated headers which is quite
a useful convention that also makes the code structure clearer.

Remove from trivial point2 class superfluous empty destructor,
copy constructor, assignment operator.

Clean up point.hpp formatting (eg. respect line length limit).

Co-authored-by: Nikita Kniazev @Kojoley
2018-10-18 21:38:14 +02:00
Mateusz Łoskot
875136885a Fix conflict with std::fill_n and boost::range::fill_n (Trac 7189)
Add minimal test for the std::fill and boost::array or std::array as
pixel type.
2018-10-12 18:34:28 +02:00
Mateusz Loskot
aa323e1dc6 Merge pull request #146 from mloskot/ml/fix-some-gcc-warnings
Fix some gcc warnings
2018-10-04 20:29:44 +02:00
Mateusz Łoskot
244be70c1d Add #include directives with missing headers
Make core and io headers self-contained.
Required by test to verify headers are self-contained in #147.
2018-10-03 23:27:57 +02:00
Mateusz Łoskot
ed96c9cdf1 Use GCC pragma to disable -Wconversion and -Wfloat-equal
Fixes warnings where equality or assignment operators
applied to operands of different signedness or float-point.
2018-09-28 23:36:27 +02:00
Mateusz Łoskot
4bd625ff31 Replace unsigned with signed for int as compile-time index 2018-09-28 23:30:35 +02:00
Mateusz Łoskot
32fec9f05b Refactor library includes to #include <boost/gil/...>
Group include directives, sort within group:
* In headers of GIL core and extensions:
  1. boost/gil/extension/*
  2. boost/gil/*
  3. boost/*
  4. C++ standard library headers
* In programs:
  1. boost/gil/*
  2. boost/*
  3. C++ standard library headers
  4. "xxx.hpp" for local headers
Add basic guidelines to CONTRIBUTING.md.
Add/Remove #include <boost/config.hpp> or std headers un/necessary.
Rename gil_concept.hpp to concepts.hpp.
Remove gil_all.hpp - we already have all-in-one boost/gil.hpp.
Tidy up and unify copyright and license header.
Tidy up formatting and excessive whitespaces in some comments.
Remove Doxygen block with file description, author, date, etc.
Remove dead or commented pragmas and directives.
Trim trailing whitespaces.
2018-09-28 16:26:34 +02:00
Mateusz Łoskot
c3bb2e1a94 Remove gil_config.hpp as unnecessary
Move BOOST_GIL_CONFIG_HAS_UNALIGNED_ACCESS define setting and
documentation comment to channel.hpp where solely used.

Trim trailing whitespaces.
2018-09-27 15:38:40 +02:00
Mateusz Loskot
7f0c223ddc Merge pull request #128 from mloskot/ml/trac-ticket-2979
Correct description of image_is_basic metafunction (Trac 2979)
2018-09-24 20:29:36 +02:00
Mateusz Loskot
7a5bd6986e Merge pull request #139 from mloskot/ml/trac-ticket-7092
Remove re-assignment of functor from for_each_pixel (Trac 7092)
2018-09-23 21:26:07 +02:00
Mateusz Loskot
dd862cefb9 Merge pull request #138 from mloskot/ml/fix-toolbox-get_num_bits-as-unsigned
Base get_num_bits metafunction for T on mpl::size_t instead of mpl::int_
2018-09-23 21:08:28 +02:00
Mateusz Loskot
11a84bf05c Merge pull request #134 from mloskot/ml/fix-warning-float-equal
Fix warning: comparing floating point with == is unsafe
2018-09-23 21:07:23 +02:00
Mateusz Łoskot
f613cc4088 Remove re-assignment of functor from for_each_pixel (Trac 7092)
The assignment was superfluous in general case and incorrect in specific
case when the algorithm was given a lambda expression.
The copy assignment operator is defined as deleted for lambda
expressions.

Add minimal test for for_each_pixel algorithm to verify it compiles with
lambda expression.
2018-09-21 18:50:40 +02:00
Mateusz Łoskot
79f01a4d35 Fix warning: comparing floating point with == is unsafe
Trick compiler by using >= instead of ==,
where LHS color is guaranteed to never be greater than RHS color value.
2018-09-19 18:58:29 +02:00
Mateusz Łoskot
5d189679fb Base get_num_bits metafunction for T on mpl::size_t instead of mpl::int_
Previously used mpl::int_ assumes signed integer, while sizeof(T) is
unsigned and compiler issues warning.
2018-09-19 18:58:06 +02:00
Mateusz Łoskot
18d5ecb7a8 Rename JPEG-s reader_backend::buffer member array to buffer_
The previous name is too generic and prone to variable shadowing,
causing compilation warnings (eg. vector named buffer in JPEG-s
reader::read_rows method).
2018-09-19 18:53:52 +02:00
Mateusz Łoskot
b1eaa7ea90 Update image_view to model Collection concept (Trac 2222)
* Applies patch from John Femiani submitted via Trac
  https://svn.boost.org/trac10/ticket/2222 description:
  It would be convenient if GIL views modeled ReversibleCollection concept.
  In fact they almost do already. Without modeling this concept, it is
  hard to use an image view with boost::range algorithms.
* Add related image_view concepts for Collection, ForwardCollection,
  ReversibleCollection.
* Add tests for the new concepts.
* Add run-time tests for the new image_view methods.
2018-08-29 22:10:18 +02:00
Mateusz Loskot
ee4d239513 Merge pull request #132 from mloskot/ml/fix-warning-unused-variable
Fix warning about assigned but unused variable num_elements
2018-08-27 09:12:06 +02:00
Mateusz Łoskot
871b7b6897 Fix warning about assigned but unused variable num_elements 2018-08-25 22:54:29 +02:00
Mateusz Łoskot
4500543a74 Add missing template keyword prior to dependent name axis_iterator (Trac 8896)
* Apply patch from https://svn.boost.org/trac10/ticket/8896
* Add compile-time test of RandomAccessNDImageViewConcept
  * Confirms the reported failure (tested with GCC 7.3 and clang 5.0)
  * Verifies correctness of the patch
2018-08-23 16:05:38 +02:00
Mateusz Łoskot
cff6966020 Correct description of image_is_basic metafunction (Trac 2979) [ci skip]
https://svn.boost.org/trac10/ticket/2979 description:

The description of the metafunction boost::gil::image_is_basic says that
it will return mpl::true_ if the image uses a basic view and
std::allocator<unsigned char>, however the implementation returns true
for any kind images that use any kind of allocator.
2018-08-23 11:38:18 +02:00
Mikhail Gorbushin
eebe183375 remove std::bind2nd 2018-08-21 09:40:55 -04:00
Stefan Seefeld
56c2389500 Fix (some) warnings. 2018-07-29 13:50:25 -04:00
Jan Beich
48643aa038 Don't use non-standard header for alloca()
In file included from /usr/local/include/boost/gil/extension/io/png/read.hpp:29:
In file included from /usr/local/include/boost/gil/io/get_reader.hpp:22:
In file included from /usr/local/include/boost/gil/io/get_read_device.hpp:26:
In file included from /usr/local/include/boost/gil/io/path_spec.hpp:23:
/usr/include/malloc.h:3:2: error: "<malloc.h> has been replaced by <stdlib.h>"
2018-07-20 14:17:23 +00:00
chhenning
e4af4fc2d6 Merge pull request #118 from adrianbroher/fix-png-grayalpha-load
Fix png grayalpha load
2018-07-18 17:37:49 -04:00