-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
97 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,32 @@ | ||
#include "FtLibrary.h" | ||
#include "FtException.h" | ||
|
||
namespace ft { | ||
|
||
int Library::initialized = 0; | ||
|
||
Library::Library() | ||
{ | ||
if (!initialized) | ||
{ | ||
const auto error = FT_Init_FreeType(&library); | ||
if (error) | ||
throw Exception("Couldn't init FreeType engine", error); | ||
} | ||
|
||
++initialized; | ||
} | ||
|
||
Library::~Library() | ||
{ | ||
if (initialized) { | ||
if (--initialized == 0) { | ||
FT_Done_FreeType(library); | ||
library = nullptr; | ||
} | ||
} | ||
} | ||
} | ||
#include "FtLibrary.h" | ||
#include "FtException.h" | ||
|
||
namespace ft { | ||
|
||
int Library::initialized = 0; | ||
|
||
Library::Library() | ||
{ | ||
if (!initialized) | ||
{ | ||
const auto error = FT_Init_FreeType(&library); | ||
if (error) | ||
throw Exception("Couldn't init FreeType engine", error); | ||
} | ||
|
||
++initialized; | ||
} | ||
|
||
Library::~Library() | ||
{ | ||
if (initialized) | ||
{ | ||
if (--initialized == 0) | ||
{ | ||
FT_Done_FreeType(library); | ||
library = nullptr; | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
#pragma once | ||
#include "FtInclude.h" | ||
|
||
namespace ft { | ||
|
||
class Library | ||
{ | ||
public: | ||
Library(); | ||
Library(const Library&) = delete; | ||
Library& operator = (const Library&) = delete; | ||
Library(Library&&) = delete; | ||
Library& operator=(Library&&) = delete; | ||
~Library(); | ||
FT_Library library = nullptr; | ||
|
||
private: | ||
static int initialized; | ||
}; | ||
|
||
} | ||
#pragma once | ||
#include "FtInclude.h" | ||
|
||
namespace ft { | ||
|
||
class Library | ||
{ | ||
public: | ||
Library(); | ||
~Library(); | ||
|
||
FT_Library library = nullptr; | ||
|
||
Library(const Library&) = delete; | ||
Library(Library&&) = delete; | ||
Library& operator = (const Library&) = delete; | ||
Library& operator=(Library&&) = delete; | ||
|
||
private: | ||
static int initialized; | ||
}; | ||
|
||
} |