If you had added Benchmark as a target, your build would have been broken,

because I forgot to add these files in my last commit... sorry.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29959 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2009-04-06 08:06:05 +00:00
parent 019f90e634
commit 457f9cf840
2 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,52 @@
/*
* Copyright (C) 2009 Stephan Aßmus <superstippi@gmx.de>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#include "DrawingModeToString.h"
struct DrawingModeString {
const char* string;
drawing_mode mode;
};
static const DrawingModeString kDrawingModes[] = {
{ "B_OP_COPY", B_OP_COPY },
{ "B_OP_OVER", B_OP_OVER },
{ "B_OP_ERASE", B_OP_ERASE },
{ "B_OP_INVERT", B_OP_INVERT },
{ "B_OP_ADD", B_OP_ADD },
{ "B_OP_SUBTRACT", B_OP_SUBTRACT },
{ "B_OP_BLEND", B_OP_BLEND },
{ "B_OP_MIN", B_OP_MIN },
{ "B_OP_MAX", B_OP_MAX },
{ "B_OP_SELECT", B_OP_SELECT },
{ "B_OP_ALPHA", B_OP_ALPHA }
};
bool ToDrawingMode(const char* string, drawing_mode& mode)
{
int entries = sizeof(kDrawingModes) / sizeof(DrawingModeString);
for (int32 i = 0; i < entries; i++) {
if (strcmp(kDrawingModes[i].string, string) == 0) {
mode = kDrawingModes[i].mode;
return true;
}
}
return false;
}
bool ToString(drawing_mode mode, const char*& string)
{
int entries = sizeof(kDrawingModes) / sizeof(DrawingModeString);
for (int32 i = 0; i < entries; i++) {
if (kDrawingModes[i].mode == mode) {
string = kDrawingModes[i].string;
return true;
}
}
return false;
}

View File

@ -0,0 +1,15 @@
/*
* Copyright (C) 2009 Stephan Aßmus <superstippi@gmx.de>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#ifndef DRAWING_MODE_TO_STRING_H
#define DRAWING_MODE_TO_STRING_H
#include <InterfaceDefs.h>
bool ToDrawingMode(const char* string, drawing_mode& mode);
bool ToString(drawing_mode mode, const char*& string);
#endif // DRAWING_MODE_TO_STRING_H