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:
parent
019f90e634
commit
457f9cf840
52
src/tests/servers/app/benchmark/DrawingModeToString.cpp
Normal file
52
src/tests/servers/app/benchmark/DrawingModeToString.cpp
Normal 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;
|
||||
}
|
15
src/tests/servers/app/benchmark/DrawingModeToString.h
Normal file
15
src/tests/servers/app/benchmark/DrawingModeToString.h
Normal 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
|
Loading…
Reference in New Issue
Block a user