Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
5e384549
Commit
5e384549
authored
Dec 30, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the ability to update a subrect of a YV12/IYUV texture.
parent
98615b55
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
8 deletions
+41
-8
SDL_yuv_sw.c
src/render/SDL_yuv_sw.c
+41
-8
No files found.
src/render/SDL_yuv_sw.c
View file @
5e384549
...
...
@@ -1119,15 +1119,48 @@ SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
switch
(
swdata
->
format
)
{
case
SDL_PIXELFORMAT_YV12
:
case
SDL_PIXELFORMAT_IYUV
:
if
(
rect
&&
(
rect
->
x
!=
0
||
rect
->
y
!=
0
||
rect
->
w
!=
swdata
->
w
||
rect
->
h
!=
swdata
->
h
))
{
SDL_SetError
(
"YV12 and IYUV textures only support full surface updates"
);
return
-
1
;
if
(
rect
->
x
==
0
&&
rect
->
y
==
0
&&
rect
->
w
==
swdata
->
w
&&
rect
->
h
==
swdata
->
h
)
{
SDL_memcpy
(
swdata
->
pixels
,
pixels
,
(
swdata
->
h
*
swdata
->
w
)
+
(
swdata
->
h
*
swdata
->
w
)
/
2
);
}
else
{
Uint8
*
src
,
*
dst
;
int
row
;
size_t
length
;
/* Copy the Y plane */
src
=
(
Uint8
*
)
pixels
;
dst
=
swdata
->
pixels
+
rect
->
y
*
swdata
->
w
+
rect
->
x
;
length
=
rect
->
w
;
for
(
row
=
0
;
row
<
rect
->
h
;
++
row
)
{
SDL_memcpy
(
dst
,
src
,
length
);
src
+=
pitch
;
dst
+=
swdata
->
w
;
}
/* Copy the next plane */
src
=
(
Uint8
*
)
pixels
+
rect
->
h
*
pitch
;
dst
=
swdata
->
pixels
+
swdata
->
h
*
swdata
->
w
;
dst
+=
rect
->
y
/
2
*
swdata
->
w
/
2
+
rect
->
x
/
2
;
length
=
rect
->
w
/
2
;
for
(
row
=
0
;
row
<
rect
->
h
/
2
;
++
row
)
{
SDL_memcpy
(
dst
,
src
,
length
);
src
+=
pitch
/
2
;
dst
+=
swdata
->
w
/
2
;
}
/* Copy the next plane */
src
=
(
Uint8
*
)
pixels
+
rect
->
h
*
pitch
+
(
rect
->
h
*
pitch
)
/
4
;
dst
=
swdata
->
pixels
+
swdata
->
h
*
swdata
->
w
+
(
swdata
->
h
*
swdata
->
w
)
/
4
;
dst
+=
rect
->
y
/
2
*
swdata
->
w
/
2
+
rect
->
x
/
2
;
length
=
rect
->
w
/
2
;
for
(
row
=
0
;
row
<
rect
->
h
/
2
;
++
row
)
{
SDL_memcpy
(
dst
,
src
,
length
);
src
+=
pitch
/
2
;
dst
+=
swdata
->
w
/
2
;
}
}
SDL_memcpy
(
swdata
->
pixels
,
pixels
,
(
swdata
->
h
*
swdata
->
w
)
+
(
swdata
->
h
*
swdata
->
w
)
/
2
);
break
;
case
SDL_PIXELFORMAT_YUY2
:
case
SDL_PIXELFORMAT_UYVY
:
...
...
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