Commit graph

164 commits

Author SHA1 Message Date
Haoyu Qiu
91ea7530bd
Validates the p_format parameter in Image::create functions.
(cherry picked from commit 0b7ffd4f68)
2021-06-29 14:02:23 +02:00
Paweł Fertyk
2676d815ab
Validate image formats, check if resize_to_po2 failed
(cherry picked from commit 3dae9993ac)
2021-06-29 14:02:23 +02:00
Marcel Admiraal
7e03bd1671 Remove duplicate WARN_PRINTS macro 2021-06-18 12:57:59 +01:00
Morris Tabor
5de08ef1d6 Implement lossless WebP encoding 2021-06-11 18:48:04 +02:00
Rémi Verschelde
140350d767
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2021-05-05 15:02:01 +02:00
Rémi Verschelde
b4af1eba0a
Style: Enforce use of bool literals instead of integers
Using clang-tidy's `modernize-use-bool-literals`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html
2021-05-04 16:39:13 +02:00
Rémi Verschelde
a828398655
Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2021-05-04 16:30:23 +02:00
Rémi Verschelde
b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde
64a63e0861
Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde
3d15f04668
Style: clang-format: Disable AllowShortIfStatementsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde
70ae90e0e8
Core: Drop custom copymem/zeromem defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.

Backport of #48239.
2021-04-29 12:34:11 +02:00
Haoyu Qiu
0a17e96ab2 Fix invalid memory usage when modifying locked image 2021-03-16 13:45:45 +08:00
Rémi Verschelde
49646383f1
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Theogen Ratkin
8f6a6ac8d0 Add interpolation parameter to resize_to_po2()
Image::resize_to_po2() now takes an optional p_interpolation parameter
that it passes directly to resize() with default value INTERPOLATE_BILINEAR.

GLES2: call resize_to_po2() with interpolate argument

Call resize_to_po2() in GLES2 rasterizer storage with either
INTERPOLATE_BILINEAR or INTERPOLATE_NEAREST depending on TEXTURE_FLAG_FILTER.

This avoids filtering issues with non power of two pixel art textures.
See #44379
2020-12-18 14:02:38 -04:00
Hugo Locurcio
7db872b55a
Add Image.load_bmp_from_buffer() for run-time BMP image loading
This partially addresses
https://github.com/godotengine/godot-proposals/issues/676.

(cherry picked from commit 0209e3790e)
2020-11-11 15:30:55 +01:00
Marcel Schneider
c62ce03679 Make sure that a new image can only be created when the buffer is not currently locked 2020-08-05 20:55:31 +02:00
Rémi Verschelde
8e6dd3191f Image: Improve error messages for invalid creation size
(cherry picked from commit b5488def47)
2020-07-03 15:34:30 +02:00
Paul Herman
850f07a4d9 Expose loading TGA images in Image.
(cherry picked from commit 7d4b3e6587)
2020-07-03 13:17:57 +02:00
Maganty Rushyendra
afac2514f8 Fix upscaling image with bilinear interpolation option specified
Fix error in calculation of 4 nearest points in source image when
resizing image with bilinear interpolation.

(cherry picked from commit f24ec3878e)
2020-06-24 22:52:05 +02:00
azagaya
a6d8773d0b Fixing wrong blending rect methods
Using Color.blend function instead of custom code

Fixed clang_format

Removed unnecessary help

(cherry picked from commit b211a86ebe)
2020-06-10 15:30:51 +02:00
Andrii Doroshenko (Xrayez)
a3cad44f44 Add Image.save_png_to_buffer method
Backported from da0457fa29.

This commit additionally exposes the method to scripting (4.0).
2020-05-20 15:38:20 +03:00
Vasiliy Makarov
982dee67f0 Fix square image resize
Fixes #37980

(cherry picked from commit d45e8734d1)
2020-04-21 14:11:43 +02:00
clayjohn
2c0d391c48 Force mipmaps off when importing RGBA4444 textures 2020-02-29 19:23:56 -08:00
Haoyu Qiu
f7d4e6ef6b Fixes invalid writes in Image operations 2020-01-28 13:47:28 +08:00
Eric Rybicki
439e0027ec Fix AtlasPacker ignoring semi-transparent pixels
Fixes #33106
2020-01-20 22:43:38 +01:00
clayjohn
7a9fc69a16 Fallback to RGBA4444 for textures with alpha set to ETC compression 2020-01-02 21:37:48 -08:00
Rémi Verschelde
a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Rafał Mikrut
9ddb3265e1 Fix some crashes, overflows and using variables without values 2019-11-01 16:16:31 +01:00
Hanif Bin Ariffin
f8c2b64c99 Fixed uinitialized variable in srgb_to_linear table
Old array's size was actually 255.

Fixes #33133
2019-10-30 08:34:30 -04:00
Rafał Mikrut
e53e1c566a Fix some crashes and using null pointers 2019-10-28 08:07:29 +01:00
qarmin
17732fe698 Added some obvious errors explanations 2019-09-25 10:28:50 +02:00
Andrii Doroshenko (Xrayez)
c362527cb5 Modify outdated comments and error messages regarding indexed images
Godot doesn't support indexed images anymore (FORMAT_INDEXED),
so those are removed to avoid any confusion.
2019-08-26 18:21:19 +03:00
Braden Bodily
71d71d55b5 Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'core/' and 'editor/'
Condensed some if and ERR statements. Added dots to end of error messages

Couldn't figure out EXPLAINC. These files gave me trouble: core/error_macros.h, core/io/file_access_buffered_fa.h (where is it?),
core/os/memory.cpp,
drivers/png/png_driver_common.cpp,
drivers/xaudio2/audio_driver_xaudio2.cpp (where is it?)
2019-08-17 12:33:15 +02:00
Davide Busterna
5ba632a73b Fix image offset when upscaling with Lanczos 2019-08-15 10:54:38 +02:00
Marc Gilleron
cd2de77b04 Add Image.save_exr() 2019-08-07 21:17:47 +01:00
qarmin
6cbaf7662f Changed some code showed in LGTM and Coverage 2019-07-20 08:09:57 +02:00
Ibrahn Sahir
4e4697b1c4 Added release function to PoolVector::Access.
For clarity, assign-to-release idiom for PoolVector::Read/Write
replaced with a function call.
Existing uses replaced (or removed if already handled by scope)
2019-07-06 12:04:27 +01:00
Rémi Verschelde
6b30f284a0
Merge pull request #29980 from Dentrax/directed-by-qarmin
Fix some editor crashes
2019-07-01 14:59:29 +02:00
Furkan Türkal
7d8d337b2c fix some crashes 2019-07-01 14:28:29 +03:00
qarmin
3c154eb93b Remove unnecessary code and add some error explanations 2019-07-01 12:59:42 +02:00
qarmin
4e5310cc60 Some code changed with Clang-Tidy 2019-06-26 15:08:25 +02:00
qarmin
2b4e828b55 Fix array overflow when saving scene preview 2019-05-31 13:22:22 +02:00
Daw11
28bff3d1ad Implement Lanczos image filter 2019-05-05 14:03:56 +02:00
Juan Linietsky
04847ef5f9 Added ability for multiple images to be imported as an atlas
This adds support for groups in the import system, which point to a single file.
Add property hint for saving files in file field
2019-04-19 15:56:34 -03:00
Rémi Verschelde
c8994b56f9 Style: Apply new changes from clang-format 8.0
It seems to stay compatible with formatting done by clang-format 6.0 and 7.0,
so contributors can keep using those versions for now (they will not undo those
changes).
2019-04-09 17:09:48 +02:00
Juan Linietsky
6cb841edcb Ensure ETC2 textures are ALSO compressed to Po2 when have mipmaps. Fixes #26733 2019-03-07 12:16:20 -03:00
marxin
8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
Rémi Verschelde
1772d6fa23 Image: Fix decompressing ETC2
Thanks to @Rriik for finding the bug and its cause.

Fixes #25595.
2019-02-08 17:26:47 +01:00
Rémi Verschelde
cc0842f9a6 Prevent upscaled SVG from exceeding Image bounds
Also expose Image MAX_WIDTH and MAX_HEIGHT.

Fixes #24455.
2019-01-28 16:00:15 +01:00
Rémi Verschelde
b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00