2013-09-13 06:01:21 +04:00
|
|
|
/*
|
|
|
|
* Copyright © 2012 Intel Corporation
|
|
|
|
*
|
2015-06-12 01:35:43 +03:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
2013-09-13 06:01:21 +04:00
|
|
|
*
|
2015-06-12 01:35:43 +03:00
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
* next paragraph) shall be included in all copies or substantial
|
|
|
|
* portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
2013-09-13 06:01:21 +04:00
|
|
|
*/
|
|
|
|
#ifndef _WESTON_VERTEX_CLIPPING_H
|
|
|
|
#define _WESTON_VERTEX_CLIPPING_H
|
|
|
|
|
2022-02-09 20:17:42 +03:00
|
|
|
#include <libweston/matrix.h>
|
|
|
|
|
2013-09-13 06:01:21 +04:00
|
|
|
struct polygon8 {
|
2022-02-09 20:17:42 +03:00
|
|
|
struct weston_coord pos[8];
|
2013-09-13 06:01:21 +04:00
|
|
|
int n;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct clip_context {
|
|
|
|
struct {
|
2013-11-27 16:22:42 +04:00
|
|
|
float x;
|
|
|
|
float y;
|
2013-09-13 06:01:21 +04:00
|
|
|
} prev;
|
|
|
|
|
|
|
|
struct {
|
2013-11-27 16:22:42 +04:00
|
|
|
float x1, y1;
|
|
|
|
float x2, y2;
|
2013-09-13 06:01:21 +04:00
|
|
|
} clip;
|
|
|
|
|
2022-02-09 20:17:42 +03:00
|
|
|
struct weston_coord *vertices;
|
2013-09-13 06:01:21 +04:00
|
|
|
};
|
|
|
|
|
2013-11-27 16:22:42 +04:00
|
|
|
float
|
|
|
|
float_difference(float a, float b);
|
2013-09-13 06:01:21 +04:00
|
|
|
|
|
|
|
int
|
|
|
|
clip_simple(struct clip_context *ctx,
|
|
|
|
struct polygon8 *surf,
|
2022-02-09 20:17:42 +03:00
|
|
|
struct weston_coord *e);
|
2013-09-13 06:01:21 +04:00
|
|
|
|
|
|
|
int
|
|
|
|
clip_transformed(struct clip_context *ctx,
|
|
|
|
struct polygon8 *surf,
|
2022-02-09 20:17:42 +03:00
|
|
|
struct weston_coord *e);
|
2013-09-13 06:01:21 +04:00
|
|
|
|
|
|
|
#endif
|