Fixed some style related functions and other oddities in FontServer.
Also applied our style guide on that class. Renamed some public globals to match our style guide. Made BitmapManager inherit from BLocker instead of duplicating its functionality (incorrectly, did not check for B_INTERRUPTED) locally. Some more cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13259 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,36 +1,19 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, Haiku, Inc.
|
||||
//
|
||||
// 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
|
||||
// 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
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: BitmapManager.h
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: Handler for allocating and freeing area memory for BBitmaps
|
||||
// on the server side. Utilizes the BGET pool allocator.
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <[email protected]>
|
||||
*/
|
||||
#ifndef BITMAP_MANAGER_H_
|
||||
#define BITMAP_MANAGER_H_
|
||||
|
||||
|
||||
#include <GraphicsDefs.h>
|
||||
#include <List.h>
|
||||
#include <OS.h>
|
||||
#include <Rect.h>
|
||||
#include <Locker.h>
|
||||
|
||||
#include "BGet++.h"
|
||||
#include "TokenHandler.h"
|
||||
@@ -64,10 +47,10 @@ class BitmapManager {
|
||||
area_id fBitmapArea;
|
||||
int8* fBuffer;
|
||||
TokenHandler fTokenizer;
|
||||
sem_id fLock;
|
||||
BLocker fLock;
|
||||
AreaPool fMemPool;
|
||||
};
|
||||
|
||||
extern BitmapManager *bitmapmanager;
|
||||
extern BitmapManager *gBitmapManager;
|
||||
|
||||
#endif
|
||||
#endif /* BITMAP_MANAGER_H_ */
|
||||
|
||||
@@ -1,29 +1,10 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, Haiku, Inc.
|
||||
//
|
||||
// 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
|
||||
// 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
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: FontServer.h
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: Handles the largest part of the font subsystem
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <[email protected]>
|
||||
*/
|
||||
#ifndef FONTSERVER_H_
|
||||
#define FONTSERVER_H_
|
||||
|
||||
@@ -31,6 +12,8 @@
|
||||
#include <List.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <Font.h>
|
||||
#include <Locker.h>
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_CACHE_H
|
||||
@@ -43,60 +26,59 @@ class ServerFont;
|
||||
\class FontServer FontServer.h
|
||||
\brief Manager for the largest part of the font subsystem
|
||||
*/
|
||||
class FontServer
|
||||
{
|
||||
class FontServer : public BLocker {
|
||||
public:
|
||||
FontServer(void);
|
||||
~FontServer(void);
|
||||
bool Lock(void);
|
||||
void Unlock(void);
|
||||
|
||||
|
||||
/*!
|
||||
\brief Determines whether the font server has started up properly
|
||||
\return true if so, false if not.
|
||||
*/
|
||||
bool IsInitialized(void) { return init; }
|
||||
bool IsInitialized(void) { return fInit; }
|
||||
int32 CountFamilies(void);
|
||||
int32 CountStyles(const char *family);
|
||||
void RemoveFamily(const char *family);
|
||||
status_t ScanDirectory(const char *path);
|
||||
void SaveList(void);
|
||||
|
||||
|
||||
const char *GetFamilyName(uint16 id) const;
|
||||
const char *GetStyleName(const char *family, uint16 id) const;
|
||||
|
||||
|
||||
FontStyle *GetStyle(const char *family, const char *face);
|
||||
FontStyle *GetStyle(const char *family, uint16 id) const;
|
||||
FontStyle *GetStyle(const uint16 &familyid, const uint16 &styleid);
|
||||
FontFamily *GetFamily(const uint16 &familyid) const;
|
||||
FontFamily *GetFamily(const char *name) const;
|
||||
|
||||
|
||||
ServerFont *GetSystemPlain(void);
|
||||
ServerFont *GetSystemBold(void);
|
||||
ServerFont *GetSystemFixed(void);
|
||||
|
||||
|
||||
bool SetSystemPlain(const char *family, const char *style, float size);
|
||||
bool SetSystemBold(const char *family, const char *style, float size);
|
||||
bool SetSystemFixed(const char *family, const char *style, float size);
|
||||
|
||||
bool FontsNeedUpdated(void) { return need_update; }
|
||||
|
||||
bool FontsNeedUpdated(void) { return fNeedUpdate; }
|
||||
/*!
|
||||
\brief Called when the fonts list has been updated
|
||||
*/
|
||||
void FontsUpdated(void) { need_update=false; }
|
||||
void FontsUpdated(void) { fNeedUpdate = false; }
|
||||
|
||||
protected:
|
||||
uint16 TranslateStyleToFace(const char *name) const;
|
||||
|
||||
FT_CharMap _GetSupportedCharmap(const FT_Face &face);
|
||||
bool init;
|
||||
sem_id lock;
|
||||
BList *families;
|
||||
ServerFont *plain, *bold, *fixed;
|
||||
bool need_update;
|
||||
|
||||
private:
|
||||
bool fInit;
|
||||
BList fFamilies;
|
||||
ServerFont *fPlain, *fBold, *fFixed;
|
||||
bool fNeedUpdate;
|
||||
};
|
||||
|
||||
extern FTC_Manager ftmanager;
|
||||
extern FT_Library ftlib;
|
||||
extern FontServer *fontserver;
|
||||
extern FontServer *gFontServer;
|
||||
|
||||
#endif
|
||||
#endif /* FONTSERVER_H_ */
|
||||
|
||||
Reference in New Issue
Block a user