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
ceb46e19
Unverified
Commit
ceb46e19
authored
Dec 06, 2018
by
Rémi Verschelde
Committed by
GitHub
Dec 06, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #24090 from RandomShaper/fix-blit-from-negative
Fix blitting from negative position
parents
1691e2e5
6dc9a1b4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
image.cpp
core/image.cpp
+8
-4
No files found.
core/image.cpp
View file @
ceb46e19
...
@@ -1931,7 +1931,8 @@ void Image::blit_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const Po
...
@@ -1931,7 +1931,8 @@ void Image::blit_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const Po
if
(
clipped_src_rect
.
size
.
x
<=
0
||
clipped_src_rect
.
size
.
y
<=
0
)
if
(
clipped_src_rect
.
size
.
x
<=
0
||
clipped_src_rect
.
size
.
y
<=
0
)
return
;
return
;
Rect2i
dest_rect
=
Rect2i
(
0
,
0
,
width
,
height
).
clip
(
Rect2i
(
p_dest
,
clipped_src_rect
.
size
));
Point2
src_underscan
=
Point2
(
MIN
(
0
,
p_src_rect
.
position
.
x
),
MIN
(
0
,
p_src_rect
.
position
.
y
));
Rect2i
dest_rect
=
Rect2i
(
0
,
0
,
width
,
height
).
clip
(
Rect2i
(
p_dest
-
src_underscan
,
clipped_src_rect
.
size
));
PoolVector
<
uint8_t
>::
Write
wp
=
data
.
write
();
PoolVector
<
uint8_t
>::
Write
wp
=
data
.
write
();
uint8_t
*
dst_data_ptr
=
wp
.
ptr
();
uint8_t
*
dst_data_ptr
=
wp
.
ptr
();
...
@@ -1985,7 +1986,8 @@ void Image::blit_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, co
...
@@ -1985,7 +1986,8 @@ void Image::blit_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, co
if
(
clipped_src_rect
.
size
.
x
<=
0
||
clipped_src_rect
.
size
.
y
<=
0
)
if
(
clipped_src_rect
.
size
.
x
<=
0
||
clipped_src_rect
.
size
.
y
<=
0
)
return
;
return
;
Rect2i
dest_rect
=
Rect2i
(
0
,
0
,
width
,
height
).
clip
(
Rect2i
(
p_dest
,
clipped_src_rect
.
size
));
Point2
src_underscan
=
Point2
(
MIN
(
0
,
p_src_rect
.
position
.
x
),
MIN
(
0
,
p_src_rect
.
position
.
y
));
Rect2i
dest_rect
=
Rect2i
(
0
,
0
,
width
,
height
).
clip
(
Rect2i
(
p_dest
-
src_underscan
,
clipped_src_rect
.
size
));
PoolVector
<
uint8_t
>::
Write
wp
=
data
.
write
();
PoolVector
<
uint8_t
>::
Write
wp
=
data
.
write
();
uint8_t
*
dst_data_ptr
=
wp
.
ptr
();
uint8_t
*
dst_data_ptr
=
wp
.
ptr
();
...
@@ -2042,7 +2044,8 @@ void Image::blend_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const P
...
@@ -2042,7 +2044,8 @@ void Image::blend_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const P
if
(
clipped_src_rect
.
size
.
x
<=
0
||
clipped_src_rect
.
size
.
y
<=
0
)
if
(
clipped_src_rect
.
size
.
x
<=
0
||
clipped_src_rect
.
size
.
y
<=
0
)
return
;
return
;
Rect2i
dest_rect
=
Rect2i
(
0
,
0
,
width
,
height
).
clip
(
Rect2i
(
p_dest
,
clipped_src_rect
.
size
));
Point2
src_underscan
=
Point2
(
MIN
(
0
,
p_src_rect
.
position
.
x
),
MIN
(
0
,
p_src_rect
.
position
.
y
));
Rect2i
dest_rect
=
Rect2i
(
0
,
0
,
width
,
height
).
clip
(
Rect2i
(
p_dest
-
src_underscan
,
clipped_src_rect
.
size
));
lock
();
lock
();
Ref
<
Image
>
img
=
p_src
;
Ref
<
Image
>
img
=
p_src
;
...
@@ -2096,7 +2099,8 @@ void Image::blend_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, c
...
@@ -2096,7 +2099,8 @@ void Image::blend_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, c
if
(
clipped_src_rect
.
size
.
x
<=
0
||
clipped_src_rect
.
size
.
y
<=
0
)
if
(
clipped_src_rect
.
size
.
x
<=
0
||
clipped_src_rect
.
size
.
y
<=
0
)
return
;
return
;
Rect2i
dest_rect
=
Rect2i
(
0
,
0
,
width
,
height
).
clip
(
Rect2i
(
p_dest
,
clipped_src_rect
.
size
));
Point2
src_underscan
=
Point2
(
MIN
(
0
,
p_src_rect
.
position
.
x
),
MIN
(
0
,
p_src_rect
.
position
.
y
));
Rect2i
dest_rect
=
Rect2i
(
0
,
0
,
width
,
height
).
clip
(
Rect2i
(
p_dest
-
src_underscan
,
clipped_src_rect
.
size
));
lock
();
lock
();
Ref
<
Image
>
img
=
p_src
;
Ref
<
Image
>
img
=
p_src
;
...
...
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