Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
3cfb67e0
Unverified
Commit
3cfb67e0
authored
Jan 28, 2020
by
Rémi Verschelde
Committed by
GitHub
Jan 28, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #35647 from timothyqiu/image-ops
Fixes invalid writes in Image operations
parents
11b7f9fe
f7d4e6ef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
image.cpp
core/image.cpp
+5
-1
No files found.
core/image.cpp
View file @
3cfb67e0
...
...
@@ -421,6 +421,8 @@ void Image::convert(Format p_new_format) {
if
(
p_new_format
==
format
)
return
;
ERR_FAIL_COND_MSG
(
write_lock
.
ptr
(),
"Cannot convert image when it is locked."
);
if
(
format
>
FORMAT_RGBE9995
||
p_new_format
>
FORMAT_RGBE9995
)
{
ERR_FAIL_MSG
(
"Cannot convert to <-> from compressed formats. Use compress() and decompress() instead."
);
...
...
@@ -880,8 +882,8 @@ void Image::resize_to_po2(bool p_square) {
void
Image
::
resize
(
int
p_width
,
int
p_height
,
Interpolation
p_interpolation
)
{
ERR_FAIL_COND_MSG
(
data
.
size
()
==
0
,
"Cannot resize image before creating it, use create() or create_from_data() first."
);
ERR_FAIL_COND_MSG
(
!
_can_modify
(
format
),
"Cannot resize in compressed or custom image formats."
);
ERR_FAIL_COND_MSG
(
write_lock
.
ptr
(),
"Cannot resize image when it is locked."
);
bool
mipmap_aware
=
p_interpolation
==
INTERPOLATE_TRILINEAR
/* || p_interpolation == INTERPOLATE_TRICUBIC */
;
...
...
@@ -2063,6 +2065,7 @@ void Image::blit_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const Po
ERR_FAIL_COND
(
dsize
==
0
);
ERR_FAIL_COND
(
srcdsize
==
0
);
ERR_FAIL_COND
(
format
!=
p_src
->
format
);
ERR_FAIL_COND_MSG
(
!
_can_modify
(
format
),
"Cannot blit_rect in compressed or custom image formats."
);
Rect2i
clipped_src_rect
=
Rect2i
(
0
,
0
,
p_src
->
width
,
p_src
->
height
).
clip
(
p_src_rect
);
...
...
@@ -2283,6 +2286,7 @@ void Image::blend_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, c
}
void
Image
::
fill
(
const
Color
&
c
)
{
ERR_FAIL_COND_MSG
(
!
_can_modify
(
format
),
"Cannot fill in compressed or custom image formats."
);
lock
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment