2006-04-25 20:12:06 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
|
|
*/
|
|
|
|
#ifndef SERVER_READ_ONLY_MEMORY_H
|
|
|
|
#define SERVER_READ_ONLY_MEMORY_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <GraphicsDefs.h>
|
|
|
|
#include <InterfaceDefs.h>
|
|
|
|
|
|
|
|
|
|
|
|
struct server_read_only_memory {
|
2013-04-05 20:15:16 -04:00
|
|
|
rgb_color colors[B_COLOR_WHICH_COUNT];
|
2006-04-25 20:12:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static inline int32
|
|
|
|
color_which_to_index(color_which which)
|
|
|
|
{
|
2013-04-05 20:15:16 -04:00
|
|
|
if (which <= B_COLOR_WHICH_COUNT - 3)
|
2006-04-25 20:12:06 +00:00
|
|
|
return which - 1;
|
|
|
|
if (which >= B_SUCCESS_COLOR && which <= B_FAILURE_COLOR)
|
2013-04-05 20:15:16 -04:00
|
|
|
return which - B_SUCCESS_COLOR + B_COLOR_WHICH_COUNT - 3;
|
2006-04-25 20:12:06 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-07-15 15:05:59 -04:00
|
|
|
|
2008-03-04 01:19:04 +00:00
|
|
|
static inline color_which
|
|
|
|
index_to_color_which(int32 index)
|
|
|
|
{
|
2013-04-05 20:15:16 -04:00
|
|
|
if (index >= 0 && index < B_COLOR_WHICH_COUNT) {
|
|
|
|
if ((color_which)index < B_COLOR_WHICH_COUNT - 3)
|
2008-03-04 01:19:04 +00:00
|
|
|
return (color_which)(index + 1);
|
2011-11-13 15:47:27 -05:00
|
|
|
else {
|
|
|
|
return (color_which)(index + B_SUCCESS_COLOR
|
2013-04-05 20:15:16 -04:00
|
|
|
- B_COLOR_WHICH_COUNT - 3);
|
2011-11-13 15:47:27 -05:00
|
|
|
}
|
2008-03-04 01:19:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (color_which)-1;
|
|
|
|
}
|
|
|
|
|
2006-04-25 20:12:06 +00:00
|
|
|
#endif /* SERVER_READ_ONLY_MEMORY_H */
|