diff options
Diffstat (limited to 'WebCore/platform/graphics/wx')
-rw-r--r-- | WebCore/platform/graphics/wx/FontWx.cpp | 20 | ||||
-rw-r--r-- | WebCore/platform/graphics/wx/GraphicsContextWx.cpp | 50 | ||||
-rw-r--r-- | WebCore/platform/graphics/wx/ImageBufferWx.cpp | 2 | ||||
-rw-r--r-- | WebCore/platform/graphics/wx/SimpleFontDataWx.cpp | 31 |
4 files changed, 55 insertions, 48 deletions
diff --git a/WebCore/platform/graphics/wx/FontWx.cpp b/WebCore/platform/graphics/wx/FontWx.cpp index cc45ab0..c01e249 100644 --- a/WebCore/platform/graphics/wx/FontWx.cpp +++ b/WebCore/platform/graphics/wx/FontWx.cpp @@ -98,6 +98,14 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint #endif } +float Font::getGlyphsAndAdvancesForComplexText(const TextRun& /* run */, int /* from */, int /* to */, GlyphBuffer& /* glyphBuffer */, ForTextEmphasisOrNot /* forTextEmphasis */) const +{ + // FIXME: Implement this by moving most of the drawComplexText() implementation in here. Set up the + // ComplexTextController according to forTextEmphasis. + notImplemented(); + return 0; +} + void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { #if OS(WINDOWS) || OS(DARWIN) @@ -130,12 +138,22 @@ void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const F // Draw the glyph buffer now at the starting point returned in startX. FloatPoint startPoint(startX, point.y()); - drawGlyphBuffer(context, glyphBuffer, run, startPoint); + drawGlyphBuffer(context, glyphBuffer, startPoint); #else notImplemented(); #endif } +void Font::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const +{ + GlyphBuffer glyphBuffer; + float initialAdvance = getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer, ForTextEmphasis); + + if (glyphBuffer.isEmpty()) + return; + + drawEmphasisMarks(context, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y())); +} float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*) const { diff --git a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp index 5007ffe..cee6aee 100644 --- a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp +++ b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp @@ -91,7 +91,6 @@ public: #if USE(WXGC) wxGCDC* context; - wxGraphicsPath currentPath; #else wxWindowDC* context; #endif @@ -113,11 +112,11 @@ GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate() } -GraphicsContext::GraphicsContext(PlatformGraphicsContext* context) - : m_common(createGraphicsContextPrivate()) - , m_data(new GraphicsContextPlatformPrivate) -{ +void GraphicsContext::platformInit(PlatformGraphicsContext* context) +{ + m_data = new GraphicsContextPlatformPrivate; setPaintingDisabled(!context); + if (context) { // Make sure the context starts in sync with our state. setPlatformFillColor(fillColor(), ColorSpaceDeviceRGB); @@ -125,17 +124,13 @@ GraphicsContext::GraphicsContext(PlatformGraphicsContext* context) } #if USE(WXGC) m_data->context = (wxGCDC*)context; - wxGraphicsContext* gc = m_data->context->GetGraphicsContext(); - if (gc) - m_data->currentPath = gc->CreatePath(); #else m_data->context = (wxWindowDC*)context; #endif } -GraphicsContext::~GraphicsContext() +void GraphicsContext::platformDestroy() { - destroyGraphicsContextPrivate(m_common); delete m_data; } @@ -337,7 +332,7 @@ void GraphicsContext::clipOut(const IntRect&) notImplemented(); } -void GraphicsContext::clipPath(WindRule) +void GraphicsContext::clipPath(const Path&, WindRule) { notImplemented(); } @@ -447,7 +442,7 @@ void GraphicsContext::setURLForRect(const KURL&, const IntRect&) notImplemented(); } -void GraphicsContext::setCompositeOperation(CompositeOperator op) +void GraphicsContext::setPlatformCompositeOperation(CompositeOperator op) { if (m_data->context) { @@ -459,23 +454,6 @@ void GraphicsContext::setCompositeOperation(CompositeOperator op) } } -void GraphicsContext::beginPath() -{ -#if USE(WXGC) - wxGraphicsContext* gc = m_data->context->GetGraphicsContext(); - if (gc) - m_data->currentPath = gc->CreatePath(); -#endif -} - -void GraphicsContext::addPath(const Path& path) -{ -#if USE(WXGC) - if (path.platformPath()) - m_data->currentPath.AddPath(*path.platformPath()); -#endif -} - void GraphicsContext::setPlatformStrokeColor(const Color& color, ColorSpace colorSpace) { if (paintingDisabled()) @@ -533,30 +511,24 @@ InterpolationQuality GraphicsContext::imageInterpolationQuality() const return InterpolationDefault; } -void GraphicsContext::fillPath() +void GraphicsContext::fillPath(const Path& path) { #if USE(WXGC) wxGraphicsContext* gc = m_data->context->GetGraphicsContext(); if (gc) - gc->FillPath(m_data->currentPath); + gc->FillPath(path.platformPath()); #endif } -void GraphicsContext::strokePath() +void GraphicsContext::strokePath(const Path& path) { #if USE(WXGC) wxGraphicsContext* gc = m_data->context->GetGraphicsContext(); if (gc) - gc->StrokePath(m_data->currentPath); + gc->StrokePath(path.platformPath()); #endif } -void GraphicsContext::drawPath() -{ - fillPath(); - strokePath(); -} - void GraphicsContext::fillRect(const FloatRect& rect) { if (paintingDisabled()) diff --git a/WebCore/platform/graphics/wx/ImageBufferWx.cpp b/WebCore/platform/graphics/wx/ImageBufferWx.cpp index 2522cbd..74c9c39 100644 --- a/WebCore/platform/graphics/wx/ImageBufferWx.cpp +++ b/WebCore/platform/graphics/wx/ImageBufferWx.cpp @@ -37,7 +37,7 @@ ImageBufferData::ImageBufferData(const IntSize&) { } -ImageBuffer::ImageBuffer(const IntSize&, ImageColorSpace imageColorSpace, bool& success) : +ImageBuffer::ImageBuffer(const IntSize&, ColorSpace imageColorSpace, RenderingMode, bool& success) : m_data(IntSize()) { notImplemented(); diff --git a/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp b/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp index 96129f9..0e24bfc 100644 --- a/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp +++ b/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp @@ -90,15 +90,32 @@ void SimpleFontData::platformDestroy() #endif } +SimpleFontData* SimpleFontData::scaledFontData(const FontDescription& fontDescription, float scaleFactor) const +{ + FontDescription desc = FontDescription(fontDescription); + desc.setSpecifiedSize(scaleFactor * fontDescription.computedSize()); + FontPlatformData platformData(desc, desc.family().family()); + return new SimpleFontData(platformData, isCustomFont(), false); +} + SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const { - if (!m_smallCapsFontData){ - FontDescription desc = FontDescription(fontDescription); - desc.setSpecifiedSize(0.70f * fontDescription.computedSize()); - FontPlatformData platformData(desc, desc.family().family()); - m_smallCapsFontData = new SimpleFontData(platformData, isCustomFont(), false); - } - return m_smallCapsFontData; + if (!m_derivedFontData) + m_derivedFontData = DerivedFontData::create(isCustomFont()); + if (!m_derivedFontData->smallCaps) + m_derivedFontData->smallCaps = scaledFontData(fontDescription, .7); + + return m_derivedFontData->smallCaps.get(); +} + +SimpleFontData* SimpleFontData::emphasisMarkFontData(const FontDescription& fontDescription) const +{ + if (!m_derivedFontData) + m_derivedFontData = DerivedFontData::create(isCustomFont()); + if (!m_derivedFontData->emphasisMark) + m_derivedFontData->emphasisMark = scaledFontData(fontDescription, .5); + + return m_derivedFontData->emphasisMark.get(); } bool SimpleFontData::containsCharacters(const UChar* characters, int length) const |