Commit 23fddfa8 authored by bfulgham@webkit.org's avatar bfulgham@webkit.org

2009-06-16 Brent Fulgham <bfulgham@webkit.org>

        Reviewed by Maciej Stachowiak.

        Update of https://bugs.webkit.org/show_bug.cgi?id=26353.
        Provide an assignment operator to avoid improper reference
        counts on the Cairo font objects.  This brings the Windows
        Cairo port in line with the GTK+ port.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44740 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent dea7c21a
2009-06-16 Brent Fulgham <bfulgham@webkit.org>
Reviewed by Maciej Stachowiak.
Update of https://bugs.webkit.org/show_bug.cgi?id=26353.
Provide an assignment operator to avoid improper reference
counts on the Cairo font objects. This brings the Windows
Cairo port in line with the GTK+ port.
* platform/graphics/win/FontPlatformData.h:
* platform/graphics/win/FontPlatformDataCairoWin.cpp:
(WebCore::FontPlatformData::FontPlatformData):
(WebCore::FontPlatformData::operator=):
2009-06-16 Eric Carlson <eric.carlson@apple.com>
Reviewed by Simon Fraser.
......
......@@ -65,6 +65,8 @@ public:
#elif PLATFORM(CAIRO)
FontPlatformData(cairo_font_face_t*, float size, bool bold, bool oblique);
FontPlatformData(const FontPlatformData&);
FontPlatformData& operator=(const FontPlatformData&);
#endif
~FontPlatformData();
......
......@@ -83,12 +83,17 @@ FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, float size, bool
FontPlatformData::FontPlatformData(const FontPlatformData& source)
: m_font(source.m_font)
, m_size(source.m_size)
, m_fontFace(cairo_font_face_reference(source.m_fontFace))
, m_scaledFont(cairo_scaled_font_reference(source.m_scaledFont))
, m_fontFace(0)
, m_scaledFont(0)
, m_syntheticBold(source.m_syntheticBold)
, m_syntheticOblique(source.m_syntheticOblique)
, m_useGDI(source.m_useGDI)
{
if (source.m_fontFace)
m_fontFace = cairo_font_face_reference(source.m_fontFace);
if (source.m_scaledFont)
m_scaledFont = cairo_scaled_font_reference(source.m_scaledFont);
}
void FontPlatformData::setFont(cairo_t* cr) const
......@@ -104,4 +109,31 @@ FontPlatformData::~FontPlatformData()
cairo_font_face_destroy(m_fontFace);
}
FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other)
{
// Check for self-assignment.
if (this == &other)
return *this;
m_font = other.m_font;
m_size = other.m_size;
m_syntheticBold = other.m_syntheticBold;
m_syntheticOblique = other.m_syntheticOblique;
m_useGDI = other.m_useGDI;
if (other.m_fontFace)
cairo_font_face_reference(other.m_fontFace);
if (m_fontFace)
cairo_font_face_destroy(m_fontFace);
m_fontFace = other.m_fontFace;
if (other.m_scaledFont)
cairo_scaled_font_reference(other.m_scaledFont);
if (m_scaledFont)
cairo_scaled_font_destroy(m_scaledFont);
m_scaledFont = other.m_scaledFont;
return *this;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment