Synchronized with trunk
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1167 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
commit
1bf35973be
28 changed files with 1720 additions and 1604 deletions
|
@ -210,10 +210,6 @@ FT_Error FontLoader::CreateBitmapFont(FT_Face face, unsigned int charSize, const
|
|||
FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, 0, 1);
|
||||
FT_BitmapGlyph bitmapGlyph = (FT_BitmapGlyph)glyph;
|
||||
|
||||
// Should we handle other pixel modes ?
|
||||
if (bitmapGlyph->bitmap.pixel_mode != FT_PIXEL_MODE_GRAY)
|
||||
return FT_Err_Cannot_Render_Glyph;
|
||||
|
||||
// Add it to the sorted table of glyphs
|
||||
glyphs.insert(std::make_pair(bitmapGlyph, charset[i]));
|
||||
}
|
||||
|
@ -290,7 +286,7 @@ FT_Error FontLoader::CreateBitmapFont(FT_Face face, unsigned int charSize, const
|
|||
for (std::size_t i = 0; i < charset.size(); ++i)
|
||||
{
|
||||
Uint32 curChar = charset[i];
|
||||
font.myGlyphs[curChar].TexCoords = font.myTexture.GetTexCoords(coords[curChar], false);
|
||||
font.myGlyphs[curChar].TexCoords = font.myTexture.GetTexCoords(coords[curChar]);
|
||||
}
|
||||
|
||||
// Update the character size (it may have been changed by the function)
|
||||
|
|
|
@ -549,26 +549,16 @@ bool Image::IsSmooth() const
|
|||
/// Convert a subrect expressed in pixels, into float
|
||||
/// texture coordinates
|
||||
////////////////////////////////////////////////////////////
|
||||
FloatRect Image::GetTexCoords(const IntRect& rect, bool adjust) const
|
||||
FloatRect Image::GetTexCoords(const IntRect& rect) const
|
||||
{
|
||||
float width = static_cast<float>(myTextureWidth);
|
||||
float height = static_cast<float>(myTextureHeight);
|
||||
|
||||
FloatRect coords;
|
||||
if (adjust && myIsSmooth)
|
||||
{
|
||||
coords.Left = (rect.Left + 0.5f) / width;
|
||||
coords.Top = (rect.Top + 0.5f) / height;
|
||||
coords.Right = (rect.Right - 0.5f) / width;
|
||||
coords.Bottom = (rect.Bottom - 0.5f) / height;
|
||||
}
|
||||
else
|
||||
{
|
||||
coords.Left = rect.Left / width;
|
||||
coords.Top = rect.Top / height;
|
||||
coords.Right = rect.Right / width;
|
||||
coords.Bottom = rect.Bottom / height;
|
||||
}
|
||||
coords.Left = rect.Left / width;
|
||||
coords.Top = rect.Top / height;
|
||||
coords.Right = rect.Right / width;
|
||||
coords.Bottom = rect.Bottom / height;
|
||||
|
||||
if (myPixelsFlipped)
|
||||
std::swap(coords.Top, coords.Bottom);
|
||||
|
|
|
@ -186,6 +186,10 @@ void Sprite::Render(RenderTarget&) const
|
|||
// Check if the image is valid
|
||||
if (myImage && (myImage->GetWidth() > 0) && (myImage->GetHeight() > 0))
|
||||
{
|
||||
// Use the "offset trick" to get pixel-perfect rendering
|
||||
// see http://www.opengl.org/resources/faq/technical/transformations.htm#tran0030
|
||||
GLCheck(glTranslatef(0.375f, 0.375f, 0.f));
|
||||
|
||||
// Bind the texture
|
||||
myImage->Bind();
|
||||
|
||||
|
|
|
@ -50,14 +50,12 @@ namespace sf
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Default constructor
|
||||
////////////////////////////////////////////////////////////
|
||||
Http::Request::Request(Method method, const std::string& URI, const std::string& body) :
|
||||
myMethod (method),
|
||||
myURI (URI),
|
||||
myMajorVersion(1),
|
||||
myMinorVersion(0),
|
||||
myBody (body)
|
||||
Http::Request::Request(Method method, const std::string& URI, const std::string& body)
|
||||
{
|
||||
|
||||
SetMethod(method);
|
||||
SetURI(URI);
|
||||
SetHttpVersion(1, 0);
|
||||
SetBody(body);
|
||||
}
|
||||
|
||||
|
||||
|
@ -179,7 +177,7 @@ myMinorVersion(0)
|
|||
////////////////////////////////////////////////////////////
|
||||
const std::string& Http::Response::GetField(const std::string& field) const
|
||||
{
|
||||
FieldTable::const_iterator it = myFields.find(field);
|
||||
FieldTable::const_iterator it = myFields.find(ToLower(field));
|
||||
if (it != myFields.end())
|
||||
{
|
||||
return it->second;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue