* Added KMessage to libroot_build.

* libbe_build: Where possible we directly use the actual Haiku headers and
  sources, now. In the headers/build headers we just include the respective
  Haiku headers as needed. That still allows overrides where necessary. The
  intention is to make it easier to keep the build stuff in sync.
* Fixed a few printf() format and signed/unsigned comparison warnings.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42179 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2011-06-14 11:42:49 +00:00
parent 45ec6bf344
commit 4cc4f7bb18
100 changed files with 136 additions and 20869 deletions
+1 -152
View File
@@ -1,152 +1 @@
/* $Xorg: region.h,v 1.4 2001/02/09 02:03:40 xorgcvs Exp $ */
/************************************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice 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
OPEN GROUP 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.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
************************************************************************/
#ifndef __REGION_SUPPORT_H
#define __REGION_SUPPORT_H
#include <Region.h>
class BRegion::Support {
public:
static int XUnionRegion(const BRegion* reg1,
const BRegion* reg2, BRegion* newReg);
static int XIntersectRegion(const BRegion* reg1,
const BRegion* reg2, BRegion* newReg);
static int XSubtractRegion(const BRegion* regM,
const BRegion* regS, BRegion* regD);
static int XXorRegion(const BRegion* sra,
const BRegion* srb, BRegion* dr);
static int XPointInRegion(const BRegion* region,
int x, int y);
enum {
RectangleOut = 0,
RectanglePart = 1,
RectangleIn = 2
};
static int XRectInRegion(const BRegion* region,
const clipping_rect& rect);
private:
static BRegion* CreateRegion();
static void DestroyRegion(BRegion* r);
static void XOffsetRegion(BRegion* pRegion, int x, int y);
static void miSetExtents(BRegion* pReg);
static int miIntersectO(BRegion* pReg,
clipping_rect* r1, clipping_rect* r1End,
clipping_rect* r2, clipping_rect* r2End,
int top, int bottom);
static void miRegionCopy(BRegion* dstrgn, const BRegion* rgn);
static int miCoalesce(BRegion* pReg,
int prevStart, int curStart);
static int miUnionNonO(BRegion* pReg, clipping_rect* r,
clipping_rect* rEnd, int top, int bottom);
static int miUnionO(BRegion* pReg,
clipping_rect* r1, clipping_rect* r1End,
clipping_rect* r2, clipping_rect* r2End,
int top, int bottom);
static int miSubtractO(BRegion* pReg,
clipping_rect* r1, clipping_rect* r1End,
clipping_rect* r2, clipping_rect* r2End,
int top, int bottom);
static int miSubtractNonO1(BRegion* pReg,
clipping_rect* r, clipping_rect* rEnd,
int top, int bottom);
typedef int (*overlapProcp)(
BRegion* pReg,
clipping_rect* r1,
clipping_rect* r1End,
register clipping_rect* r2,
clipping_rect* r2End,
int top,
int bottom);
typedef int (*nonOverlapProcp)(
BRegion* pReg,
clipping_rect* r,
clipping_rect* rEnd,
int top,
int bottom);
static void miRegionOp(BRegion* newReg,
const BRegion* reg1, const BRegion* reg2,
int (*overlapFunc)(
register BRegion* pReg,
register clipping_rect* r1,
clipping_rect* r1End,
register clipping_rect* r2,
clipping_rect* r2End,
int top,
int bottom),
int (*nonOverlap1Func)(
register BRegion* pReg,
register clipping_rect* r,
clipping_rect* rEnd,
register int top,
register int bottom),
int (*nonOverlap2Func)(
register BRegion* pReg,
register clipping_rect* r,
clipping_rect* rEnd,
register int top,
register int bottom));
};
#endif // __REGION_SUPPORT_H
#include <../private/interface/RegionSupport.h>
+1 -172
View File
@@ -1,172 +1 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2004, Haiku, Inc.
//
// 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:
//
// The above copyright notice and this permission notice 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.
//
// File Name: clipping.h
// Author: Stefano Ceccherini ([email protected])
// Description: Helper methods to manipulate clipping_rects
//------------------------------------------------------------------------------
#ifndef __CLIPPING_H
#define __CLIPPING_H
#include <Region.h>
#include <SupportDefs.h>
/* Some methods to manipulate clipping_rects.
basically you can do almost everything you do with
BRects, just that clipping_rects can only have integer
coordinates (a thing that makes these perfect for drawing
calculations).
*/
// Returns the union of the given rects.
static inline clipping_rect
union_rect(const clipping_rect &r1, const clipping_rect &r2)
{
clipping_rect rect;
rect.left = min_c(r1.left, r2.left);
rect.top = min_c(r1.top, r2.top);
rect.right = max_c(r1.right, r2.right);
rect.bottom = max_c(r1.bottom, r2.bottom);
return rect;
}
// Returns the intersection of the given rects.
// The caller should check if the returned rect is valid. If it isn't valid,
// then the two rectangles don't intersect.
static inline clipping_rect
sect_rect(const clipping_rect &r1, const clipping_rect &r2)
{
clipping_rect rect;
rect.left = max_c(r1.left, r2.left);
rect.top = max_c(r1.top, r2.top);
rect.right = min_c(r1.right, r2.right);
rect.bottom = min_c(r1.bottom, r2.bottom);
return rect;
}
// Adds the given offsets to the given rect.
static inline void
offset_rect(clipping_rect &rect, int32 x, int32 y)
{
rect.left += x;
rect.top += y;
rect.right += x;
rect.bottom += y;
}
// Converts the given clipping_rect to a BRect
static inline BRect
to_BRect(const clipping_rect &rect)
{
return BRect((float)rect.left, (float)rect.top, (float)rect.right, (float)rect.bottom);
}
// Converts the given BRect to a clipping_rect.
static inline clipping_rect
to_clipping_rect(const BRect &rect)
{
clipping_rect clipRect;
clipRect.left = (int32)floor(rect.left);
clipRect.top = (int32)floor(rect.top);
clipRect.right = (int32)ceil(rect.right);
clipRect.bottom = (int32)ceil(rect.bottom);
return clipRect;
}
// Checks if the given point lies in the given rect's area
static inline bool
point_in(const clipping_rect &rect, int32 px, int32 py)
{
if (px >= rect.left && px <= rect.right
&& py >= rect.top && py <= rect.bottom)
return true;
return false;
}
// Same as above, but it accepts a BPoint parameter
static inline bool
point_in(const clipping_rect &rect, const BPoint &pt)
{
if (pt.x >= rect.left && pt.x <= rect.right
&& pt.y >= rect.top && pt.y <= rect.bottom)
return true;
return false;
}
// Checks if the rect is valid
static inline bool
valid_rect(const clipping_rect &rect)
{
if (rect.left <= rect.right && rect.top <= rect.bottom)
return true;
return false;
}
// Checks if the two rects intersect.
static inline bool
rects_intersect(const clipping_rect &rectA, const clipping_rect &rectB)
{
// We behave like BRect::Intersects() does:
// we return false if one of the two rects is not valid
if (!valid_rect(rectA) || !valid_rect(rectB))
return false;
// TODO: Is there a better algorithm ?
// the one we used is faster than
// ' return valid_rect(sect_rect(rectA, rectB)); ', though.
return !(rectA.left > rectB.right || rectA.top > rectB.bottom
|| rectA.right < rectB.left || rectA.bottom < rectB.top);
}
// Returns the width of the given rect.
static inline int32
rect_width(const clipping_rect &rect)
{
return rect.right - rect.left;
}
// Returns the height of the given rect.
static inline int32
rect_height(const clipping_rect &rect)
{
return rect.bottom - rect.top;
}
#endif // __CLIPPING_H
#include <../private/interface/clipping.h>
@@ -1,181 +1 @@
/*
* Copyright 2004-2010, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _UTF8_FUNCTIONS_H
#define _UTF8_FUNCTIONS_H
#include <SupportDefs.h>
static inline bool
IsInsideGlyph(uchar ch)
{
return (ch & 0xc0) == 0x80;
}
static inline uint32
UTF8NextCharLenUnsafe(const char *text)
{
const char *ptr = text;
do {
ptr++;
} while (IsInsideGlyph(*ptr));
return ptr - text;
}
static inline uint32
UTF8NextCharLen(const char *text)
{
if (text == NULL || *text == 0)
return 0;
return UTF8NextCharLenUnsafe(text);
}
static inline uint32
UTF8PreviousCharLen(const char *text, const char *limit)
{
const char *ptr = text;
if (ptr == NULL || limit == NULL)
return 0;
do {
if (ptr == limit)
break;
ptr--;
} while (IsInsideGlyph(*ptr));
return text - ptr;
}
/*! UTF8CountBytes gets the length (in bytes) of a UTF8 string. Up to
numChars characters are read. If numChars is a negative value it is ignored
and the string is read up to the terminating 0.
*/
static inline uint32
UTF8CountBytes(const char *bytes, int32 numChars)
{
if (bytes == NULL)
return 0;
if (numChars < 0)
numChars = INT_MAX;
const char *base = bytes;
while (bytes[0] != '\0') {
if ((bytes[0] & 0xc0) != 0x80) {
if (--numChars < 0)
break;
}
bytes++;
}
return bytes - base;
}
/*! UTF8CountChars gets the length (in characters) of a UTF8 string. Up to
numBytes bytes are read. If numBytes is a negative value it is ignored
and the string is read up to the terminating 0.
*/
static inline uint32
UTF8CountChars(const char *bytes, int32 numBytes)
{
if (bytes == NULL)
return 0;
uint32 length = 0;
const char *last;
if (numBytes < 0)
last = (const char *)SIZE_MAX;
else
last = bytes + numBytes - 1;
while (bytes[0] && bytes <= last) {
if ((bytes++[0] & 0xc0) != 0x80)
length++;
}
return length;
}
/*! UTF8ToCharCode converts the input that includes potential multibyte chars
to UTF-32 char codes that can be used by FreeType. The string pointer is
then advanced to the next character in the string. In case the terminating
0 is reached, the string pointer is not advanced anymore and nulls are
returned. This makes it safe to overruns and enables streamed processing
of UTF8 strings.
*/
static inline uint32
UTF8ToCharCode(const char **bytes)
{
#define UTF8_SUBSTITUTE_CHARACTER 0xfffd
uint32 result;
if (((*bytes)[0] & 0x80) == 0) {
// a single byte character
result = (*bytes)[0];
if (result != '\0') {
// do not advance beyond the terminating '\0'
(*bytes)++;
}
return result;
}
if (((*bytes)[0] & 0xc0) == 0x80) {
// not a proper multibyte start
(*bytes)++;
return UTF8_SUBSTITUTE_CHARACTER;
}
// start of a multibyte character
uint8 mask = 0x80;
result = (uint32)((*bytes)[0] & 0xff);
(*bytes)++;
while (result & mask) {
if (mask == 0x02) {
// seven byte char - invalid
return UTF8_SUBSTITUTE_CHARACTER;
}
result &= ~mask;
mask >>= 1;
}
while (((*bytes)[0] & 0xc0) == 0x80) {
result <<= 6;
result += (*bytes)[0] & 0x3f;
(*bytes)++;
mask <<= 1;
if (mask == 0x40)
return result;
}
if (mask == 0x40)
return result;
if ((*bytes)[0] == '\0') {
// string terminated within multibyte char
return 0x00;
}
// not enough bytes in multibyte char
return UTF8_SUBSTITUTE_CHARACTER;
#undef UTF8_SUBSTITUTE_CHARACTER
}
#endif // _UTF8_FUNCTIONS_H
#include <../private/interface/utf8_functions.h>