Workbook: big pile of rendering cleanups
[AROS.git] / workbench / system / Workbook / workbook_intern.c
blobb0f41e6f223f76a26bfd6a3cda8ba13260afdba7
1 /*
2 * Copyright (C) 2012, The AROS Development Team
3 * All right reserved.
4 * Author: Jason S. McMullan <jason.mcmullan@gmail.com>
6 * Licensed under the AROS PUBLIC LICENSE (APL) Version 1.1
7 */
8 #include <proto/graphics.h>
9 #include <proto/layers.h>
11 #include "workbook_intern.h"
13 struct Region *wbClipWindow(struct WorkbookBase *wb, struct Window *win)
15 struct Region *clip;
17 /* Install new clip region */
18 if ((clip = NewRegion())) {
19 struct Rectangle rect = {
20 .MinX = win->BorderLeft,
21 .MinY = win->BorderTop,
22 .MaxX = win->Width - win->BorderRight - 1,
23 .MaxY = win->Height - win->BorderBottom - 1,
25 if (!OrRectRegion(clip, &rect)) {
26 DisposeRegion(clip);
27 clip = NULL;
31 /* Install new clip region */
32 return InstallClipRegion(win->WLayer, clip);
35 void wbUnclipWindow(struct WorkbookBase *wb, struct Window *win, struct Region *clip)
37 clip = InstallClipRegion(win->WLayer, clip);
38 if (clip)
39 DisposeRegion(clip);