diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:41 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:41 -0800 |
commit | 648161bb0edfc3d43db63caed5cc5213bc6cb78f (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /WebCore/platform/graphics/wx | |
parent | a65af38181ac7d34544586bdb5cd004de93897ad (diff) | |
download | external_webkit-648161bb0edfc3d43db63caed5cc5213bc6cb78f.zip external_webkit-648161bb0edfc3d43db63caed5cc5213bc6cb78f.tar.gz external_webkit-648161bb0edfc3d43db63caed5cc5213bc6cb78f.tar.bz2 |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'WebCore/platform/graphics/wx')
19 files changed, 0 insertions, 2341 deletions
diff --git a/WebCore/platform/graphics/wx/AffineTransformWx.cpp b/WebCore/platform/graphics/wx/AffineTransformWx.cpp deleted file mode 100644 index 12485ae..0000000 --- a/WebCore/platform/graphics/wx/AffineTransformWx.cpp +++ /dev/null @@ -1,251 +0,0 @@ -/* - * 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 "FloatRect.h" -#include "IntRect.h" -#include "NotImplemented.h" - -#include <stdio.h> -#include <wx/defs.h> -#include <wx/graphics.h> - -namespace WebCore { - -#if USE(WXGC) -AffineTransform::AffineTransform(const PlatformAffineTransform& matrix) -{ - m_transform = matrix; -} -#endif - -AffineTransform::AffineTransform(double a, double b, double c, double d, double e, double f) -{ -#if USE(WXGC) - wxGraphicsRenderer* renderer = wxGraphicsRenderer::GetDefaultRenderer(); - m_transform = renderer->CreateMatrix(); -#endif - setMatrix(a, b, c, d, e, f); -} - -AffineTransform::AffineTransform() -{ - // NB: If we ever support using Cairo backend on Win/Mac, this will need to be - // changed somehow (though I'm not sure how as we don't have a reference to the - // graphics context here. -#if USE(WXGC) - wxGraphicsRenderer* renderer = wxGraphicsRenderer::GetDefaultRenderer(); - m_transform = renderer->CreateMatrix(); -#endif -} - -AffineTransform AffineTransform::inverse() const -{ - notImplemented(); - return *this; -} - -void AffineTransform::setMatrix(double a, double b, double c, double d, double e, double f) -{ -#if USE(WXGC) - m_transform.Set(a, b, c, d, e, f); -#endif -} - -void AffineTransform::map(double x, double y, double *x2, double *y2) const -{ - notImplemented(); -} - -IntRect AffineTransform::mapRect(const IntRect &rect) const -{ - notImplemented(); - return IntRect(); -} - -FloatRect AffineTransform::mapRect(const FloatRect &rect) const -{ - notImplemented(); - return FloatRect(); -} - - -AffineTransform& AffineTransform::scale(double sx, double sy) -{ -#if USE(WXGC) - m_transform.Scale((wxDouble)sx, (wxDouble)sy); -#endif - return *this; -} - -void AffineTransform::reset() -{ - notImplemented(); -} - -AffineTransform& AffineTransform::rotate(double d) -{ -#if USE(WXGC) - m_transform.Rotate((wxDouble)d); -#endif - return *this; -} - -AffineTransform& AffineTransform::translate(double tx, double ty) -{ -#if USE(WXGC) - m_transform.Translate((wxDouble)tx, (wxDouble)ty); -#endif - return *this; -} - -AffineTransform& AffineTransform::shear(double sx, double sy) -{ - notImplemented(); - return *this; -} - -AffineTransform& AffineTransform::operator*=(const AffineTransform& other) -{ - notImplemented(); - return *this; -} - -bool AffineTransform::operator== (const AffineTransform &other) const -{ -#if USE(WXGC) - return m_transform.IsEqual((wxGraphicsMatrix)other); -#else - notImplemented(); - return true; -#endif -} - -AffineTransform AffineTransform::operator* (const AffineTransform &other) -{ - notImplemented(); - return *this; //m_transform * other.m_transform; -} - -double AffineTransform::det() const -{ - notImplemented(); - return 0; -} - -#if USE(WXGC) -AffineTransform::operator wxGraphicsMatrix() const -{ - return m_transform; -} -#endif - -double AffineTransform::a() const -{ - double a = 0; -#if USE(WXGC) - m_transform.Get(&a); -#endif - return a; -} - -void AffineTransform::setA(double a) -{ - setMatrix(a, b(), c(), d(), e(), f()); -} - -double AffineTransform::b() const -{ - double b = 0; -#if USE(WXGC) - m_transform.Get(&b); -#endif - return b; -} - -void AffineTransform::setB(double b) -{ - setMatrix(a(), b, c(), d(), e(), f()); -} - -double AffineTransform::c() const -{ - double c = 0; -#if USE(WXGC) - m_transform.Get(&c); -#endif - return c; -} - -void AffineTransform::setC(double c) -{ - setMatrix(a(), b(), c, d(), e(), f()); -} - -double AffineTransform::d() const -{ - double d = 0; -#if USE(WXGC) - m_transform.Get(&d); -#endif - return d; -} - -void AffineTransform::setD(double d) -{ - setMatrix(a(), b(), c(), d, e(), f()); -} - -double AffineTransform::e() const -{ - double e = 0; -#if USE(WXGC) - m_transform.Get(&e); -#endif - return e; -} - -void AffineTransform::setE(double e) -{ - setMatrix(a(), b(), c(), d(), e, f()); -} - -double AffineTransform::f() const -{ - double f = 0; -#if USE(WXGC) - m_transform.Get(&f); -#endif - return f; -} - -void AffineTransform::setF(double f) -{ - setMatrix(a(), b(), c(), d(), e(), f); -} - -} diff --git a/WebCore/platform/graphics/wx/ColorWx.cpp b/WebCore/platform/graphics/wx/ColorWx.cpp deleted file mode 100644 index 0381c59..0000000 --- a/WebCore/platform/graphics/wx/ColorWx.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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/WebCore/platform/graphics/wx/FloatRectWx.cpp b/WebCore/platform/graphics/wx/FloatRectWx.cpp deleted file mode 100644 index bb460e5..0000000 --- a/WebCore/platform/graphics/wx/FloatRectWx.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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/WebCore/platform/graphics/wx/FontCacheWx.cpp b/WebCore/platform/graphics/wx/FontCacheWx.cpp deleted file mode 100755 index db107e4..0000000 --- a/WebCore/platform/graphics/wx/FontCacheWx.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 = new SimpleFontData(FontPlatformData(font.fontDescription(), font.family().family())); - return fontData; -} - -FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font) -{ - return new FontPlatformData(font.fontDescription(), font.family().family()); -} - -FontPlatformData* 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. - static AtomicString timesStr("systemfont"); - return getCachedFontPlatformData(fontDescription, timesStr); -} - -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/WebCore/platform/graphics/wx/FontPlatformData.h b/WebCore/platform/graphics/wx/FontPlatformData.h deleted file mode 100644 index e3a3cce..0000000 --- a/WebCore/platform/graphics/wx/FontPlatformData.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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 "CString.h" -#include "AtomicString.h" -#include "StringImpl.h" - -#include <wx/defs.h> -#include <wx/font.h> - -namespace WebCore { - -class FontPlatformData { -public: - enum FontState { UNINITIALIZED, DELETED, VALID }; - - FontPlatformData(WTF::HashTableDeletedValueType) - : m_fontState(DELETED) - { } - - ~FontPlatformData(); - - FontPlatformData(wxFont f) - : m_font(f) - , m_fontState(VALID) - { - m_fontHash = computeHash(); - } - - FontPlatformData(const FontDescription&, const AtomicString&); - - FontPlatformData() - : m_fontState(UNINITIALIZED) - { - } - - wxFont font() const { - return m_font; - } - - unsigned hash() const { - switch (m_fontState) { - case DELETED: - return -1; - case UNINITIALIZED: - return 0; - case VALID: - return computeHash(); - } - } - - bool operator==(const FontPlatformData& other) const - { - if (m_fontState == VALID) - return other.m_fontState == VALID && m_font.Ok() && other.m_font.Ok() && m_font.IsSameAs(other.m_font); - else - return m_fontState == other.m_fontState; - } - - bool isHashTableDeletedValue() const { return m_fontState == DELETED; } - - unsigned computeHash() const { - ASSERT(m_font.Ok()); - - // 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] = { m_font.GetPointSize(), m_font.GetFamily(), m_font.GetStyle(), - m_font.GetWeight(), m_font.GetUnderlined(), - StringImpl::computeHash(m_font.GetFaceName().mb_str(wxConvUTF8)) }; - - return StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar)); - } - -private: - wxFont m_font; - FontState m_fontState; - unsigned m_fontHash; -}; - -} - -#endif diff --git a/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp b/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp deleted file mode 100755 index 7162eab..0000000 --- a/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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 <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; - - 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 = wxFont( wxSize(0, -desc.computedPixelSize()), - fontFamilyToWxFontFamily(desc.genericFamily()), - italicToWxFontStyle(desc.italic()), - fontWeightToWxFontWeight(desc.weight()), - false, - family.string() - ); -#else - m_font = wxFont( desc.computedPixelSize(), - fontFamilyToWxFontFamily(desc.genericFamily()), - italicToWxFontStyle(desc.italic()), - fontWeightToWxFontWeight(desc.weight()), - false, - family.string() - ); -#endif - m_fontState = VALID; - m_fontHash = computeHash(); - -} - -FontPlatformData::~FontPlatformData() -{ - m_fontState = UNINITIALIZED; -} - -} diff --git a/WebCore/platform/graphics/wx/FontWx.cpp b/WebCore/platform/graphics/wx/FontWx.cpp deleted file mode 100644 index 07223e9..0000000 --- a/WebCore/platform/graphics/wx/FontWx.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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" - -#include <wx/dcclient.h> -#include "fontprops.h" -#include "non-kerned-drawing.h" - -namespace WebCore { - -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 IntPoint& point, int h, int from, int to) const -{ - notImplemented(); - return FloatRect(); -} - -void Font::drawComplexText(GraphicsContext* graphicsContext, const TextRun& run, const FloatPoint& point, int from, int to) const -{ - notImplemented(); -} - -float Font::floatWidthForComplexText(const TextRun& run) const -{ - notImplemented(); - return 0; -} - -int Font::offsetForPositionForComplexText(const TextRun& run, int x, bool includePartialGlyphs) const -{ - notImplemented(); - return 0; -} - -} diff --git a/WebCore/platform/graphics/wx/GlyphMapWx.cpp b/WebCore/platform/graphics/wx/GlyphMapWx.cpp deleted file mode 100755 index ebf86e4..0000000 --- a/WebCore/platform/graphics/wx/GlyphMapWx.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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/WebCore/platform/graphics/wx/GradientWx.cpp b/WebCore/platform/graphics/wx/GradientWx.cpp deleted file mode 100644 index fc4661e..0000000 --- a/WebCore/platform/graphics/wx/GradientWx.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp deleted file mode 100644 index 435e7ce..0000000 --- a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp +++ /dev/null @@ -1,503 +0,0 @@ -/* - * 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() -{ -} - - -GraphicsContext::GraphicsContext(PlatformGraphicsContext* context) - : m_common(createGraphicsContextPrivate()) - , m_data(new GraphicsContextPlatformPrivate) -{ - setPaintingDisabled(!context); - if (context) { - // Make sure the context starts in sync with our state. - setPlatformFillColor(fillColor()); - setPlatformStrokeColor(strokeColor()); - } -#if USE(WXGC) - m_data->context = (wxGCDC*)context; -#else - m_data->context = (wxWindowDC*)context; -#endif -} - -GraphicsContext::~GraphicsContext() -{ - destroyGraphicsContextPrivate(m_common); - 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::fillRect(const FloatRect& rect, const Color& color) -{ - if (paintingDisabled()) - return; - - m_data->context->SetPen(*wxTRANSPARENT_PEN); - m_data->context->SetBrush(wxBrush(color)); - m_data->context->DrawRectangle(rect.x(), rect.y(), rect.width(), rect.height()); -} - -void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& color) -{ - if (paintingDisabled()) - return; - - notImplemented(); -} - -void GraphicsContext::drawFocusRing(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) { -#ifndef __WXGTK__ - 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::clipOutEllipseInRect(const IntRect&) -{ - 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::drawLineForMisspellingOrBadGrammar(const IntPoint& origin, int width, bool grammar) -{ - if (grammar) - m_data->context->SetPen(wxPen(*wxGREEN, 2, wxLONG_DASH)); - else - m_data->context->SetPen(wxPen(*wxRED, 2, wxLONG_DASH)); - - m_data->context->DrawLine(origin.x(), origin.y(), origin.x() + width, origin.y()); -} - -void GraphicsContext::clip(const Path&) -{ - notImplemented(); -} - -void GraphicsContext::clipToImageBuffer(const FloatRect&, const ImageBuffer*) -{ - notImplemented(); -} - -AffineTransform GraphicsContext::getCTM() const -{ - notImplemented(); - 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::setCompositeOperation(CompositeOperator op) -{ - if (m_data->context) - m_data->context->SetLogicalFunction(getWxCompositingOperation(op, false)); -} - -void GraphicsContext::beginPath() -{ - notImplemented(); -} - -void GraphicsContext::addPath(const Path& path) -{ - notImplemented(); -} - -void GraphicsContext::setPlatformStrokeColor(const Color& color) -{ - 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) -{ - if (paintingDisabled()) - return; - - if (m_data->context) - m_data->context->SetBrush(wxBrush(color)); -} - -void GraphicsContext::concatCTM(const AffineTransform& transform) -{ - if (paintingDisabled()) - return; - - notImplemented(); - return; -} - -void GraphicsContext::setUseAntialiasing(bool enable) -{ - if (paintingDisabled()) - return; - notImplemented(); -} - -void GraphicsContext::setImageInterpolationQuality(InterpolationQuality) -{ -} - -InterpolationQuality GraphicsContext::imageInterpolationQuality() const -{ - return InterpolationDefault; -} - -void GraphicsContext::fillPath() -{ -} - -void GraphicsContext::strokePath() -{ -} - -void GraphicsContext::drawPath() -{ - fillPath(); - strokePath(); -} - -void GraphicsContext::fillRect(const FloatRect& rect) -{ - if (paintingDisabled()) - return; -} - -} diff --git a/WebCore/platform/graphics/wx/ImageBufferData.h b/WebCore/platform/graphics/wx/ImageBufferData.h deleted file mode 100644 index d4a6114..0000000 --- a/WebCore/platform/graphics/wx/ImageBufferData.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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/WebCore/platform/graphics/wx/ImageBufferWx.cpp b/WebCore/platform/graphics/wx/ImageBufferWx.cpp deleted file mode 100644 index ea3dfe8..0000000 --- a/WebCore/platform/graphics/wx/ImageBufferWx.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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 "ImageBuffer.h" - -#include "GraphicsContext.h" -#include "ImageData.h" -#include "NotImplemented.h" - -namespace WebCore { - -ImageBufferData::ImageBufferData(const IntSize&) -{ -} - -ImageBuffer::ImageBuffer(const IntSize&, bool grayScale, bool& success) : - m_data(IntSize()) -{ - notImplemented(); - success = false; -} - -ImageBuffer::~ImageBuffer() -{ -} - -GraphicsContext* ImageBuffer::context() const -{ - notImplemented(); - return 0; -} - -PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect&) const -{ - notImplemented(); - return 0; -} - -void ImageBuffer::putImageData(ImageData*, const IntRect&, const IntPoint&) -{ - notImplemented(); -} - -String ImageBuffer::toDataURL(const String&) const -{ - notImplemented(); - return String(); -} - -Image* ImageBuffer::image() const -{ - notImplemented(); - return 0; -} - -} // namespace WebCore diff --git a/WebCore/platform/graphics/wx/ImageSourceWx.cpp b/WebCore/platform/graphics/wx/ImageSourceWx.cpp deleted file mode 100644 index 3ce4f2a..0000000 --- a/WebCore/platform/graphics/wx/ImageSourceWx.cpp +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (C) 2006, 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 "ImageSource.h" - -#include "BMPImageDecoder.h" -#include "GIFImageDecoder.h" -#include "ICOImageDecoder.h" -#include "JPEGImageDecoder.h" -#include "PNGImageDecoder.h" -#include "SharedBuffer.h" -#include "XBMImageDecoder.h" - -#include <wx/defs.h> -#include <wx/bitmap.h> -#include <wx/image.h> -#include <wx/rawbmp.h> - -namespace WebCore { - -ImageDecoder* createDecoder(const SharedBuffer& data) -{ - // We need at least 4 bytes to figure out what kind of image we're dealing with. - int length = data.size(); - if (length < 4) - return 0; - - const unsigned char* uContents = (const unsigned char*)data.data(); - const char* contents = data.data(); - - // GIFs begin with GIF8(7 or 9). - if (strncmp(contents, "GIF8", 4) == 0) - return new GIFImageDecoder(); - - // Test for PNG. - if (uContents[0]==0x89 && - uContents[1]==0x50 && - uContents[2]==0x4E && - uContents[3]==0x47) - return new PNGImageDecoder(); - - // JPEG - if (uContents[0]==0xFF && - uContents[1]==0xD8 && - uContents[2]==0xFF) - return new JPEGImageDecoder(); - - // BMP - if (strncmp(contents, "BM", 2) == 0) - return new BMPImageDecoder(); - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - // CURs begin with 2-byte 0 followed by 2-byte 2. - if (!memcmp(contents, "\000\000\001\000", 4) || - !memcmp(contents, "\000\000\002\000", 4)) - return new ICOImageDecoder(); - - // XBMs require 8 bytes of info. - if (length >= 8 && strncmp(contents, "#define ", 8) == 0) - return new XBMImageDecoder(); - - // Give up. We don't know what the heck this is. - return 0; -} - -ImageSource::ImageSource() - : m_decoder(0) -{} - -ImageSource::~ImageSource() -{ - delete m_decoder; -} - -bool ImageSource::initialized() const -{ - return m_decoder; -} - -void ImageSource::setData(SharedBuffer* data, bool allDataReceived) -{ - // Make the decoder by sniffing the bytes. - // This method will examine the data and instantiate an instance of the appropriate decoder plugin. - // If insufficient bytes are available to determine the image type, no decoder plugin will be - // made. - m_decoder = createDecoder(*data); - if (!m_decoder) - return; - m_decoder->setData(data, allDataReceived); -} - -bool ImageSource::isSizeAvailable() -{ - if (!m_decoder) - return false; - - return m_decoder->isSizeAvailable(); -} - -IntSize ImageSource::size() const -{ - if (!m_decoder) - return IntSize(); - - return m_decoder->size(); -} - -IntSize ImageSource::frameSizeAtIndex(size_t) const -{ - return size(); -} - -int ImageSource::repetitionCount() -{ - if (!m_decoder) - return cAnimationNone; - - return m_decoder->repetitionCount(); -} - -size_t ImageSource::frameCount() const -{ - return m_decoder ? m_decoder->frameCount() : 0; -} - -bool ImageSource::frameIsCompleteAtIndex(size_t index) -{ - // FIXME: should we be testing the RGBA32Buffer's status as well? - return (m_decoder && m_decoder->frameBufferAtIndex(index) != 0); -} - -void ImageSource::clear() -{ - delete m_decoder; - m_decoder = 0; -} - -NativeImagePtr ImageSource::createFrameAtIndex(size_t index) -{ - if (!m_decoder) - return 0; - - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) - return 0; - - IntRect imageRect = buffer->rect(); - unsigned char* bytes = (unsigned char*)buffer->bytes().data(); - long colorSize = buffer->bytes().size(); - - typedef wxPixelData<wxBitmap, wxAlphaPixelFormat> PixelData; - - int width = size().width(); - int height = size().height(); - - wxBitmap* bmp = new wxBitmap(width, height, 32); - PixelData data(*bmp); - - int rowCounter = 0; - long pixelCounter = 0; - - PixelData::Iterator p(data); - - PixelData::Iterator rowStart = p; - - // NB: It appears that the data is in BGRA format instead of RGBA format. - // This code works properly on both ppc and intel, meaning the issue is - // likely not an issue of byte order getting mixed up on different archs. - for (long i = 0; i < buffer->bytes().size()*4; i+=4) { - p.Red() = bytes[i+2]; - p.Green() = bytes[i+1]; - p.Blue() = bytes[i+0]; - p.Alpha() = bytes[i+3]; - - p++; - - pixelCounter++; - if ( (pixelCounter % width ) == 0 ) { - rowCounter++; - p = rowStart; - p.MoveTo(data, 0, rowCounter); - } - - } - - bmp->UseAlpha(); - ASSERT(bmp->IsOk()); - return bmp; -} - -float ImageSource::frameDurationAtIndex(size_t index) -{ - if (!m_decoder) - return 0; - - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) - return 0; - - float duration = buffer->duration() / 1000.0f; - - // Follow other ports (and WinIE's) behavior to slow annoying ads that - // specify a 0 duration. - if (duration < 0.051f) - return 0.100f; - return duration; -} - -bool ImageSource::frameHasAlphaAtIndex(size_t index) -{ - if (!m_decoder || !m_decoder->supportsAlpha()) - return false; - - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) - return false; - - return buffer->hasAlpha(); -} - -} diff --git a/WebCore/platform/graphics/wx/ImageWx.cpp b/WebCore/platform/graphics/wx/ImageWx.cpp deleted file mode 100644 index a05a31f..0000000 --- a/WebCore/platform/graphics/wx/ImageWx.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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 "FloatRect.h" -#include "GraphicsContext.h" -#include "NotImplemented.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> - -// This function loads resources from WebKit -Vector<char> loadResourceIntoArray(const char*); - -namespace WebCore { - -// this is in GraphicsContextWx.cpp -int getWxCompositingOperation(CompositeOperator op, bool hasAlpha); - -void FrameData::clear() -{ - if (m_frame) { - delete m_frame; - m_frame = 0; - // NOTE: We purposefully don't reset metadata here, so that even if we - // throw away previously-decoded data, animation loops can still access - // properties like frame durations without re-decoding. - } -} - -// ================================================ -// Image Class -// ================================================ - -PassRefPtr<Image> Image::loadPlatformResource(const char *name) -{ - Vector<char> arr = loadResourceIntoArray(name); - 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, CompositeOperator op) -{ - if (!m_source.initialized()) - return; - - if (mayFillWithSolidColor()) { - fillWithSolidColor(ctxt, dst, solidColor(), op); - return; - } - -#if USE(WXGC) - wxGCDC* context = (wxGCDC*)ctxt->platformContext(); -#else - wxWindowDC* context = ctxt->platformContext(); -#endif - - startAnimation(); - - wxBitmap* bitmap = frameAtIndex(m_currentFrame); - 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); - - 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; - } - ctxt->restore(); -} - -void BitmapImage::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, CompositeOperator, const FloatRect& dstRect) -{ - if (!m_source.initialized()) - return; - -#if USE(WXGC) - wxGCDC* context = (wxGCDC*)ctxt->platformContext(); -#else - wxWindowDC* context = ctxt->platformContext(); -#endif - - ctxt->save(); - ctxt->clip(IntRect(dstRect.x(), dstRect.y(), dstRect.width(), dstRect.height())); - wxBitmap* bitmap = frameAtIndex(m_currentFrame); - if (!bitmap) // If it's too early we won't have an image yet. - return; - - float currentW = 0; - float currentH = 0; - -#if USE(WXGC) - wxGraphicsContext* gc = context->GetGraphicsContext(); - gc->ConcatTransform(patternTransform); -#endif - - wxMemoryDC mydc; - mydc.SelectObject(*bitmap); - - while ( currentW < dstRect.width() ) { - while ( currentH < dstRect.height() ) { - 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); - currentH += srcRect.height(); - } - currentW += srcRect.width(); - currentH = 0; - } - ctxt->restore(); - 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; - - startAnimation(); - -} - -void BitmapImage::checkForSolidColor() -{ - -} - -void BitmapImage::invalidatePlatformData() -{ - -} - -} diff --git a/WebCore/platform/graphics/wx/IntPointWx.cpp b/WebCore/platform/graphics/wx/IntPointWx.cpp deleted file mode 100644 index 389ac9f..0000000 --- a/WebCore/platform/graphics/wx/IntPointWx.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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/WebCore/platform/graphics/wx/IntRectWx.cpp b/WebCore/platform/graphics/wx/IntRectWx.cpp deleted file mode 100644 index 10c1b55..0000000 --- a/WebCore/platform/graphics/wx/IntRectWx.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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/WebCore/platform/graphics/wx/PathWx.cpp b/WebCore/platform/graphics/wx/PathWx.cpp deleted file mode 100644 index 5ff9914..0000000 --- a/WebCore/platform/graphics/wx/PathWx.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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 <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() -{ -} - -Path::Path(const Path& path) -{ - m_path = (PlatformPath*)&path.m_path; -} - -bool Path::contains(const FloatPoint& point, const WindRule rule) const -{ - 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(); -} - -Path& Path::operator=(const Path&) -{ - notImplemented(); - 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&) -{ - notImplemented(); -} - -void Path::addQuadCurveTo(const FloatPoint&, const FloatPoint&) -{ - notImplemented(); -} - -void Path::addBezierCurveTo(const FloatPoint&, const FloatPoint&, const FloatPoint&) -{ - notImplemented(); -} - -void Path::addArcTo(const FloatPoint&, const FloatPoint&, float) -{ - notImplemented(); -} - -void Path::closeSubpath() -{ - notImplemented(); -} - -void Path::addArc(const FloatPoint&, float, float, float, bool) -{ - notImplemented(); -} - -void Path::addRect(const FloatRect&) -{ - notImplemented(); -} - -void Path::addEllipse(const FloatRect&) -{ - notImplemented(); -} - -void Path::transform(const AffineTransform&) -{ - notImplemented(); -} - -void Path::apply(void* info, PathApplierFunction function) const -{ - notImplemented(); -} - -bool Path::isEmpty() const -{ - notImplemented(); - return false; -} - -} diff --git a/WebCore/platform/graphics/wx/PenWx.cpp b/WebCore/platform/graphics/wx/PenWx.cpp deleted file mode 100644 index 5a131e3..0000000 --- a/WebCore/platform/graphics/wx/PenWx.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp b/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp deleted file mode 100755 index a509933..0000000 --- a/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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> - -#include <wx/defs.h> -#include <wx/dcscreen.h> -#include "fontprops.h" - -namespace WebCore -{ - -void SimpleFontData::platformInit() -{ - wxFont font = m_font.font(); - 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(); -} - -void SimpleFontData::platformDestroy() -{ - delete m_smallCapsFontData; -} - -SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const -{ - if (!m_smallCapsFontData){ - FontDescription desc = FontDescription(fontDescription); - desc.setSpecifiedSize(0.70f*fontDescription.computedSize()); - const FontPlatformData* pdata = new FontPlatformData(desc, desc.family().family()); - m_smallCapsFontData = new SimpleFontData(*pdata); - } - return m_smallCapsFontData; -} - -bool SimpleFontData::containsCharacters(const UChar* characters, int length) const -{ - // FIXME: We will need to implement this to load non-ASCII encoding sites - return true; -} - -void SimpleFontData::determinePitch() -{ - if (m_font.font().Ok()) - m_treatAsFixedPitch = m_font.font().IsFixedWidth(); - else - m_treatAsFixedPitch = false; -} - -float SimpleFontData::platformWidthForGlyph(Glyph glyph) const -{ - // TODO: fix this! Make GetTextExtents a method of wxFont in 2.9 - int width = 10; - GetTextExtent(m_font.font(), (wxChar)glyph, &width, NULL); - return width; -} - -} |