* 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:
@@ -28,6 +28,8 @@
|
|||||||
#ifndef __WIDTHBUFFER_H
|
#ifndef __WIDTHBUFFER_H
|
||||||
#define __WIDTHBUFFER_H
|
#define __WIDTHBUFFER_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <Locker.h>
|
||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
|
|
||||||
#include "TextViewSupportBuffer.h"
|
#include "TextViewSupportBuffer.h"
|
||||||
@@ -76,6 +78,9 @@ private:
|
|||||||
int32 tableIndex, const BFont *font);
|
int32 tableIndex, const BFont *font);
|
||||||
|
|
||||||
static uint32 Hash(uint32);
|
static uint32 Hash(uint32);
|
||||||
|
|
||||||
|
private:
|
||||||
|
BLocker fLock;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern WidthBuffer* gWidthBuffer;
|
extern WidthBuffer* gWidthBuffer;
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ namespace BPrivate {
|
|||||||
|
|
||||||
const static uint32 kTableCount = 128;
|
const static uint32 kTableCount = 128;
|
||||||
const static uint32 kInvalidCode = 0xFFFFFFFF;
|
const static uint32 kInvalidCode = 0xFFFFFFFF;
|
||||||
static BLocker sWidthLocker = BLocker("width buffer lock");
|
|
||||||
WidthBuffer* gWidthBuffer = NULL;
|
WidthBuffer* gWidthBuffer = NULL;
|
||||||
// initialized in InterfaceDefs.cpp
|
// initialized in InterfaceDefs.cpp
|
||||||
|
|
||||||
@@ -66,7 +65,8 @@ CharToCode(const char *text, const int32 charLen)
|
|||||||
*/
|
*/
|
||||||
WidthBuffer::WidthBuffer()
|
WidthBuffer::WidthBuffer()
|
||||||
:
|
:
|
||||||
_BTextViewSupportBuffer_<_width_table_>(1, 0)
|
_BTextViewSupportBuffer_<_width_table_>(1, 0),
|
||||||
|
fLock("width buffer")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ WidthBuffer::StringWidth(const char *inText, int32 fromOffset,
|
|||||||
if (inText == NULL || length == 0)
|
if (inText == NULL || length == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
BAutolock _(sWidthLocker);
|
BAutolock _(fLock);
|
||||||
|
|
||||||
int32 index = 0;
|
int32 index = 0;
|
||||||
if (!FindTable(inStyle, &index))
|
if (!FindTable(inStyle, &index))
|
||||||
|
|||||||
Reference in New Issue
Block a user