Author: fireball
Date: Wed Nov 11 20:23:49 2009
New Revision: 44108
URL:
http://svn.reactos.org/svn/reactos?rev=44108&view=rev
Log:
- Move region structure definition to user.h.
- Implement creating a region from RECTL array.
Modified:
branches/arwinss/reactos/subsystems/win32/win32k/include/user.h
branches/arwinss/reactos/subsystems/win32/win32k/wine/region.c
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/user.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/user.h [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/user.h [iso-8859-1] Wed Nov
11 20:23:49 2009
@@ -64,6 +64,14 @@
unsigned int users; /* processes and threads using this desktop */
};
+struct region
+{
+ int size;
+ int num_rects;
+ rectangle_t *rects;
+ rectangle_t extents;
+};
+
/* user handles functions */
extern user_handle_t alloc_user_handle( void *ptr, enum user_object type );
@@ -105,6 +113,7 @@
extern struct region *create_empty_region(void);
extern struct region *create_region_from_req_data( const void *data, data_size_t size );
+extern struct region *create_region_from_rects( const void *data, unsigned long count );
extern void free_region( struct region *region );
extern void set_region_rect( struct region *region, const rectangle_t *rect );
extern rectangle_t *get_region_data( const struct region *region, data_size_t max_size,
Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/region.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/wine/region.c [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/region.c [iso-8859-1] Wed Nov 11
20:23:49 2009
@@ -84,14 +84,6 @@
#define NDEBUG
#include <debug.h>
-struct region
-{
- int size;
- int num_rects;
- rectangle_t *rects;
- rectangle_t extents;
-};
-
#define RGN_DEFAULT_RECTS 2
@@ -615,6 +607,39 @@
return region;
}
+/* create a region from request data */
+struct region *create_region_from_rects( const void *data, unsigned long nb_rects )
+{
+ unsigned int alloc_rects;
+ struct region *region;
+ const RECTL *rects = data;
+ int i;
+
+ /* special case: empty region can be specified by a single all-zero rectangle */
+ if (nb_rects == 1 && rects->left == 0 && rects->top == 0
&&
+ rects->right == 0 && rects->bottom == 0) nb_rects = 0;
+
+ if (!(region = mem_alloc( sizeof(*region) ))) return NULL;
+
+ alloc_rects = max( nb_rects, RGN_DEFAULT_RECTS );
+ if (!(region->rects = mem_alloc( alloc_rects * sizeof(*region->rects) )))
+ {
+ ExFreePool( region );
+ return NULL;
+ }
+ region->size = alloc_rects;
+ region->num_rects = nb_rects;
+ for (i=0; i<region->num_rects; i++)
+ {
+ region->rects[i].left = rects[i].left;
+ region->rects[i].top = rects[i].top;
+ region->rects[i].right = rects[i].right;
+ region->rects[i].bottom = rects[i].bottom;
+ }
+ set_region_extents( region );
+ return region;
+}
+
/* free a region */
void free_region( struct region *region )
{