2 * Copyright (C) 2011-2013 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 * drm_rect - two dimensional rectangle
29 * @x1: horizontal starting coordinate (inclusive)
30 * @x2: horizontal ending coordinate (exclusive)
31 * @y1: vertical starting coordinate (inclusive)
32 * @y2: vertical ending coordinate (exclusive)
39 * drm_rect_adjust_size - adjust the size of the rectangle
40 * @r: rectangle to be adjusted
41 * @dw: horizontal adjustment
42 * @dh: vertical adjustment
44 * Change the size of rectangle @r by @dw in the horizontal direction,
45 * and by @dh in the vertical direction, while keeping the center
48 * Positive @dw and @dh increase the size, negative values decrease it.
50 static inline void drm_rect_adjust_size(struct drm_rect
*r
, int dw
, int dh
)
54 r
->x2
+= (dw
+ 1) >> 1;
55 r
->y2
+= (dh
+ 1) >> 1;
59 * drm_rect_translate - translate the rectangle
60 * @r: rectangle to be tranlated
61 * @dx: horizontal translation
62 * @dy: vertical translation
64 * Move rectangle @r by @dx in the horizontal direction,
65 * and by @dy in the vertical direction.
67 static inline void drm_rect_translate(struct drm_rect
*r
, int dx
, int dy
)
76 * drm_rect_downscale - downscale a rectangle
77 * @r: rectangle to be downscaled
78 * @horz: horizontal downscale factor
79 * @vert: vertical downscale factor
81 * Divide the coordinates of rectangle @r by @horz and @vert.
83 static inline void drm_rect_downscale(struct drm_rect
*r
, int horz
, int vert
)
92 * drm_rect_width - determine the rectangle width
93 * @r: rectangle whose width is returned
96 * The width of the rectangle.
98 static inline int drm_rect_width(const struct drm_rect
*r
)
100 return r
->x2
- r
->x1
;
104 * drm_rect_height - determine the rectangle height
105 * @r: rectangle whose height is returned
108 * The height of the rectangle.
110 static inline int drm_rect_height(const struct drm_rect
*r
)
112 return r
->y2
- r
->y1
;
116 * drm_rect_visible - determine if the the rectangle is visible
117 * @r: rectangle whose visibility is returned
120 * %true if the rectangle is visible, %false otherwise.
122 static inline bool drm_rect_visible(const struct drm_rect
*r
)
124 return drm_rect_width(r
) > 0 && drm_rect_height(r
) > 0;
127 bool drm_rect_intersect(struct drm_rect
*r
, const struct drm_rect
*clip
);
128 bool drm_rect_clip_scaled(struct drm_rect
*src
, struct drm_rect
*dst
,
129 const struct drm_rect
*clip
,
130 int hscale
, int vscale
);
This page took 0.033249 seconds and 5 git commands to generate.