* The WidthBuffer lock was unnecessarily static. Made it an object member.

* Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34367 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-11-30 11:25:13 +00:00
parent 4ac097c559
commit adcb834590
2 changed files with 52 additions and 47 deletions
+24 -19
View File
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003-2004 OpenBeOS
*
* 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
*
* 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
*
* 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
*
* 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: WidthBuffer.cpp
@@ -28,6 +28,8 @@
#ifndef __WIDTHBUFFER_H
#define __WIDTHBUFFER_H
#include <Locker.h>
#include <TextView.h>
#include "TextViewSupportBuffer.h"
@@ -39,7 +41,7 @@ class BFont;
// TODO: enable this as soon as we are sure opentracker works
// with our libraries, since using a BFont here (as Dano does) is much better,
// as fonts can be classified also by spacing mode and other attributes.
#define USE_DANO_WIDTHBUFFER 0
#define USE_DANO_WIDTHBUFFER 0
namespace BPrivate {
@@ -54,7 +56,7 @@ struct _width_table_ {
#endif
int32 hashCount; // number of hashed items
int32 tableCount; // size of table
void *widths; // width table
void *widths; // width table
};
class WidthBuffer : public _BTextViewSupportBuffer_<_width_table_> {
@@ -70,12 +72,15 @@ public:
private:
bool FindTable(const BFont *font, int32 *outIndex);
int32 InsertTable(const BFont *font);
bool GetEscapement(uint32 value, int32 index, float *escapement);
float HashEscapements(const char *chars, int32 numChars, int32 numBytes,
int32 tableIndex, const BFont *font);
static uint32 Hash(uint32);
private:
BLocker fLock;
};
extern WidthBuffer* gWidthBuffer;