love.math.random now uses a slight variant of Xorshift (Xorshift*).

This commit is contained in:
Alex Szpakowski
2015-10-26 20:47:56 -03:00
parent f92e6552d4
commit c03ce3a9ab
3 changed files with 19 additions and 21 deletions
+14 -7
View File
@@ -434,9 +434,16 @@ std::vector<Font::DrawCommand> Font::generateVertices(const Codepoints &codepoin
}
// Sort draw commands by texture first, and quad position in memory second
// (using the struct's < operator).
std::sort(drawcommands.begin(), drawcommands.end());
const auto drawsort = [](const DrawCommand &a, const DrawCommand &b) -> bool
{
// Texture binds are expensive, so we should sort by that first.
if (a.texture != b.texture)
return a.texture < b.texture;
else
return a.startvertex < b.startvertex;
};
std::sort(drawcommands.begin(), drawcommands.end(), drawsort);
if (dx > maxwidth)
maxwidth = (int) dx;
@@ -929,10 +936,10 @@ bool Font::getConstant(AlignMode in, const char *&out)
StringMap<Font::AlignMode, Font::ALIGN_MAX_ENUM>::Entry Font::alignModeEntries[] =
{
{ "left", Font::ALIGN_LEFT },
{ "right", Font::ALIGN_RIGHT },
{ "center", Font::ALIGN_CENTER },
{ "justify", Font::ALIGN_JUSTIFY },
{ "left", ALIGN_LEFT },
{ "right", ALIGN_RIGHT },
{ "center", ALIGN_CENTER },
{ "justify", ALIGN_JUSTIFY },
};
StringMap<Font::AlignMode, Font::ALIGN_MAX_ENUM> Font::alignModes(Font::alignModeEntries, sizeof(Font::alignModeEntries));
-10
View File
@@ -79,16 +79,6 @@ public:
GLuint texture;
int startvertex;
int vertexcount;
// used when sorting with std::sort.
bool operator < (const DrawCommand &other) const
{
// Texture binds are expensive, so we should sort by that first.
if (texture != other.texture)
return texture < other.texture;
else
return startvertex < other.startvertex;
}
};
Font(love::font::Rasterizer *r, const Texture::Filter &filter = Texture::getDefaultFilter());