hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/drm/drm_rect.h
....@@ -24,6 +24,8 @@
2424 #ifndef DRM_RECT_H
2525 #define DRM_RECT_H
2626
27
+#include <linux/types.h>
28
+
2729 /**
2830 * DOC: rect utils
2931 *
....@@ -70,6 +72,23 @@
7072 (r)->y1 >> 16, (((r)->y1 & 0xffff) * 15625) >> 10
7173
7274 /**
75
+ * drm_rect_init - initialize the rectangle from x/y/w/h
76
+ * @r: rectangle
77
+ * @x: x coordinate
78
+ * @y: y coordinate
79
+ * @width: width
80
+ * @height: height
81
+ */
82
+static inline void drm_rect_init(struct drm_rect *r, int x, int y,
83
+ int width, int height)
84
+{
85
+ r->x1 = x;
86
+ r->y1 = y;
87
+ r->x2 = x + width;
88
+ r->y2 = y + height;
89
+}
90
+
91
+/**
7392 * drm_rect_adjust_size - adjust the size of the rectangle
7493 * @r: rectangle to be adjusted
7594 * @dw: horizontal adjustment
....@@ -104,6 +123,20 @@
104123 r->y1 += dy;
105124 r->x2 += dx;
106125 r->y2 += dy;
126
+}
127
+
128
+/**
129
+ * drm_rect_translate_to - translate the rectangle to an absolute position
130
+ * @r: rectangle to be tranlated
131
+ * @x: horizontal position
132
+ * @y: vertical position
133
+ *
134
+ * Move rectangle @r to @x in the horizontal direction,
135
+ * and to @y in the vertical direction.
136
+ */
137
+static inline void drm_rect_translate_to(struct drm_rect *r, int x, int y)
138
+{
139
+ drm_rect_translate(r, x - r->x1, y - r->y1);
107140 }
108141
109142 /**
....@@ -147,7 +180,7 @@
147180 }
148181
149182 /**
150
- * drm_rect_visible - determine if the the rectangle is visible
183
+ * drm_rect_visible - determine if the rectangle is visible
151184 * @r: rectangle whose visibility is returned
152185 *
153186 * RETURNS:
....@@ -182,12 +215,6 @@
182215 int drm_rect_calc_vscale(const struct drm_rect *src,
183216 const struct drm_rect *dst,
184217 int min_vscale, int max_vscale);
185
-int drm_rect_calc_hscale_relaxed(struct drm_rect *src,
186
- struct drm_rect *dst,
187
- int min_hscale, int max_hscale);
188
-int drm_rect_calc_vscale_relaxed(struct drm_rect *src,
189
- struct drm_rect *dst,
190
- int min_vscale, int max_vscale);
191218 void drm_rect_debug_print(const char *prefix,
192219 const struct drm_rect *r, bool fixed_point);
193220 void drm_rect_rotate(struct drm_rect *r,