summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/wx
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-06 11:45:16 +0100
committerSteve Block <steveblock@google.com>2011-05-12 13:44:10 +0100
commitcad810f21b803229eb11403f9209855525a25d57 (patch)
tree29a6fd0279be608e0fe9ffe9841f722f0f4e4269 /Source/WebCore/platform/graphics/wx
parent121b0cf4517156d0ac5111caf9830c51b69bae8f (diff)
downloadexternal_webkit-cad810f21b803229eb11403f9209855525a25d57.zip
external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.gz
external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.bz2
Merge WebKit at r75315: Initial merge by git.
Change-Id: I570314b346ce101c935ed22a626b48c2af266b84
Diffstat (limited to 'Source/WebCore/platform/graphics/wx')
-rw-r--r--Source/WebCore/platform/graphics/wx/ColorWx.cpp44
-rw-r--r--Source/WebCore/platform/graphics/wx/FloatRectWx.cpp47
-rw-r--r--Source/WebCore/platform/graphics/wx/FontCacheWx.cpp106
-rw-r--r--Source/WebCore/platform/graphics/wx/FontCustomPlatformData.cpp49
-rw-r--r--Source/WebCore/platform/graphics/wx/FontCustomPlatformData.h48
-rw-r--r--Source/WebCore/platform/graphics/wx/FontPlatformData.h182
-rw-r--r--Source/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp180
-rw-r--r--Source/WebCore/platform/graphics/wx/FontPlatformDataWxMac.mm147
-rw-r--r--Source/WebCore/platform/graphics/wx/FontWx.cpp184
-rw-r--r--Source/WebCore/platform/graphics/wx/GlyphMapWx.cpp59
-rw-r--r--Source/WebCore/platform/graphics/wx/GradientWx.cpp50
-rw-r--r--Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp666
-rw-r--r--Source/WebCore/platform/graphics/wx/IconWx.cpp47
-rw-r--r--Source/WebCore/platform/graphics/wx/ImageBufferData.h43
-rw-r--r--Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp120
-rw-r--r--Source/WebCore/platform/graphics/wx/ImageWx.cpp264
-rw-r--r--Source/WebCore/platform/graphics/wx/IntPointWx.cpp45
-rw-r--r--Source/WebCore/platform/graphics/wx/IntRectWx.cpp45
-rw-r--r--Source/WebCore/platform/graphics/wx/IntSizeWx.cpp45
-rw-r--r--Source/WebCore/platform/graphics/wx/PathWx.cpp249
-rw-r--r--Source/WebCore/platform/graphics/wx/PenWx.cpp77
-rw-r--r--Source/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp197
-rw-r--r--Source/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp60
23 files changed, 2954 insertions, 0 deletions
diff --git a/Source/WebCore/platform/graphics/wx/ColorWx.cpp b/Source/WebCore/platform/graphics/wx/ColorWx.cpp
new file mode 100644
index 0000000..0381c59
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/ColorWx.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2006, 2007 Kevin Ollivier. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Color.h"
+
+#include <wx/defs.h>
+#include <wx/colour.h>
+
+namespace WebCore {
+
+Color::Color(const wxColour& color)
+{
+ m_color = makeRGBA((int)color.Red(), (int)color.Green(), (int)color.Blue(), (int)color.Alpha());
+}
+
+Color::operator wxColour() const
+{
+ return wxColour(red(), green(), blue(), alpha());
+}
+
+}
diff --git a/Source/WebCore/platform/graphics/wx/FloatRectWx.cpp b/Source/WebCore/platform/graphics/wx/FloatRectWx.cpp
new file mode 100644
index 0000000..bb460e5
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/FloatRectWx.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "FloatRect.h"
+
+#include <wx/defs.h>
+#include <wx/graphics.h>
+
+namespace WebCore {
+
+#if USE(WXGC)
+FloatRect::FloatRect(const wxRect2DDouble& r)
+ : m_location(FloatPoint(r.m_x, r.m_y))
+ , m_size(FloatSize(r.m_width, r.m_height))
+{
+}
+
+FloatRect::operator wxRect2DDouble() const
+{
+ return wxRect2DDouble(x(), y(), width(), height());
+}
+#endif
+
+}
diff --git a/Source/WebCore/platform/graphics/wx/FontCacheWx.cpp b/Source/WebCore/platform/graphics/wx/FontCacheWx.cpp
new file mode 100644
index 0000000..c594975
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/FontCacheWx.cpp
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "FontCache.h"
+#include "Font.h"
+#include "FontPlatformData.h"
+#include "NotImplemented.h"
+#include "SimpleFontData.h"
+
+namespace WebCore {
+
+void FontCache::platformInit()
+{
+}
+
+const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
+{
+ SimpleFontData* fontData = 0;
+ fontData = getCachedFontData(font.fontDescription(), font.family().family());
+ if (!fontData->containsCharacters(characters, length))
+ fontData = getSimilarFontPlatformData(font);
+ if (!fontData->containsCharacters(characters, length))
+ fontData = getLastResortFallbackFont(font.fontDescription());
+
+ ASSERT(fontData);
+ return fontData;
+}
+
+SimpleFontData* FontCache::getSimilarFontPlatformData(const Font& font)
+{
+ SimpleFontData* simpleFontData = 0;
+#if OS(DARWIN)
+ // Attempt to find an appropriate font using a match based on
+ // the presence of keywords in the the requested names. For example, we'll
+ // match any name that contains "Arabic" to Geeza Pro.
+ const FontFamily* currFamily = &font.fontDescription().family();
+ while (currFamily && !simpleFontData) {
+ if (currFamily->family().length()) {
+ static String* matchWords[3] = { new String("Arabic"), new String("Pashto"), new String("Urdu") };
+ DEFINE_STATIC_LOCAL(AtomicString, geezaStr, ("Geeza Pro"));
+ for (int j = 0; j < 3 && !simpleFontData; ++j)
+ if (currFamily->family().contains(*matchWords[j], false))
+ simpleFontData = getCachedFontData(font.fontDescription(), geezaStr);
+ }
+ currFamily = currFamily->next();
+ }
+#endif
+ if (!simpleFontData)
+ simpleFontData = getCachedFontData(font.fontDescription(), font.family().family());
+
+ return simpleFontData;
+}
+
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
+{
+ // FIXME: Would be even better to somehow get the user's default font here. For now we'll pick
+ // the default that the user would get without changing any prefs.
+ SimpleFontData* fallback = 0;
+#if OS(WINDOWS)
+ static AtomicString fallbackName("Arial Unicode MS");
+#else
+ static AtomicString fallbackName("Times New Roman");
+#endif
+ fallback = getCachedFontData(fontDescription, fallbackName);
+ ASSERT(fallback);
+
+ return fallback;
+}
+
+FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
+{
+ return new FontPlatformData(fontDescription,family);
+}
+
+void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigned>& traitsMasks)
+{
+ notImplemented();
+}
+
+}
diff --git a/Source/WebCore/platform/graphics/wx/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/wx/FontCustomPlatformData.cpp
new file mode 100644
index 0000000..6133372
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/FontCustomPlatformData.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2008 Alp Toker <alp@atoker.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "FontCustomPlatformData.h"
+
+#include "SharedBuffer.h"
+#include "FontPlatformData.h"
+
+
+namespace WebCore {
+
+FontCustomPlatformData::~FontCustomPlatformData()
+{
+}
+
+FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontRenderingMode)
+{
+ return FontPlatformData(size, bold, italic);
+}
+
+FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
+{
+ return 0;
+}
+
+bool FontCustomPlatformData::supportsFormat(const String& /* format */)
+{
+ return false;
+}
+
+}
diff --git a/Source/WebCore/platform/graphics/wx/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/wx/FontCustomPlatformData.h
new file mode 100644
index 0000000..cc348e3
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/FontCustomPlatformData.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2008 Alp Toker <alp@atoker.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef FontCustomPlatformData_h
+#define FontCustomPlatformData_h
+
+#include "FontOrientation.h"
+#include "FontRenderingMode.h"
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+ class FontPlatformData;
+ class SharedBuffer;
+
+ struct FontCustomPlatformData : Noncopyable {
+ public:
+ FontCustomPlatformData() { }
+ ~FontCustomPlatformData();
+
+ static bool supportsFormat(const String&);
+
+ FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontRenderingMode = NormalRenderingMode);
+ };
+
+ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer*);
+
+}
+
+#endif
diff --git a/Source/WebCore/platform/graphics/wx/FontPlatformData.h b/Source/WebCore/platform/graphics/wx/FontPlatformData.h
new file mode 100644
index 0000000..9ae8b54
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/FontPlatformData.h
@@ -0,0 +1,182 @@
+/*
+ * Copyright (C) 2006 Kevin Ollivier All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FontPlatformData_h
+#define FontPlatformData_h
+
+#include "FontDescription.h"
+#include "FontOrientation.h"
+#include "StringImpl.h"
+#include <wtf/Forward.h>
+#include <wtf/RefPtr.h>
+#include <wtf/text/AtomicString.h>
+#include <wtf/text/CString.h>
+
+#include <wx/defs.h>
+#include <wx/font.h>
+#include <wx/gdicmn.h>
+
+#if OS(DARWIN)
+#include <ApplicationServices/ApplicationServices.h>
+
+#if __OBJC__
+@class NSFont;
+#else
+class NSFont;
+#endif
+
+#ifndef BUILDING_ON_TIGER
+inline CTFontRef toCTFontRef(NSFont *nsFont) { return reinterpret_cast<CTFontRef>(nsFont); }
+#endif
+
+#endif
+
+namespace WebCore {
+
+class FontHolder: public WTF::RefCounted<FontHolder>
+{
+public:
+ FontHolder()
+ : m_font(0)
+ {}
+
+ FontHolder(wxFont* font)
+ : m_font(font)
+ {}
+
+ wxFont* font() { return m_font; }
+
+private:
+ wxFont* m_font;
+};
+
+class FontPlatformData {
+public:
+ enum FontState { UNINITIALIZED, DELETED, VALID };
+
+ FontPlatformData(WTF::HashTableDeletedValueType)
+ : m_fontState(DELETED)
+ , m_font(0)
+ , m_size(0)
+#if OS(DARWIN)
+ , m_atsuFontID(0)
+#endif
+ { }
+
+ ~FontPlatformData();
+
+ FontPlatformData(const FontDescription&, const AtomicString&);
+
+ FontPlatformData(float size, bool bold, bool italic)
+ : m_fontState(UNINITIALIZED)
+ , m_font(0)
+ , m_size(size)
+#if OS(DARWIN)
+ , m_atsuFontID(0)
+#endif
+ {
+ }
+
+ FontPlatformData()
+ : m_fontState(UNINITIALIZED)
+ , m_font(0)
+ , m_size(0)
+#if OS(DARWIN)
+ , m_atsuFontID(0)
+#endif
+ {
+ }
+
+ wxFont* font() const {
+ return m_font->font();
+ }
+
+ unsigned hash() const {
+ switch (m_fontState) {
+ case DELETED:
+ return -1;
+ case UNINITIALIZED:
+ return 0;
+ case VALID:
+ return computeHash();
+ }
+ }
+
+ unsigned computeHash() const;
+
+ float size() const { return m_size; }
+
+ bool operator==(const FontPlatformData& other) const
+ {
+ if (m_font && m_fontState == VALID && other.m_fontState == VALID && other.m_font) {
+ wxFont* thisFont = m_font->font();
+ wxFont* otherFont = other.m_font->font();
+ return thisFont->IsOk() && otherFont->IsOk() && thisFont->IsSameAs(*otherFont);
+ }
+ else
+ return m_fontState == other.m_fontState;
+ }
+
+ bool isHashTableDeletedValue() const { return m_fontState == DELETED; }
+
+ bool roundsGlyphAdvances() const { return false; }
+
+ bool allowsLigatures() const { return false; }
+
+ FontOrientation orientation() const { return Horizontal; } // FIXME: Implement.
+
+#if OS(WINDOWS)
+ bool useGDI() const;
+ HFONT hfont() const;
+#endif
+
+#if OS(DARWIN)
+ ATSUFontID m_atsuFontID;
+ CGFontRef cgFont() const;
+ NSFont* nsFont() const { return m_nsFont; }
+ CTFontRef ctFont() const { return reinterpret_cast<CTFontRef>(m_nsFont); }
+ void cacheNSFont();
+#endif
+
+ float m_size;
+
+#ifndef NDEBUG
+ String description() const;
+#endif
+
+private:
+ WTF::RefPtr<FontHolder> m_font;
+ FontState m_fontState;
+#if OS(DARWIN)
+ NSFont* m_nsFont;
+#endif
+};
+
+}
+
+#endif
diff --git a/Source/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp b/Source/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp
new file mode 100644
index 0000000..66c69ee
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "FontPlatformData.h"
+
+#include "FontDescription.h"
+#include "PlatformString.h"
+#include <wx/defs.h>
+#include <wx/gdicmn.h>
+#include <wx/font.h>
+
+namespace WebCore {
+
+static wxFontFamily fontFamilyToWxFontFamily(const int family)
+{
+ switch (family) {
+ case FontDescription::StandardFamily:
+ return wxFONTFAMILY_DEFAULT;
+ case FontDescription::SerifFamily:
+ return wxFONTFAMILY_ROMAN;
+ case FontDescription::SansSerifFamily:
+ return wxFONTFAMILY_MODERN;
+ case FontDescription::MonospaceFamily:
+ return wxFONTFAMILY_TELETYPE; // TODO: Check these are equivalent
+ case FontDescription::CursiveFamily:
+ return wxFONTFAMILY_SCRIPT;
+ case FontDescription::FantasyFamily:
+ return wxFONTFAMILY_DECORATIVE;
+ default:
+ return wxFONTFAMILY_DEFAULT;
+ }
+}
+
+static wxFontWeight fontWeightToWxFontWeight(FontWeight weight)
+{
+ if (weight >= FontWeight600)
+ return wxFONTWEIGHT_BOLD;
+
+ if (weight <= FontWeight300)
+ return wxFONTWEIGHT_LIGHT;
+
+ return wxFONTWEIGHT_NORMAL;
+}
+
+static int italicToWxFontStyle(bool isItalic)
+{
+ if (isItalic)
+ return wxFONTSTYLE_ITALIC;
+
+ return wxFONTSTYLE_NORMAL;
+}
+
+FontPlatformData::FontPlatformData(const FontDescription& desc, const AtomicString& family)
+{
+// NB: The Windows wxFont constructor has two forms, one taking a wxSize (with pixels)
+// and one taking an int (points). When points are used, Windows calculates
+// a pixel size using an algorithm which causes the size to be way off. However,
+// this is a moot issue on Linux and Mac as they only accept the point argument. So,
+// we use the pixel size constructor on Windows, but we use point size on Linux and Mac.
+#if __WXMSW__
+ m_font = adoptRef(new FontHolder(new wxFont( wxSize(0, -desc.computedPixelSize()),
+ fontFamilyToWxFontFamily(desc.genericFamily()),
+ italicToWxFontStyle(desc.italic()),
+ fontWeightToWxFontWeight(desc.weight()),
+ false,
+ family.string()
+ )
+ ));
+#else
+ m_font = adoptRef(new FontHolder(new wxFont( desc.computedPixelSize(),
+ fontFamilyToWxFontFamily(desc.genericFamily()),
+ italicToWxFontStyle(desc.italic()),
+ fontWeightToWxFontWeight(desc.weight()),
+ false,
+ family.string()
+ )
+ ));
+#endif
+#if OS(DARWIN) && !defined(wxOSX_USE_CORE_TEXT)
+#if wxCHECK_VERSION(2,9,0)
+ m_atsuFontID = m_font->font()->OSXGetATSUFontID();
+#else
+ m_atsuFontID = m_font->font()->MacGetATSUFontID();
+#endif
+ m_nsFont = 0;
+ cacheNSFont();
+#endif
+ m_size = desc.computedPixelSize();
+ m_fontState = VALID;
+ m_size = desc.computedPixelSize();
+}
+
+unsigned FontPlatformData::computeHash() const
+{
+ wxFont* thisFont = m_font->font();
+ ASSERT(thisFont && thisFont->IsOk());
+
+ // make a hash that is unique for this font, but not globally unique - that is,
+ // a font whose properties are equal should generate the same hash
+ uintptr_t hashCodes[6] = {
+ thisFont->GetPointSize(),
+ thisFont->GetFamily(),
+ thisFont->GetStyle(),
+ thisFont->GetWeight(),
+ thisFont->GetUnderlined(),
+ StringImpl::computeHash(thisFont->GetFaceName().utf8_str())
+ };
+
+ return WTF::StringHasher::createBlobHash<sizeof(hashCodes)>(hashCodes);
+}
+
+FontPlatformData::~FontPlatformData()
+{
+ m_fontState = UNINITIALIZED;
+ m_font = 0;
+}
+
+#ifndef NDEBUG
+String FontPlatformData::description() const
+{
+ return String();
+}
+#endif
+
+#if OS(WINDOWS)
+bool FontPlatformData::useGDI() const
+{
+ return true;
+}
+
+HFONT FontPlatformData::hfont() const
+{
+ return static_cast<HFONT>(m_font->font()->GetHFONT());
+}
+#endif
+
+#if OS(DARWIN)
+CGFontRef FontPlatformData::cgFont() const
+{
+ CGFontRef cgFont = 0;
+#ifdef wxOSX_USE_CORE_TEXT && wxOSX_USE_CORE_TEXT
+ cgFont = CTFontCopyGraphicsFont((CTFontRef)m_font->font()->OSXGetCTFont(), 0);
+#else
+ ATSFontRef fontRef;
+
+ fontRef = FMGetATSFontRefFromFont(m_atsuFontID);
+
+ if (fontRef)
+ cgFont = CGFontCreateWithPlatformFont((void*)&fontRef);
+#endif
+ return cgFont;
+}
+#endif
+
+
+
+}
diff --git a/Source/WebCore/platform/graphics/wx/FontPlatformDataWxMac.mm b/Source/WebCore/platform/graphics/wx/FontPlatformDataWxMac.mm
new file mode 100644
index 0000000..4290f04
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/FontPlatformDataWxMac.mm
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2010 Kevin Ollivier, Stefan Csomor All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "FontPlatformData.h"
+
+#include <wx/defs.h>
+#include <wx/font.h>
+#include <wx/fontutil.h>
+
+#if !wxCHECK_VERSION(2,9,0)
+#include <wx/mac/private.h>
+#else
+#include <wx/osx/private.h>
+#endif
+
+#if !wxCHECK_VERSION(2,9,0) || !wxOSX_USE_COCOA
+
+static inline double DegToRad(double deg)
+{
+ return (deg * M_PI) / 180.0;
+}
+
+static const NSAffineTransformStruct kSlantNSTransformStruct = { 1, 0, tan(DegToRad(11)), 1, 0, 0 };
+
+NSFont* OSXCreateNSFont(const wxNativeFontInfo* info)
+{
+ NSFont* nsFont;
+ int weight = 5;
+ NSFontTraitMask traits = 0;
+ if (info->GetWeight() == wxFONTWEIGHT_BOLD)
+ {
+ traits |= NSBoldFontMask;
+ weight = 9;
+ }
+ else if (info->GetWeight() == wxFONTWEIGHT_LIGHT)
+ weight = 3;
+
+ if (info->GetStyle() == wxFONTSTYLE_ITALIC || info->GetStyle() == wxFONTSTYLE_SLANT)
+ traits |= NSItalicFontMask;
+
+ nsFont = [[NSFontManager sharedFontManager] fontWithFamily:(NSString*)(CFStringRef)wxMacCFStringHolder(info->GetFaceName())
+ traits:traits weight:weight size:info->GetPointSize()];
+
+ if ( nsFont == nil )
+ {
+ NSFontTraitMask remainingTraits = traits;
+ nsFont = [[NSFontManager sharedFontManager] fontWithFamily:(NSString*)(CFStringRef)wxMacCFStringHolder(info->GetFaceName())
+ traits:0 weight:5 size:info->GetPointSize()];
+ if ( nsFont == nil )
+ {
+ if ( info->GetWeight() == wxFONTWEIGHT_BOLD )
+ {
+ nsFont = [NSFont boldSystemFontOfSize:info->GetPointSize()];
+ remainingTraits &= ~NSBoldFontMask;
+ }
+ else
+ nsFont = [NSFont systemFontOfSize:info->GetPointSize()];
+ }
+
+ // fallback - if in doubt, let go of the bold attribute
+ if ( nsFont && (remainingTraits & NSItalicFontMask) )
+ {
+ NSFont* nsFontWithTraits = nil;
+ if ( remainingTraits & NSBoldFontMask)
+ {
+ nsFontWithTraits = [[NSFontManager sharedFontManager] convertFont:nsFont toHaveTrait:NSBoldFontMask];
+ if ( nsFontWithTraits == nil )
+ {
+ nsFontWithTraits = [[NSFontManager sharedFontManager] convertFont:nsFont toHaveTrait:NSItalicFontMask];
+ if ( nsFontWithTraits != nil )
+ remainingTraits &= ~NSItalicFontMask;
+ }
+ else
+ {
+ remainingTraits &= ~NSBoldFontMask;
+ }
+ }
+ if ( remainingTraits & NSItalicFontMask)
+ {
+ if ( nsFontWithTraits == nil )
+ nsFontWithTraits = nsFont;
+
+ NSAffineTransform* transform = [NSAffineTransform transform];
+ [transform setTransformStruct:kSlantNSTransformStruct];
+ [transform scaleBy:info->GetPointSize()];
+ NSFontDescriptor* italicDesc = [[nsFontWithTraits fontDescriptor] fontDescriptorWithMatrix:transform];
+ if ( italicDesc != nil )
+ {
+ NSFont* f = [NSFont fontWithDescriptor:italicDesc size:(CGFloat)(info->GetPointSize())];
+ if ( f != nil )
+ nsFontWithTraits = f;
+ }
+ }
+ if ( nsFontWithTraits != nil )
+ nsFont = nsFontWithTraits;
+ }
+ }
+
+ wxASSERT_MSG(nsFont != nil,wxT("Couldn't create nsFont")) ;
+ wxMacCocoaRetain(nsFont);
+ return nsFont;
+}
+
+#endif
+
+namespace WebCore {
+
+void FontPlatformData::cacheNSFont()
+{
+ if (m_nsFont)
+ return;
+
+#if wxCHECK_VERSION(2,9,1) && wxOSX_USE_COCOA
+ if (m_font && m_font->font())
+ m_nsFont = (NSFont*)m_font->font()->OSXGetNSFont();
+#else
+ m_nsFont = OSXCreateNSFont(m_font->font()->GetNativeFontInfo());
+#endif
+}
+
+}
diff --git a/Source/WebCore/platform/graphics/wx/FontWx.cpp b/Source/WebCore/platform/graphics/wx/FontWx.cpp
new file mode 100644
index 0000000..c01e249
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/FontWx.cpp
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Font.h"
+
+#include "FontFallbackList.h"
+#include "GlyphBuffer.h"
+#include "GraphicsContext.h"
+#include "IntRect.h"
+#include "NotImplemented.h"
+#include "SimpleFontData.h"
+
+#if OS(WINDOWS)
+#include "UniscribeController.h"
+typedef WebCore::UniscribeController ComplexTextController;
+#endif
+
+#if OS(DARWIN)
+#include "mac/ComplexTextController.h"
+#endif
+
+#include <wx/dcclient.h>
+#include "fontprops.h"
+#include "non-kerned-drawing.h"
+
+namespace WebCore {
+
+bool Font::canReturnFallbackFontsForComplexText()
+{
+#if OS(WINDOWS) || OS(DARWIN)
+ return true;
+#else
+ return false;
+#endif
+}
+
+void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* font, const GlyphBuffer& glyphBuffer,
+ int from, int numGlyphs, const FloatPoint& point) const
+{
+ // prepare DC
+ Color color = graphicsContext->fillColor();
+
+ // We can't use wx drawing methods on Win/Linux because they automatically kern text
+ // so we've created a function with platform dependent drawing implementations that
+ // will hopefully be folded into wx once the API has solidified.
+ // see platform/wx/wxcode/<platform> for the implementations.
+ drawTextWithSpacing(graphicsContext, font, color, glyphBuffer, from, numGlyphs, point);
+}
+
+FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const
+{
+#if OS(WINDOWS) || OS(DARWIN)
+ ComplexTextController it(this, run);
+ it.advance(from);
+ float beforeWidth = it.runWidthSoFar();
+ it.advance(to);
+ float afterWidth = it.runWidthSoFar();
+
+ // Using roundf() rather than ceilf() for the right edge as a compromise to ensure correct caret positioning
+ if (run.rtl()) {
+#if OS(WINDOWS)
+ it.advance(run.length());
+ float totalWidth = it.runWidthSoFar();
+ return FloatRect(point.x() + floorf(totalWidth - afterWidth), point.y(), roundf(totalWidth - beforeWidth) - floorf(totalWidth - afterWidth), h);
+#else
+ float totalWidth = it.totalWidth();
+ return FloatRect(point.x() + floorf(totalWidth - afterWidth), point.y(), roundf(totalWidth - beforeWidth) - floorf(totalWidth - afterWidth), h);
+#endif
+ }
+
+ return FloatRect(point.x() + floorf(beforeWidth), point.y(), roundf(afterWidth) - floorf(beforeWidth), h);
+#else
+ notImplemented();
+ return FloatRect();
+#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)
+ // This glyph buffer holds our glyphs + advances + font data for each glyph.
+ GlyphBuffer glyphBuffer;
+
+ float startX = point.x();
+ ComplexTextController controller(this, run);
+ controller.advance(from);
+ float beforeWidth = controller.runWidthSoFar();
+ controller.advance(to, &glyphBuffer);
+
+ // We couldn't generate any glyphs for the run. Give up.
+ if (glyphBuffer.isEmpty())
+ return;
+
+ float afterWidth = controller.runWidthSoFar();
+
+ if (run.rtl()) {
+#if OS(WINDOWS)
+ controller.advance(run.length());
+ startX += controller.runWidthSoFar() - afterWidth;
+#else
+ startX += controller.totalWidth() + controller.finalRoundingWidth() - afterWidth;
+ for (int i = 0, end = glyphBuffer.size() - 1; i < glyphBuffer.size() / 2; ++i, --end)
+ glyphBuffer.swap(i, end);
+#endif
+ } else
+ startX += beforeWidth;
+
+ // Draw the glyph buffer now at the starting point returned in startX.
+ FloatPoint startPoint(startX, point.y());
+ 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
+{
+#if OS(WINDOWS) || OS(DARWIN)
+ ComplexTextController controller(this, run, fallbackFonts);
+#if OS(WINDOWS)
+ controller.advance(run.length());
+ return controller.runWidthSoFar();
+#else
+ return controller.totalWidth();
+#endif
+#else
+ notImplemented();
+ return 0;
+#endif
+}
+
+int Font::offsetForPositionForComplexText(const TextRun& run, float x, bool includePartialGlyphs) const
+{
+#if OS(WINDOWS) || OS(DARWIN)
+ ComplexTextController controller(this, run);
+ return controller.offsetForPosition(x, includePartialGlyphs);
+#else
+ notImplemented();
+ return 0;
+#endif
+}
+}
diff --git a/Source/WebCore/platform/graphics/wx/GlyphMapWx.cpp b/Source/WebCore/platform/graphics/wx/GlyphMapWx.cpp
new file mode 100644
index 0000000..ebf86e4
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/GlyphMapWx.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GlyphPageTreeNode.h"
+
+#include "SimpleFontData.h"
+#include <unicode/utf16.h>
+
+namespace WebCore
+{
+
+bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
+{
+ bool isUtf16 = bufferLength != length;
+
+ for (unsigned i = 0; i < length; i++) {
+ UChar32 character;
+
+ if(isUtf16) {
+ UChar lead = buffer[i * 2];
+ UChar trail = buffer[i * 2 + 1];
+ character = U16_GET_SUPPLEMENTARY(lead, trail);
+ } else {
+ character = buffer[i];
+ }
+
+ setGlyphDataForIndex(offset + i, character, fontData);
+ }
+
+ return true;
+}
+
+} \ No newline at end of file
diff --git a/Source/WebCore/platform/graphics/wx/GradientWx.cpp b/Source/WebCore/platform/graphics/wx/GradientWx.cpp
new file mode 100644
index 0000000..fc4661e
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/GradientWx.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2008 Kevin Ollivier <kevino@theolliviers.com> All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Gradient.h"
+
+#include "CSSParser.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+void Gradient::platformDestroy()
+{
+ notImplemented();
+}
+
+PlatformGradient Gradient::platformGradient()
+{
+ notImplemented();
+ return 0;
+}
+
+void Gradient::fill(GraphicsContext*, const FloatRect&)
+{
+ notImplemented();
+}
+
+} //namespace
diff --git a/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
new file mode 100644
index 0000000..cee6aee
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
@@ -0,0 +1,666 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GraphicsContext.h"
+
+#include "AffineTransform.h"
+#include "FloatRect.h"
+#include "Font.h"
+#include "IntRect.h"
+#include "NotImplemented.h"
+#include "Pen.h"
+#include <wtf/MathExtras.h>
+
+#include <math.h>
+#include <stdio.h>
+
+#include <wx/defs.h>
+#include <wx/window.h>
+#include <wx/dcclient.h>
+#include <wx/dcgraph.h>
+#include <wx/graphics.h>
+
+#if __WXMAC__
+#include <Carbon/Carbon.h>
+#elif __WXMSW__
+#include <windows.h>
+#endif
+
+namespace WebCore {
+
+int getWxCompositingOperation(CompositeOperator op, bool hasAlpha)
+{
+ // FIXME: Add support for more operators.
+ if (op == CompositeSourceOver && !hasAlpha)
+ op = CompositeCopy;
+
+ int function;
+ switch (op) {
+ case CompositeClear:
+ function = wxCLEAR;
+ case CompositeCopy:
+ function = wxCOPY;
+ break;
+ default:
+ function = wxCOPY;
+ }
+ return function;
+}
+
+static int strokeStyleToWxPenStyle(int p)
+{
+ if (p == SolidStroke)
+ return wxSOLID;
+ if (p == DottedStroke)
+ return wxDOT;
+ if (p == DashedStroke)
+ return wxLONG_DASH;
+ if (p == NoStroke)
+ return wxTRANSPARENT;
+
+ return wxSOLID;
+}
+
+class GraphicsContextPlatformPrivate {
+public:
+ GraphicsContextPlatformPrivate();
+ ~GraphicsContextPlatformPrivate();
+
+#if USE(WXGC)
+ wxGCDC* context;
+#else
+ wxWindowDC* context;
+#endif
+ int mswDCStateID;
+ wxRegion gtkCurrentClipRgn;
+ wxRegion gtkPaintClipRgn;
+};
+
+GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate() :
+ context(0),
+ mswDCStateID(0),
+ gtkCurrentClipRgn(wxRegion()),
+ gtkPaintClipRgn(wxRegion())
+{
+}
+
+GraphicsContextPlatformPrivate::~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);
+ setPlatformStrokeColor(strokeColor(), ColorSpaceDeviceRGB);
+ }
+#if USE(WXGC)
+ m_data->context = (wxGCDC*)context;
+#else
+ m_data->context = (wxWindowDC*)context;
+#endif
+}
+
+void GraphicsContext::platformDestroy()
+{
+ delete m_data;
+}
+
+PlatformGraphicsContext* GraphicsContext::platformContext() const
+{
+ return (PlatformGraphicsContext*)m_data->context;
+}
+
+void GraphicsContext::savePlatformState()
+{
+ if (m_data->context)
+ {
+#if USE(WXGC)
+ wxGraphicsContext* gc = m_data->context->GetGraphicsContext();
+ gc->PushState();
+#else
+ // when everything is working with USE_WXGC, we can remove this
+ #if __WXMAC__
+ CGContextRef context;
+ wxGraphicsContext* gc = m_data->context->GetGraphicsContext();
+ if (gc)
+ context = (CGContextRef)gc->GetNativeContext();
+ if (context)
+ CGContextSaveGState(context);
+ #elif __WXMSW__
+ HDC dc = (HDC)m_data->context->GetHDC();
+ m_data->mswDCStateID = ::SaveDC(dc);
+ #elif __WXGTK__
+ m_data->gtkCurrentClipRgn = m_data->context->m_currentClippingRegion;
+ m_data->gtkPaintClipRgn = m_data->context->m_paintClippingRegion;
+ #endif
+#endif // __WXMAC__
+ }
+}
+
+void GraphicsContext::restorePlatformState()
+{
+ if (m_data->context)
+ {
+#if USE(WXGC)
+ wxGraphicsContext* gc = m_data->context->GetGraphicsContext();
+ gc->PopState();
+#else
+ #if __WXMAC__
+ CGContextRef context;
+ wxGraphicsContext* gc = m_data->context->GetGraphicsContext();
+ if (gc)
+ context = (CGContextRef)gc->GetNativeContext();
+ if (context)
+ CGContextRestoreGState(context);
+ #elif __WXMSW__
+ HDC dc = (HDC)m_data->context->GetHDC();
+ ::RestoreDC(dc, m_data->mswDCStateID);
+ #elif __WXGTK__
+ m_data->context->m_currentClippingRegion = m_data->gtkCurrentClipRgn;
+ m_data->context->m_paintClippingRegion = m_data->gtkPaintClipRgn;
+ #endif
+
+#endif // USE_WXGC
+ }
+}
+
+// Draws a filled rectangle with a stroked border.
+void GraphicsContext::drawRect(const IntRect& rect)
+{
+ if (paintingDisabled())
+ return;
+
+ m_data->context->SetPen(wxPen(strokeColor(), strokeThickness(), strokeStyleToWxPenStyle(strokeStyle())));
+ m_data->context->DrawRectangle(rect.x(), rect.y(), rect.width(), rect.height());
+}
+
+// This is only used to draw borders.
+void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
+{
+ if (paintingDisabled())
+ return;
+
+ FloatPoint p1 = point1;
+ FloatPoint p2 = point2;
+
+ m_data->context->SetPen(wxPen(strokeColor(), strokeThickness(), strokeStyleToWxPenStyle(strokeStyle())));
+ m_data->context->DrawLine(point1.x(), point1.y(), point2.x(), point2.y());
+}
+
+// This method is only used to draw the little circles used in lists.
+void GraphicsContext::drawEllipse(const IntRect& rect)
+{
+ if (paintingDisabled())
+ return;
+
+ m_data->context->SetPen(wxPen(strokeColor(), strokeThickness(), strokeStyleToWxPenStyle(strokeStyle())));
+ m_data->context->DrawEllipse(rect.x(), rect.y(), rect.width(), rect.height());
+}
+
+void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSpan)
+{
+ if (paintingDisabled())
+ return;
+
+ m_data->context->SetPen(wxPen(strokeColor(), strokeThickness(), strokeStyleToWxPenStyle(strokeStyle())));
+ m_data->context->DrawEllipticArc(rect.x(), rect.y(), rect.width(), rect.height(), startAngle, angleSpan);
+}
+
+void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points, bool shouldAntialias)
+{
+ if (paintingDisabled())
+ return;
+
+ if (npoints <= 1)
+ return;
+
+ wxPoint* polygon = new wxPoint[npoints];
+ for (size_t i = 0; i < npoints; i++)
+ polygon[i] = wxPoint(points[i].x(), points[i].y());
+ m_data->context->SetPen(wxPen(strokeColor(), strokeThickness(), strokeStyleToWxPenStyle(strokeStyle())));
+ m_data->context->DrawPolygon((int)npoints, polygon);
+ delete [] polygon;
+}
+
+void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* points, bool antialiased)
+{
+ if (paintingDisabled())
+ return;
+
+ if (numPoints <= 1)
+ return;
+
+ // FIXME: IMPLEMENT!!
+}
+
+void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorSpace colorSpace)
+{
+ if (paintingDisabled())
+ return;
+
+ savePlatformState();
+
+ m_data->context->SetPen(*wxTRANSPARENT_PEN);
+ m_data->context->SetBrush(wxBrush(color));
+ m_data->context->DrawRectangle(rect.x(), rect.y(), rect.width(), rect.height());
+
+ restorePlatformState();
+}
+
+void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& color, ColorSpace colorSpace)
+{
+ if (paintingDisabled())
+ return;
+
+ notImplemented();
+}
+
+void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color)
+{
+ // FIXME: implement
+}
+
+void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color)
+{
+ if (paintingDisabled())
+ return;
+
+ notImplemented();
+}
+
+void GraphicsContext::clip(const FloatRect& r)
+{
+ wxWindowDC* windc = dynamic_cast<wxWindowDC*>(m_data->context);
+ wxPoint pos(0, 0);
+
+ if (windc) {
+#if !defined(__WXGTK__) || wxCHECK_VERSION(2,9,0)
+ wxWindow* window = windc->GetWindow();
+#else
+ wxWindow* window = windc->m_owner;
+#endif
+ if (window) {
+ wxWindow* parent = window->GetParent();
+ // we need to convert from WebView "global" to WebFrame "local" coords.
+ // FIXME: We only want to go to the top WebView.
+ while (parent) {
+ pos += window->GetPosition();
+ parent = parent->GetParent();
+ }
+ }
+ }
+
+ m_data->context->SetClippingRegion(r.x() - pos.x, r.y() - pos.y, r.width() + pos.x, r.height() + pos.y);
+}
+
+void GraphicsContext::clipOut(const Path&)
+{
+ notImplemented();
+}
+
+void GraphicsContext::clipOut(const IntRect&)
+{
+ notImplemented();
+}
+
+void GraphicsContext::clipPath(const Path&, WindRule)
+{
+ notImplemented();
+}
+
+void GraphicsContext::drawLineForText(const IntPoint& origin, int width, bool printing)
+{
+ if (paintingDisabled())
+ return;
+
+ IntPoint endPoint = origin + IntSize(width, 0);
+ m_data->context->SetPen(wxPen(strokeColor(), strokeThickness(), wxSOLID));
+ m_data->context->DrawLine(origin.x(), origin.y(), endPoint.x(), endPoint.y());
+}
+
+void GraphicsContext::drawLineForTextChecking(const IntPoint& origin, int width, TextCheckingLineStyle style)
+{
+ switch (style) {
+ case TextCheckingSpellingLineStyle:
+ m_data->context->SetPen(wxPen(*wxRED, 2, wxLONG_DASH));
+ break;
+ case TextCheckingGrammarLineStyle:
+ m_data->context->SetPen(wxPen(*wxGREEN, 2, wxLONG_DASH));
+ break;
+ default:
+ return;
+ }
+ m_data->context->DrawLine(origin.x(), origin.y(), origin.x() + width, origin.y());
+}
+
+void GraphicsContext::clip(const Path&)
+{
+ notImplemented();
+}
+
+void GraphicsContext::canvasClip(const Path& path)
+{
+ clip(path);
+}
+
+AffineTransform GraphicsContext::getCTM() const
+{
+#if USE(WXGC)
+ wxGraphicsContext* gc = m_data->context->GetGraphicsContext();
+ if (gc) {
+ wxGraphicsMatrix matrix = gc->GetTransform();
+ double a, b, c, d, e, f;
+ matrix.Get(&a, &b, &c, &d, &e, &f);
+ return AffineTransform(a, b, c, d, e, f);
+ }
+#endif
+ return AffineTransform();
+}
+
+void GraphicsContext::translate(float tx, float ty)
+{
+#if USE(WXGC)
+ if (m_data->context) {
+ wxGraphicsContext* gc = m_data->context->GetGraphicsContext();
+ gc->Translate(tx, ty);
+ }
+#endif
+}
+
+void GraphicsContext::rotate(float angle)
+{
+#if USE(WXGC)
+ if (m_data->context) {
+ wxGraphicsContext* gc = m_data->context->GetGraphicsContext();
+ gc->Rotate(angle);
+ }
+#endif
+}
+
+void GraphicsContext::scale(const FloatSize& scale)
+{
+#if USE(WXGC)
+ if (m_data->context) {
+ wxGraphicsContext* gc = m_data->context->GetGraphicsContext();
+ gc->Scale(scale.width(), scale.height());
+ }
+#endif
+}
+
+
+FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect)
+{
+ FloatRect result;
+
+ wxCoord x = (wxCoord)frect.x();
+ wxCoord y = (wxCoord)frect.y();
+
+ x = m_data->context->LogicalToDeviceX(x);
+ y = m_data->context->LogicalToDeviceY(y);
+ result.setX((float)x);
+ result.setY((float)y);
+ x = (wxCoord)frect.width();
+ y = (wxCoord)frect.height();
+ x = m_data->context->LogicalToDeviceXRel(x);
+ y = m_data->context->LogicalToDeviceYRel(y);
+ result.setWidth((float)x);
+ result.setHeight((float)y);
+ return result;
+}
+
+void GraphicsContext::setURLForRect(const KURL&, const IntRect&)
+{
+ notImplemented();
+}
+
+void GraphicsContext::setPlatformCompositeOperation(CompositeOperator op)
+{
+ if (m_data->context)
+ {
+#if wxCHECK_VERSION(2,9,0)
+ m_data->context->SetLogicalFunction(static_cast<wxRasterOperationMode>(getWxCompositingOperation(op, false)));
+#else
+ m_data->context->SetLogicalFunction(getWxCompositingOperation(op, false));
+#endif
+ }
+}
+
+void GraphicsContext::setPlatformStrokeColor(const Color& color, ColorSpace colorSpace)
+{
+ if (paintingDisabled())
+ return;
+
+ if (m_data->context)
+ m_data->context->SetPen(wxPen(color, strokeThickness(), strokeStyleToWxPenStyle(strokeStyle())));
+}
+
+void GraphicsContext::setPlatformStrokeThickness(float thickness)
+{
+ if (paintingDisabled())
+ return;
+
+ if (m_data->context)
+ m_data->context->SetPen(wxPen(strokeColor(), thickness, strokeStyleToWxPenStyle(strokeStyle())));
+
+}
+
+void GraphicsContext::setPlatformFillColor(const Color& color, ColorSpace colorSpace)
+{
+ if (paintingDisabled())
+ return;
+
+ if (m_data->context)
+ m_data->context->SetBrush(wxBrush(color));
+}
+
+void GraphicsContext::concatCTM(const AffineTransform& transform)
+{
+ if (paintingDisabled())
+ return;
+
+#if USE(WXGC)
+ wxGraphicsContext* gc = m_data->context->GetGraphicsContext();
+ if (gc)
+ gc->ConcatTransform(transform);
+#endif
+ return;
+}
+
+void GraphicsContext::setPlatformShouldAntialias(bool enable)
+{
+ if (paintingDisabled())
+ return;
+ notImplemented();
+}
+
+void GraphicsContext::setImageInterpolationQuality(InterpolationQuality)
+{
+}
+
+InterpolationQuality GraphicsContext::imageInterpolationQuality() const
+{
+ return InterpolationDefault;
+}
+
+void GraphicsContext::fillPath(const Path& path)
+{
+#if USE(WXGC)
+ wxGraphicsContext* gc = m_data->context->GetGraphicsContext();
+ if (gc)
+ gc->FillPath(path.platformPath());
+#endif
+}
+
+void GraphicsContext::strokePath(const Path& path)
+{
+#if USE(WXGC)
+ wxGraphicsContext* gc = m_data->context->GetGraphicsContext();
+ if (gc)
+ gc->StrokePath(path.platformPath());
+#endif
+}
+
+void GraphicsContext::fillRect(const FloatRect& rect)
+{
+ if (paintingDisabled())
+ return;
+}
+
+void GraphicsContext::setPlatformShadow(FloatSize const&, float, Color const&, ColorSpace)
+{
+ notImplemented();
+}
+
+void GraphicsContext::clearPlatformShadow()
+{
+ notImplemented();
+}
+
+void GraphicsContext::beginTransparencyLayer(float)
+{
+ notImplemented();
+}
+
+void GraphicsContext::endTransparencyLayer()
+{
+ notImplemented();
+}
+
+void GraphicsContext::clearRect(const FloatRect&)
+{
+ notImplemented();
+}
+
+void GraphicsContext::strokeRect(const FloatRect&, float)
+{
+ notImplemented();
+}
+
+void GraphicsContext::setLineCap(LineCap)
+{
+ notImplemented();
+}
+
+void GraphicsContext::setLineDash(const DashArray&, float dashOffset)
+{
+ notImplemented();
+}
+
+void GraphicsContext::setLineJoin(LineJoin)
+{
+ notImplemented();
+}
+
+void GraphicsContext::setMiterLimit(float)
+{
+ notImplemented();
+}
+
+void GraphicsContext::setAlpha(float)
+{
+ notImplemented();
+}
+
+void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness)
+{
+ notImplemented();
+}
+
+#if OS(WINDOWS)
+HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap)
+{
+ if (dstRect.isEmpty())
+ return 0;
+
+ // Create a bitmap DC in which to draw.
+ BITMAPINFO bitmapInfo;
+ bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bitmapInfo.bmiHeader.biWidth = dstRect.width();
+ bitmapInfo.bmiHeader.biHeight = dstRect.height();
+ bitmapInfo.bmiHeader.biPlanes = 1;
+ bitmapInfo.bmiHeader.biBitCount = 32;
+ bitmapInfo.bmiHeader.biCompression = BI_RGB;
+ bitmapInfo.bmiHeader.biSizeImage = 0;
+ bitmapInfo.bmiHeader.biXPelsPerMeter = 0;
+ bitmapInfo.bmiHeader.biYPelsPerMeter = 0;
+ bitmapInfo.bmiHeader.biClrUsed = 0;
+ bitmapInfo.bmiHeader.biClrImportant = 0;
+
+ void* pixels = 0;
+ HBITMAP bitmap = ::CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, &pixels, 0, 0);
+ if (!bitmap)
+ return 0;
+
+ HDC displayDC = ::GetDC(0);
+ HDC bitmapDC = ::CreateCompatibleDC(displayDC);
+ ::ReleaseDC(0, displayDC);
+
+ ::SelectObject(bitmapDC, bitmap);
+
+ // Fill our buffer with clear if we're going to alpha blend.
+ if (supportAlphaBlend) {
+ BITMAP bmpInfo;
+ GetObject(bitmap, sizeof(bmpInfo), &bmpInfo);
+ int bufferSize = bmpInfo.bmWidthBytes * bmpInfo.bmHeight;
+ memset(bmpInfo.bmBits, 0, bufferSize);
+ }
+ return bitmapDC;
+}
+
+void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap)
+{
+ if (hdc) {
+
+ if (!dstRect.isEmpty()) {
+
+ HBITMAP bitmap = static_cast<HBITMAP>(GetCurrentObject(hdc, OBJ_BITMAP));
+ BITMAP info;
+ GetObject(bitmap, sizeof(info), &info);
+ ASSERT(info.bmBitsPixel == 32);
+
+ wxBitmap bmp;
+ bmp.SetHBITMAP(bitmap);
+#if !wxCHECK_VERSION(2,9,0)
+ if (supportAlphaBlend)
+ bmp.UseAlpha();
+#endif
+ m_data->context->DrawBitmap(bmp, dstRect.x(), dstRect.y(), supportAlphaBlend);
+
+ ::DeleteObject(bitmap);
+ }
+
+ ::DeleteDC(hdc);
+ }
+}
+#endif
+
+}
diff --git a/Source/WebCore/platform/graphics/wx/IconWx.cpp b/Source/WebCore/platform/graphics/wx/IconWx.cpp
new file mode 100644
index 0000000..d3cc961
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/IconWx.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "Icon.h"
+
+#include "GraphicsContext.h"
+#include "PlatformString.h"
+#include "IntRect.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+Icon::~Icon()
+{
+}
+
+PassRefPtr<Icon> Icon::createIconForFiles(const Vector<String>& filenames)
+{
+ notImplemented();
+ return 0;
+}
+
+void Icon::paint(GraphicsContext* ctx, const IntRect& rect)
+{
+ notImplemented();
+}
+
+}
+
diff --git a/Source/WebCore/platform/graphics/wx/ImageBufferData.h b/Source/WebCore/platform/graphics/wx/ImageBufferData.h
new file mode 100644
index 0000000..d4a6114
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/ImageBufferData.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2008 Kevin Ollivier. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ImageBufferData_h
+#define ImageBufferData_h
+
+
+#include "OwnPtr.h"
+
+namespace WebCore {
+
+class IntSize;
+
+class ImageBufferData {
+public:
+ ImageBufferData(const IntSize&);
+};
+
+} // namespace WebCore
+
+#endif // ImageBufferData_h
diff --git a/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp b/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp
new file mode 100644
index 0000000..ba33287
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com>
+ * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ImageBuffer.h"
+
+#include "GraphicsContext.h"
+#include "ImageData.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+ImageBufferData::ImageBufferData(const IntSize&)
+{
+}
+
+ImageBuffer::ImageBuffer(const IntSize&, ColorSpace imageColorSpace, RenderingMode, bool& success) :
+ m_data(IntSize())
+{
+ notImplemented();
+ success = false;
+}
+
+ImageBuffer::~ImageBuffer()
+{
+}
+
+GraphicsContext* ImageBuffer::context() const
+{
+ notImplemented();
+ return 0;
+}
+
+PassRefPtr<ByteArray> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const
+{
+ notImplemented();
+ return 0;
+}
+
+PassRefPtr<ByteArray> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const
+{
+ notImplemented();
+ return 0;
+}
+
+void ImageBuffer::putUnmultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint)
+{
+ notImplemented();
+}
+
+void ImageBuffer::putPremultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint)
+{
+ notImplemented();
+}
+
+String ImageBuffer::toDataURL(const String&, const double*) const
+{
+ notImplemented();
+ return String();
+}
+
+bool ImageBuffer::drawsUsingCopy() const
+{
+ return true;
+}
+
+PassRefPtr<Image> ImageBuffer::copyImage() const
+{
+ notImplemented();
+ return 0;
+}
+
+void ImageBuffer::clip(GraphicsContext*, const FloatRect&) const
+{
+ notImplemented();
+}
+
+void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect,
+ CompositeOperator op, bool useLowQualityScale)
+{
+ RefPtr<Image> imageCopy = copyImage();
+ context->drawImage(imageCopy.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale);
+}
+
+void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform,
+ const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
+{
+ RefPtr<Image> imageCopy = copyImage();
+ imageCopy->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
+}
+
+void ImageBuffer::platformTransformColorSpace(const Vector<int>&)
+{
+ notImplemented();
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/wx/ImageWx.cpp b/Source/WebCore/platform/graphics/wx/ImageWx.cpp
new file mode 100644
index 0000000..b51bde8
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/ImageWx.cpp
@@ -0,0 +1,264 @@
+/*
+ * Copyright (C) 2007 Apple Computer, Kevin Ollivier. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Image.h"
+
+#include "AffineTransform.h"
+#include "BitmapImage.h"
+#include "FloatConversion.h"
+#include "FloatRect.h"
+#include "GraphicsContext.h"
+#include "ImageObserver.h"
+#include "NotImplemented.h"
+#include "SharedBuffer.h"
+
+#include <math.h>
+#include <stdio.h>
+
+#include <wx/defs.h>
+#include <wx/bitmap.h>
+#include <wx/dc.h>
+#include <wx/dcmemory.h>
+#include <wx/dcgraph.h>
+#include <wx/graphics.h>
+#include <wx/image.h>
+#include <wx/thread.h>
+
+namespace WebCore {
+
+// this is in GraphicsContextWx.cpp
+int getWxCompositingOperation(CompositeOperator op, bool hasAlpha);
+
+bool FrameData::clear(bool clearMetadata)
+{
+ if (clearMetadata)
+ m_haveMetadata = false;
+
+ if (m_frame) {
+ delete m_frame;
+ m_frame = 0;
+ return true;
+ }
+ return false;
+}
+
+// ================================================
+// Image Class
+// ================================================
+
+PassRefPtr<Image> Image::loadPlatformResource(const char *name)
+{
+ // FIXME: We need to have some 'placeholder' graphics for things like missing
+ // plugins or broken images.
+ Vector<char> arr;
+ RefPtr<Image> img = BitmapImage::create();
+ RefPtr<SharedBuffer> buffer = SharedBuffer::create(arr.data(), arr.size());
+ img->setData(buffer, true);
+ return img.release();
+}
+
+void BitmapImage::initPlatformData()
+{
+ // FIXME: NYI
+}
+
+// Drawing Routines
+
+void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatRect& src, ColorSpace styleColorSpace, CompositeOperator op)
+{
+ if (!m_source.initialized())
+ return;
+
+ if (mayFillWithSolidColor()) {
+ fillWithSolidColor(ctxt, dst, solidColor(), styleColorSpace, op);
+ return;
+ }
+
+#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();
+ if (!bitmap) // If it's too early we won't have an image yet.
+ return;
+
+ // If we're drawing a sub portion of the image or scaling then create
+ // a pattern transformation on the image and draw the transformed pattern.
+ // Test using example site at http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html
+ // FIXME: NYI
+
+ ctxt->save();
+
+ // Set the compositing operation.
+ ctxt->setCompositeOperation(op);
+
+#if USE(WXGC)
+ float scaleX = src.width() / dst.width();
+ float scaleY = src.height() / dst.height();
+
+ FloatRect adjustedDestRect = dst;
+ FloatSize selfSize = currentFrameSize();
+
+ if (src.size() != selfSize) {
+ adjustedDestRect.setLocation(FloatPoint(dst.x() - src.x() / scaleX, dst.y() - src.y() / scaleY));
+ adjustedDestRect.setSize(FloatSize(selfSize.width() / scaleX, selfSize.height() / scaleY));
+ }
+
+ 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());
+#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;
+ if ((dstIntRect.width() != srcIntRect.width()) || (dstIntRect.height() != srcIntRect.height()))
+ {
+ rescaling = true;
+ wxImage img = bitmap->ConvertToImage();
+ img.Rescale(dstIntRect.width(), dstIntRect.height());
+ bitmap = new wxBitmap(img);
+ }
+
+ wxMemoryDC mydc;
+ ASSERT(bitmap->GetRefData());
+ mydc.SelectObject(*bitmap);
+
+ context->Blit((wxCoord)dstIntRect.x(),(wxCoord)dstIntRect.y(), (wxCoord)dstIntRect.width(), (wxCoord)dstIntRect.height(), &mydc,
+ (wxCoord)srcIntRect.x(), (wxCoord)srcIntRect.y(), wxCOPY, true);
+ mydc.SelectObject(wxNullBitmap);
+
+ // NB: delete is causing crashes during page load, but not during the deletion
+ // itself. It occurs later on when a valid bitmap created in frameAtIndex
+ // suddenly becomes invalid after returning. It's possible these errors deal
+ // with reentrancy and threding problems.
+ //delete bitmap;
+ if (rescaling)
+ {
+ delete bitmap;
+ bitmap = NULL;
+ }
+#endif
+
+ ctxt->restore();
+
+ if (ImageObserver* observer = imageObserver())
+ observer->didDraw(this);
+}
+
+void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace, CompositeOperator, const FloatRect& dstRect)
+{
+
+
+#if USE(WXGC)
+ wxGCDC* context = (wxGCDC*)ctxt->platformContext();
+ wxGraphicsBitmap* bitmap = nativeImageForCurrentFrame();
+#else
+ wxWindowDC* context = ctxt->platformContext();
+ wxBitmap* bitmap = nativeImageForCurrentFrame();
+#endif
+
+ 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;
+ mydc.SelectObject(*bitmap);
+#endif
+
+ wxPoint origin(context->GetDeviceOrigin());
+ wxSize clientSize(context->GetSize());
+
+ while ( currentW < dstRect.width() && currentW < clientSize.x - origin.x ) {
+ while ( currentH < dstRect.height() && currentH < clientSize.y - origin.y) {
+#if USE(WXGC)
+#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,
+ (wxCoord)srcRect.x(), (wxCoord)srcRect.y(), wxCOPY, true);
+#endif
+ currentH += srcRect.height();
+ }
+ currentW += srcRect.width();
+ currentH = 0;
+ }
+ ctxt->restore();
+
+#if !USE(WXGC)
+ mydc.SelectObject(wxNullBitmap);
+#endif
+
+ // NB: delete is causing crashes during page load, but not during the deletion
+ // itself. It occurs later on when a valid bitmap created in frameAtIndex
+ // suddenly becomes invalid after returning. It's possible these errors deal
+ // with reentrancy and threding problems.
+ //delete bitmap;
+
+ startAnimation();
+
+ if (ImageObserver* observer = imageObserver())
+ observer->didDraw(this);
+}
+
+void BitmapImage::checkForSolidColor()
+{
+ m_checkedForSolidColor = true;
+}
+
+void BitmapImage::invalidatePlatformData()
+{
+
+}
+
+}
diff --git a/Source/WebCore/platform/graphics/wx/IntPointWx.cpp b/Source/WebCore/platform/graphics/wx/IntPointWx.cpp
new file mode 100644
index 0000000..389ac9f
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/IntPointWx.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2006, 2007 Kevin Ollivier <kevino@theolliviers.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IntPoint.h"
+
+#include <wx/defs.h>
+#include <wx/gdicmn.h>
+
+namespace WebCore {
+
+IntPoint::IntPoint(const wxPoint& p)
+ : m_x(p.x)
+ , m_y(p.y)
+{
+}
+
+IntPoint::operator wxPoint() const
+{
+ return wxPoint(m_x, m_y);
+}
+
+}
diff --git a/Source/WebCore/platform/graphics/wx/IntRectWx.cpp b/Source/WebCore/platform/graphics/wx/IntRectWx.cpp
new file mode 100644
index 0000000..10c1b55
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/IntRectWx.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2006, 2007 Kevin Ollivier <kevino@theolliviers.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IntRect.h"
+
+#include <wx/defs.h>
+#include <wx/gdicmn.h>
+
+namespace WebCore {
+
+IntRect::IntRect(const wxRect& r)
+ : m_location(IntPoint(r.x, r.y))
+ , m_size(IntSize(r.width, r.height))
+{
+}
+
+IntRect::operator wxRect() const
+{
+ return wxRect(x(), y(), width(), height());
+}
+
+}
diff --git a/Source/WebCore/platform/graphics/wx/IntSizeWx.cpp b/Source/WebCore/platform/graphics/wx/IntSizeWx.cpp
new file mode 100644
index 0000000..8c82854
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/IntSizeWx.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2009 Kevin Watters. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IntSize.h"
+
+#include <wx/defs.h>
+#include <wx/gdicmn.h>
+
+namespace WebCore {
+
+IntSize::IntSize(const wxSize& s)
+ : m_width(s.x)
+ , m_height(s.y)
+{
+}
+
+IntSize::operator wxSize() const
+{
+ return wxSize(m_width, m_height);
+}
+
+}
diff --git a/Source/WebCore/platform/graphics/wx/PathWx.cpp b/Source/WebCore/platform/graphics/wx/PathWx.cpp
new file mode 100644
index 0000000..f5355f2
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/PathWx.cpp
@@ -0,0 +1,249 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Path.h"
+
+#include "AffineTransform.h"
+#include "FloatPoint.h"
+#include "FloatRect.h"
+#include "NotImplemented.h"
+#include "PlatformString.h"
+#include "StrokeStyleApplier.h"
+
+#include <stdio.h>
+
+#include <wx/defs.h>
+#include <wx/graphics.h>
+
+namespace WebCore {
+
+int getWxWindRuleForWindRule(WindRule rule)
+{
+ if (rule == RULE_EVENODD)
+ return wxODDEVEN_RULE;
+
+ return wxWINDING_RULE;
+}
+
+Path::Path()
+{
+ m_path = 0;
+ // NB: This only supports the 'default' renderer as determined by wx on
+ // each platform. If an app uses a non-default renderer (e.g. Cairo on Win),
+ // there will be problems, but there's no way we can determine which
+ // renderer an app is using right now with wx API, so we will just handle
+ // the common case.
+#if USE(WXGC)
+ wxGraphicsRenderer* renderer = wxGraphicsRenderer::GetDefaultRenderer();
+ if (renderer) {
+ wxGraphicsPath path = renderer->CreatePath();
+ m_path = new wxGraphicsPath(path);
+ }
+#endif
+}
+
+Path::~Path()
+{
+ clear();
+}
+
+Path::Path(const Path& path)
+{
+ m_path = new wxGraphicsPath(*path.m_path);
+}
+
+bool Path::contains(const FloatPoint& point, const WindRule rule) const
+{
+#if USE(WXGC)
+ if (m_path) {
+#if wxCHECK_VERSION(2,9,0)
+ return m_path->Contains(point.x(), point.y(), static_cast<wxPolygonFillMode>(getWxWindRuleForWindRule(rule)));
+#else
+ return m_path->Contains(point.x(), point.y(), getWxWindRuleForWindRule(rule));
+#endif
+ }
+#endif
+ return false;
+}
+
+void Path::translate(const FloatSize&)
+{
+ notImplemented();
+}
+
+FloatRect Path::boundingRect() const
+{
+#if USE(WXGC)
+ if (m_path) {
+ return m_path->GetBox();
+ }
+#endif
+
+ return FloatRect();
+}
+
+FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier)
+{
+ notImplemented();
+ return FloatRect();
+}
+
+bool Path::strokeContains(StrokeStyleApplier*, const FloatPoint&) const
+{
+ notImplemented();
+ return false;
+}
+
+Path& Path::operator=(const Path& path)
+{
+ *m_path = *path.platformPath();
+ return *this;
+}
+
+void Path::clear()
+{
+ if (m_path)
+ delete m_path;
+
+#if USE(WXGC)
+ wxGraphicsRenderer* renderer = wxGraphicsRenderer::GetDefaultRenderer();
+ if (renderer) {
+ wxGraphicsPath path = renderer->CreatePath();
+ m_path = new wxGraphicsPath(path);
+ }
+#endif
+}
+
+void Path::moveTo(const FloatPoint& point)
+{
+#if USE(WXGC)
+ if (m_path)
+ m_path->MoveToPoint(point.x(), point.y());
+#endif
+}
+
+void Path::addLineTo(const FloatPoint& point)
+{
+#if USE(WXGC)
+ if (m_path)
+ m_path->AddLineToPoint(point.x(), point.y());
+#endif
+}
+
+void Path::addQuadCurveTo(const FloatPoint& control, const FloatPoint& end)
+{
+#if USE(WXGC)
+ if (m_path)
+ m_path->AddQuadCurveToPoint(control.x(), control.y(), end.x(), end.y());
+#endif
+}
+
+void Path::addBezierCurveTo(const FloatPoint& control1, const FloatPoint& control2, const FloatPoint& end)
+{
+#if USE(WXGC)
+ if (m_path)
+ m_path->AddCurveToPoint(control1.x(), control1.y(), control2.x(), control2.y(), end.x(), end.y());
+#endif
+}
+
+void Path::addArcTo(const FloatPoint& point1, const FloatPoint& point2, float radius)
+{
+#if USE(WXGC)
+ if (m_path)
+ m_path->AddArcToPoint(point1.x(), point1.y(), point2.x(), point2.y(), radius);
+#endif
+}
+
+void Path::closeSubpath()
+{
+#if USE(WXGC)
+ if (m_path)
+ m_path->CloseSubpath();
+#endif
+}
+
+void Path::addArc(const FloatPoint& point, float radius, float startAngle, float endAngle, bool clockwise)
+{
+#if USE(WXGC)
+ if (m_path)
+ m_path->AddArc(point.x(), point.y(), radius, startAngle, endAngle, clockwise);
+#endif
+}
+
+void Path::addRect(const FloatRect& rect)
+{
+#if USE(WXGC)
+ if (m_path)
+ m_path->AddRectangle(rect.x(), rect.y(), rect.width(), rect.height());
+#endif
+}
+
+void Path::addEllipse(const FloatRect& rect)
+{
+#if USE(WXGC)
+ if (m_path)
+ m_path->AddEllipse(rect.x(), rect.y(), rect.width(), rect.height());
+#endif
+}
+
+void Path::transform(const AffineTransform& transform)
+{
+#if USE(WXGC)
+ if (m_path)
+ m_path->Transform(transform);
+#endif
+}
+
+void Path::apply(void* info, PathApplierFunction function) const
+{
+ notImplemented();
+}
+
+bool Path::isEmpty() const
+{
+#if USE(WXGC)
+ if (m_path) {
+ wxDouble x, y, width, height;
+ m_path->GetBox(&x, &y, &width, &height);
+ return (width == 0 && height == 0);
+ }
+#endif
+ return true;
+}
+
+bool Path::hasCurrentPoint() const
+{
+ return !isEmpty();
+}
+
+FloatPoint Path::currentPoint() const
+{
+ // FIXME: return current point of subpath.
+ float quietNaN = std::numeric_limits<float>::quiet_NaN();
+ return FloatPoint(quietNaN, quietNaN);
+}
+
+}
diff --git a/Source/WebCore/platform/graphics/wx/PenWx.cpp b/Source/WebCore/platform/graphics/wx/PenWx.cpp
new file mode 100644
index 0000000..5a131e3
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/PenWx.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Pen.h"
+
+#include <wx/defs.h>
+#include <wx/pen.h>
+#include <wx/colour.h>
+
+namespace WebCore {
+
+// Pen style conversion functions
+static int penStyleToWxPenStyle(int p)
+{
+ if (p == Pen::SolidLine)
+ return wxSOLID;
+ if (p == Pen::DotLine)
+ return wxDOT;
+ if (p == Pen::DashLine)
+ return wxLONG_DASH;
+ if (p == Pen::NoPen)
+ return wxTRANSPARENT;
+
+ return wxSOLID;
+}
+
+static Pen::PenStyle wxPenStyleToPenStyle(int p)
+{
+ if (p == wxSOLID)
+ return Pen::SolidLine;
+ if (p == wxDOT)
+ return Pen::DotLine;
+ if (p == wxLONG_DASH || p == wxSHORT_DASH || p == wxDOT_DASH || p == wxUSER_DASH)
+ return Pen::DashLine;
+ if (p == wxTRANSPARENT)
+ return Pen::NoPen;
+
+ return Pen::SolidLine;
+}
+
+Pen::Pen(const wxPen& p)
+{
+ wxColour color = p.GetColour();
+ setColor(Color(color.Red(), color.Green(), color.Blue()));
+ setWidth(p.GetWidth());
+ setStyle(wxPenStyleToPenStyle(p.GetStyle()));
+}
+
+Pen::operator wxPen() const
+{
+ return wxPen(wxColour(m_color.red(), m_color.blue(), m_color.green()), width(), penStyleToWxPenStyle(style()));
+}
+
+}
diff --git a/Source/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp b/Source/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp
new file mode 100644
index 0000000..0e24bfc
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp
@@ -0,0 +1,197 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SimpleFontData.h"
+
+#include "FontCache.h"
+#include "FloatRect.h"
+#include "FontDescription.h"
+#include <wtf/MathExtras.h>
+#include <unicode/uchar.h>
+#include <unicode/unorm.h>
+
+#if OS(DARWIN)
+#include "WebCoreSystemInterface.h"
+#endif
+
+#include <wx/defs.h>
+#include <wx/dcscreen.h>
+#include <wx/string.h>
+#include "fontprops.h"
+
+namespace WebCore
+{
+
+void SimpleFontData::platformInit()
+{
+ wxFont *font = m_platformData.font();
+ if (font && font->IsOk()) {
+ wxFontProperties props = wxFontProperties(font);
+ m_ascent = props.GetAscent();
+ m_descent = props.GetDescent();
+ m_lineSpacing = props.GetLineSpacing();
+ m_xHeight = props.GetXHeight();
+ m_unitsPerEm = 1; // FIXME!
+ m_lineGap = props.GetLineGap();
+ }
+
+ m_syntheticBoldOffset = 0.0f;
+
+#if OS(WINDOWS)
+ m_scriptCache = 0;
+ m_scriptFontProperties = 0;
+ m_isSystemFont = false;
+#endif
+}
+
+void SimpleFontData::platformCharWidthInit()
+{
+ m_avgCharWidth = 0.f;
+ m_maxCharWidth = 0.f;
+ initCharWidths();
+}
+
+void SimpleFontData::platformDestroy()
+{
+#if OS(WINDOWS)
+ if (m_scriptFontProperties) {
+ delete m_scriptFontProperties;
+ m_scriptFontProperties = 0;
+ }
+
+ if (m_scriptCache)
+ ScriptFreeCache(&m_scriptCache);
+#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_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
+{
+ // FIXME: We will need to implement this to load non-ASCII encoding sites
+#if OS(WINDOWS)
+ return wxFontContainsCharacters(m_platformData.hfont(), characters, length);
+#elif OS(DARWIN)
+ return wxFontContainsCharacters(m_platformData.nsFont(), characters, length);
+#endif
+ return true;
+}
+
+void SimpleFontData::determinePitch()
+{
+ if (m_platformData.font() && m_platformData.font()->Ok())
+ m_treatAsFixedPitch = m_platformData.font()->IsFixedWidth();
+ else
+ m_treatAsFixedPitch = false;
+}
+
+FloatRect SimpleFontData::platformBoundsForGlyph(Glyph) const
+{
+ return FloatRect();
+}
+
+float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
+{
+#if __WXMSW__
+ // under Windows / wxMSW we currently always use GDI fonts.
+ return widthForGDIGlyph(glyph);
+#elif OS(DARWIN)
+ float pointSize = m_platformData.size();
+ CGAffineTransform m = CGAffineTransformMakeScale(pointSize, pointSize);
+ CGSize advance;
+ NSFont* nsfont = (NSFont*)m_platformData.nsFont();
+ if (!wkGetGlyphTransformedAdvances(m_platformData.cgFont(), nsfont, &m, &glyph, &advance)) {
+ // LOG_ERROR("Unable to cache glyph widths for %@ %f", [nsfont displayName], pointSize);
+ advance.width = 0;
+ }
+ return advance.width + m_syntheticBoldOffset;
+#else
+ // TODO: fix this! Make GetTextExtents a method of wxFont in 2.9
+ int width = 10;
+ GetTextExtent(*m_platformData.font(), (wxChar)glyph, &width, NULL);
+ return width;
+#endif
+}
+
+#if OS(WINDOWS)
+SCRIPT_FONTPROPERTIES* SimpleFontData::scriptFontProperties() const
+{
+ // AFAICT this is never called even by the Win port anymore.
+ return 0;
+}
+
+void SimpleFontData::initGDIFont()
+{
+ // unused by wx port
+}
+
+void SimpleFontData::platformCommonDestroy()
+{
+ // unused by wx port
+}
+
+float SimpleFontData::widthForGDIGlyph(Glyph glyph) const
+{
+ HDC hdc = GetDC(0);
+ HGDIOBJ oldFont = SelectObject(hdc, m_platformData.hfont());
+ int width;
+ GetCharWidthI(hdc, glyph, 1, 0, &width);
+ SelectObject(hdc, oldFont);
+ ReleaseDC(0, hdc);
+ return width;
+}
+#endif
+
+}
diff --git a/Source/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp b/Source/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp
new file mode 100644
index 0000000..1937986
--- /dev/null
+++ b/Source/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AffineTransform.h"
+#include "TransformationMatrix.h"
+
+#include "Assertions.h"
+#include "FloatRect.h"
+#include "IntRect.h"
+
+#include <stdio.h>
+#include <wx/defs.h>
+#include <wx/graphics.h>
+
+namespace WebCore {
+
+#if USE(WXGC)
+TransformationMatrix::operator wxGraphicsMatrix() const
+{
+ wxGraphicsRenderer* renderer = wxGraphicsRenderer::GetDefaultRenderer();
+ ASSERT(renderer);
+
+ wxGraphicsMatrix matrix = renderer->CreateMatrix(a(), b(), c(), d(), e(), f());
+ return matrix;
+}
+
+AffineTransform::operator wxGraphicsMatrix() const
+{
+ wxGraphicsRenderer* renderer = wxGraphicsRenderer::GetDefaultRenderer();
+ ASSERT(renderer);
+
+ wxGraphicsMatrix matrix = renderer->CreateMatrix(a(), b(), c(), d(), e(), f());
+ return matrix;
+}
+#endif
+
+}