diff options
Diffstat (limited to 'WebCore/platform/graphics/wx')
-rw-r--r-- | WebCore/platform/graphics/wx/FontWx.cpp | 7 | ||||
-rw-r--r-- | WebCore/platform/graphics/wx/ImageSourceWx.cpp | 10 | ||||
-rw-r--r-- | WebCore/platform/graphics/wx/ImageWx.cpp | 46 | ||||
-rw-r--r-- | WebCore/platform/graphics/wx/PathWx.cpp | 5 | ||||
-rw-r--r-- | WebCore/platform/graphics/wx/SimpleFontDataWx.cpp | 15 | ||||
-rw-r--r-- | WebCore/platform/graphics/wx/TransformationMatrixWx.cpp | 2 |
6 files changed, 62 insertions, 23 deletions
diff --git a/WebCore/platform/graphics/wx/FontWx.cpp b/WebCore/platform/graphics/wx/FontWx.cpp index 07223e9..04b2ec4 100644 --- a/WebCore/platform/graphics/wx/FontWx.cpp +++ b/WebCore/platform/graphics/wx/FontWx.cpp @@ -39,6 +39,11 @@ namespace WebCore { +bool Font::canReturnFallbackFontsForComplexText() +{ + return false; +} + void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const { @@ -63,7 +68,7 @@ void Font::drawComplexText(GraphicsContext* graphicsContext, const TextRun& run, notImplemented(); } -float Font::floatWidthForComplexText(const TextRun& run) const +float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* /* fallbackFonts */) const { notImplemented(); return 0; diff --git a/WebCore/platform/graphics/wx/ImageSourceWx.cpp b/WebCore/platform/graphics/wx/ImageSourceWx.cpp index fc8ce71..2f71d62 100644 --- a/WebCore/platform/graphics/wx/ImageSourceWx.cpp +++ b/WebCore/platform/graphics/wx/ImageSourceWx.cpp @@ -37,6 +37,9 @@ #include <wx/defs.h> #include <wx/bitmap.h> +#if USE(WXGC) +#include <wx/graphics.h> +#endif #include <wx/image.h> #include <wx/rawbmp.h> @@ -224,7 +227,14 @@ NativeImagePtr ImageSource::createFrameAtIndex(size_t index) bmp->UseAlpha(); #endif ASSERT(bmp->IsOk()); + +#if USE(WXGC) + wxGraphicsBitmap* bitmap = new wxGraphicsBitmap(wxGraphicsRenderer::GetDefaultRenderer()->CreateBitmap(*bmp)); + delete bmp; + return bitmap; +#else return bmp; +#endif } float ImageSource::frameDurationAtIndex(size_t index) diff --git a/WebCore/platform/graphics/wx/ImageWx.cpp b/WebCore/platform/graphics/wx/ImageWx.cpp index e1d435e..b0a993e 100644 --- a/WebCore/platform/graphics/wx/ImageWx.cpp +++ b/WebCore/platform/graphics/wx/ImageWx.cpp @@ -26,11 +26,12 @@ #include "config.h" #include "Image.h" -#include "TransformationMatrix.h" #include "BitmapImage.h" +#include "FloatConversion.h" #include "FloatRect.h" #include "GraphicsContext.h" -#include "NotImplemented.h" +#include "ImageObserver.h" +#include "TransformationMatrix.h" #include <math.h> #include <stdio.h> @@ -98,13 +99,13 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatR #if USE(WXGC) wxGCDC* context = (wxGCDC*)ctxt->platformContext(); wxGraphicsContext* gc = context->GetGraphicsContext(); + wxGraphicsBitmap* bitmap = frameAtIndex(m_currentFrame); #else wxWindowDC* context = ctxt->platformContext(); + wxBitmap* bitmap = frameAtIndex(m_currentFrame); #endif startAnimation(); - - wxBitmap* bitmap = frameAtIndex(m_currentFrame); if (!bitmap) // If it's too early we won't have an image yet. return; @@ -129,17 +130,15 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatR adjustedDestRect.setLocation(FloatPoint(dst.x() - src.x() / scaleX, dst.y() - src.y() / scaleY)); adjustedDestRect.setSize(FloatSize(selfSize.width() / scaleX, selfSize.height() / scaleY)); } - - // If the image is only partially loaded, then shrink the destination rect that we're drawing into accordingly. - int currHeight = bitmap->GetHeight(); - if (currHeight < selfSize.height()) - adjustedDestRect.setHeight(adjustedDestRect.height() * currHeight / selfSize.height()); - gc->PushState(); gc->Clip(dst.x(), dst.y(), dst.width(), dst.height()); +#if wxCHECK_VERSION(2,9,0) gc->DrawBitmap(*bitmap, adjustedDestRect.x(), adjustedDestRect.y(), adjustedDestRect.width(), adjustedDestRect.height()); - gc->PopState(); #else + gc->DrawGraphicsBitmap(*bitmap, adjustedDestRect.x(), adjustedDestRect.y(), adjustedDestRect.width(), adjustedDestRect.height()); +#endif + +#else // USE(WXGC) IntRect srcIntRect(src); IntRect dstIntRect(dst); bool rescaling = false; @@ -172,6 +171,9 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatR #endif ctxt->restore(); + + if (ImageObserver* observer = imageObserver()) + observer->didDraw(this); } void BitmapImage::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, const TransformationMatrix& patternTransform, const FloatPoint& phase, CompositeOperator, const FloatRect& dstRect) @@ -181,21 +183,29 @@ void BitmapImage::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, c #if USE(WXGC) wxGCDC* context = (wxGCDC*)ctxt->platformContext(); + wxGraphicsBitmap* bitmap = frameAtIndex(m_currentFrame); #else wxWindowDC* context = ctxt->platformContext(); + wxBitmap* bitmap = frameAtIndex(m_currentFrame); #endif - ctxt->save(); - ctxt->clip(IntRect(dstRect.x(), dstRect.y(), dstRect.width(), dstRect.height())); - wxBitmap* bitmap = frameAtIndex(m_currentFrame); if (!bitmap) // If it's too early we won't have an image yet. return; + + ctxt->save(); + ctxt->clip(IntRect(dstRect.x(), dstRect.y(), dstRect.width(), dstRect.height())); float currentW = 0; float currentH = 0; #if USE(WXGC) wxGraphicsContext* gc = context->GetGraphicsContext(); + + float adjustedX = phase.x() + srcRect.x() * + narrowPrecisionToFloat(patternTransform.a()); + float adjustedY = phase.y() + srcRect.y() * + narrowPrecisionToFloat(patternTransform.d()); + gc->ConcatTransform(patternTransform); #else wxMemoryDC mydc; @@ -208,7 +218,11 @@ void BitmapImage::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, c while ( currentW < dstRect.width() && currentW < clientSize.x - origin.x ) { while ( currentH < dstRect.height() && currentH < clientSize.y - origin.y) { #if USE(WXGC) - gc->DrawBitmap(*bitmap, (wxDouble)dstRect.x() + currentW, (wxDouble)dstRect.y() + currentH, (wxDouble)srcRect.width(), (wxDouble)srcRect.height()); +#if wxCHECK_VERSION(2,9,0) + gc->DrawBitmap(*bitmap, adjustedX + currentW, adjustedY + currentH, (wxDouble)srcRect.width(), (wxDouble)srcRect.height()); +#else + gc->DrawGraphicsBitmap(*bitmap, adjustedX + currentW, adjustedY + currentH, (wxDouble)srcRect.width(), (wxDouble)srcRect.height()); +#endif #else context->Blit((wxCoord)dstRect.x() + currentW, (wxCoord)dstRect.y() + currentH, (wxCoord)srcRect.width(), (wxCoord)srcRect.height(), &mydc, @@ -233,6 +247,8 @@ void BitmapImage::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, c startAnimation(); + if (ImageObserver* observer = imageObserver()) + observer->didDraw(this); } void BitmapImage::checkForSolidColor() diff --git a/WebCore/platform/graphics/wx/PathWx.cpp b/WebCore/platform/graphics/wx/PathWx.cpp index 60c71d5..04a952d 100644 --- a/WebCore/platform/graphics/wx/PathWx.cpp +++ b/WebCore/platform/graphics/wx/PathWx.cpp @@ -66,11 +66,12 @@ Path::Path() Path::~Path() { + clear(); } Path::Path(const Path& path) { - m_path = (PlatformPath*)&path.m_path; + m_path = new wxGraphicsPath(*path.m_path); } bool Path::contains(const FloatPoint& point, const WindRule rule) const @@ -89,7 +90,7 @@ bool Path::contains(const FloatPoint& point, const WindRule rule) const void Path::translate(const FloatSize&) { - notImplemented(); + notImplemented(); } FloatRect Path::boundingRect() const diff --git a/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp b/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp index ab50518..2368f83 100644 --- a/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp +++ b/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp @@ -45,7 +45,7 @@ namespace WebCore void SimpleFontData::platformInit() { - wxFont *font = m_font.font(); + wxFont *font = m_platformData.font(); if (font && font->IsOk()) { wxFontProperties props = wxFontProperties(font); m_ascent = props.GetAscent(); @@ -57,6 +57,13 @@ void SimpleFontData::platformInit() } } +void SimpleFontData::platformCharWidthInit() +{ + m_avgCharWidth = 0.f; + m_maxCharWidth = 0.f; + initCharWidths(); +} + void SimpleFontData::platformDestroy() { delete m_smallCapsFontData; @@ -81,8 +88,8 @@ bool SimpleFontData::containsCharacters(const UChar* characters, int length) con void SimpleFontData::determinePitch() { - if (m_font.font() && m_font.font()->Ok()) - m_treatAsFixedPitch = m_font.font()->IsFixedWidth(); + if (m_platformData.font() && m_platformData.font()->Ok()) + m_treatAsFixedPitch = m_platformData.font()->IsFixedWidth(); else m_treatAsFixedPitch = false; } @@ -91,7 +98,7 @@ float SimpleFontData::platformWidthForGlyph(Glyph glyph) const { // TODO: fix this! Make GetTextExtents a method of wxFont in 2.9 int width = 10; - GetTextExtent(*m_font.font(), (wxChar)glyph, &width, NULL); + GetTextExtent(*m_platformData.font(), (wxChar)glyph, &width, NULL); return width; } diff --git a/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp b/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp index f21dc17..9684a3c 100644 --- a/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp +++ b/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp @@ -26,9 +26,9 @@ #include "config.h" #include "TransformationMatrix.h" +#include "Assertions.h" #include "FloatRect.h" #include "IntRect.h" -#include "NotImplemented.h" #include <stdio.h> #include <wx/defs.h> |