Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mutter
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Marco Trevisan
mutter
Commits
d574cf59
Commit
d574cf59
authored
Jan 05, 2019
by
Robert Mader
Committed by
Jonas Ådahl
Feb 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
boxes: Add API to crop and scale a MetaRectangle
https://gitlab.gnome.org/GNOME/mutter/merge_requests/323
parent
47402d84
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
src/core/boxes-private.h
src/core/boxes-private.h
+6
-0
src/core/boxes.c
src/core/boxes.c
+16
-0
No files found.
src/core/boxes-private.h
View file @
d574cf59
...
...
@@ -274,4 +274,10 @@ void meta_rectangle_transform (const MetaRectangle *rect,
int
height
,
MetaRectangle
*
dest
);
void
meta_rectangle_crop_and_scale
(
const
MetaRectangle
*
rect
,
ClutterRect
*
src_rect
,
int
dst_width
,
int
dst_height
,
MetaRectangle
*
dest
);
#endif
/* META_BOXES_PRIVATE_H */
src/core/boxes.c
View file @
d574cf59
...
...
@@ -33,6 +33,7 @@
#include "backends/meta-monitor-transform.h"
#include "core/boxes-private.h"
#include <math.h>
#include <X11/Xutil.h>
#include "meta/util.h"
...
...
@@ -2149,3 +2150,18 @@ meta_rectangle_transform (const MetaRectangle *rect,
break
;
}
}
void
meta_rectangle_crop_and_scale
(
const
MetaRectangle
*
rect
,
ClutterRect
*
src_rect
,
int
dst_width
,
int
dst_height
,
MetaRectangle
*
dest
)
{
dest
->
x
=
floorf
(
rect
->
x
*
(
src_rect
->
size
.
width
/
dst_width
)
+
src_rect
->
origin
.
x
);
dest
->
y
=
floorf
(
rect
->
y
*
(
src_rect
->
size
.
height
/
dst_height
)
+
src_rect
->
origin
.
y
);
dest
->
width
=
ceilf
(
rect
->
width
*
(
src_rect
->
size
.
width
/
dst_width
));
dest
->
height
=
ceilf
(
rect
->
height
*
(
src_rect
->
size
.
height
/
dst_height
));
}
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