diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
commit | 9364f22aed35e1a1e9d07c121510f80be3ab0502 (patch) | |
tree | d49911209b132da58d838efa852daf28d516df21 /WebCore/platform/wx | |
parent | 87eb0cb35bad8784770ebc807e6c982432e47107 (diff) | |
download | external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.zip external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.tar.gz external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.tar.bz2 |
Initial Contribution
Diffstat (limited to 'WebCore/platform/wx')
-rw-r--r-- | WebCore/platform/wx/FileSystemWx.cpp | 40 | ||||
-rw-r--r-- | WebCore/platform/wx/LocalizedStringsWx.cpp | 7 | ||||
-rw-r--r-- | WebCore/platform/wx/MouseWheelEventWx.cpp | 4 | ||||
-rw-r--r-- | WebCore/platform/wx/ScrollViewWx.cpp | 17 | ||||
-rwxr-xr-x | WebCore/platform/wx/TemporaryLinkStubs.cpp | 23 | ||||
-rw-r--r-- | WebCore/platform/wx/ThreadingWx.cpp (renamed from WebCore/platform/wx/MainThreadWx.cpp) | 2 | ||||
-rw-r--r-- | WebCore/platform/wx/wxcode/gtk/non-kerned-drawing.cpp | 67 | ||||
-rw-r--r-- | WebCore/platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp | 67 | ||||
-rw-r--r-- | WebCore/platform/wx/wxcode/non-kerned-drawing.h | 36 | ||||
-rw-r--r-- | WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp | 125 |
10 files changed, 14 insertions, 374 deletions
diff --git a/WebCore/platform/wx/FileSystemWx.cpp b/WebCore/platform/wx/FileSystemWx.cpp index 7be985b..28310f2 100644 --- a/WebCore/platform/wx/FileSystemWx.cpp +++ b/WebCore/platform/wx/FileSystemWx.cpp @@ -1,9 +1,7 @@ /* * Copyright (C) 2007 Kevin Ollivier - * Copyright (C) 2008 Collabora, 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: @@ -77,40 +75,4 @@ String pathByAppendingComponent(const String& path, const String& component) return String(); } -String homeDirectoryPath() -{ - notImplemented(); - return String(); -} - -String pathGetFileName(const String&) -{ - notImplemented(); - return String(); -} - -CString openTemporaryFile(const char* prefix, PlatformFileHandle& handle) -{ - notImplemented(); - handle = invalidPlatformFileHandle; - return CString(); -} - -void closeFile(PlatformFileHandle&) -{ - notImplemented(); -} - -int writeToFile(PlatformFileHandle, const char* data, int length) -{ - notImplemented(); - return 0; -} - -bool unloadModule(PlatformModule) -{ - notImplemented(); - return false; -} - } diff --git a/WebCore/platform/wx/LocalizedStringsWx.cpp b/WebCore/platform/wx/LocalizedStringsWx.cpp index 8ba5fe4..368f938 100644 --- a/WebCore/platform/wx/LocalizedStringsWx.cpp +++ b/WebCore/platform/wx/LocalizedStringsWx.cpp @@ -25,8 +25,6 @@ */ #include "config.h" -#include "LocalizedStrings.h" - #include "PlatformString.h" namespace WebCore { @@ -266,9 +264,4 @@ String unknownFileSizeText() return String("Unknown"); } -String imageTitle(const String& filename, const IntSize& size) -{ - return String(); -} - } // namespace WebCore diff --git a/WebCore/platform/wx/MouseWheelEventWx.cpp b/WebCore/platform/wx/MouseWheelEventWx.cpp index 6064176..0bfbd4a 100644 --- a/WebCore/platform/wx/MouseWheelEventWx.cpp +++ b/WebCore/platform/wx/MouseWheelEventWx.cpp @@ -40,10 +40,6 @@ PlatformWheelEvent::PlatformWheelEvent(const wxMouseEvent& event, const wxPoint& , m_metaKey(event.MetaDown()) // FIXME: We'll have to test other browsers , m_deltaX(0) // wx doesn't support horizontal mouse wheel scrolling , m_deltaY(event.GetWheelRotation() / event.GetWheelDelta()) - , m_isAccepted(false) - , m_isContinuous(false) - , m_continuousDeltaX(0) - , m_continuousDeltaY(0) { } diff --git a/WebCore/platform/wx/ScrollViewWx.cpp b/WebCore/platform/wx/ScrollViewWx.cpp index 8726fc3..b6c5ae4 100644 --- a/WebCore/platform/wx/ScrollViewWx.cpp +++ b/WebCore/platform/wx/ScrollViewWx.cpp @@ -68,6 +68,7 @@ public: win->Connect(wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this); win->Connect(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this); win->Connect(wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this); + win->Connect(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this); } void OnScrollWinEvents(wxScrollWinEvent& e) @@ -83,30 +84,18 @@ public: else pos.y = e.GetPosition(); } - else if (scrollType == wxEVT_SCROLLWIN_LINEDOWN) { + else if ( scrollType == wxEVT_SCROLLWIN_LINEDOWN ) { if (horiz) pos.x += LINE_STEP; else pos.y += LINE_STEP; } - else if (scrollType == wxEVT_SCROLLWIN_LINEUP) { + else if ( scrollType == wxEVT_SCROLLWIN_LINEUP ) { if (horiz) pos.x -= LINE_STEP; else pos.y -= LINE_STEP; } - else if (scrollType == wxEVT_SCROLLWIN_PAGEUP) { - if (horiz) - pos.x -= m_scrollView->visibleWidth() - PAGE_KEEP; - else - pos.y -= m_scrollView->visibleHeight() - PAGE_KEEP; - } - else if (scrollType == wxEVT_SCROLLWIN_PAGEDOWN) { - if (horiz) - pos.x += m_scrollView->visibleWidth() - PAGE_KEEP; - else - pos.y += m_scrollView->visibleHeight() - PAGE_KEEP; - } else return e.Skip(); diff --git a/WebCore/platform/wx/TemporaryLinkStubs.cpp b/WebCore/platform/wx/TemporaryLinkStubs.cpp index b44ed9a..cd328c6 100755 --- a/WebCore/platform/wx/TemporaryLinkStubs.cpp +++ b/WebCore/platform/wx/TemporaryLinkStubs.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * Copyright (C) 2008 Collabora, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -64,8 +63,7 @@ #include "PlatformMenuDescription.h" #include "PlatformMouseEvent.h" #include "PlatformScrollBar.h" -#include "PluginDatabase.h" -#include "PluginPackage.h" +#include "PluginInfoStore.h" #include "PopupMenu.h" #include "RenderTheme.h" #include "ResourceHandle.h" @@ -119,14 +117,11 @@ namespace WebCore { void WebCore::findWordBoundary(UChar const* str,int len,int position,int* start, int* end) { notImplemented(); *start=position; *end=position; } -PluginSet PluginDatabase::getPluginsInPaths() const { notImplemented(); return PluginSet(); } -Vector<String> PluginDatabase::defaultPluginPaths() { notImplemented(); return Vector<String>(); } -bool PluginDatabase::isPreferredPluginPath(const String&) { notImplemented(); return false; } -int PluginPackage::compare(const PluginPackage&) const { notImplemented(); return 0; } -bool PluginPackage::fetchInfo() { notImplemented(); return false; } -unsigned PluginPackage::hash() const { notImplemented(); return 0; } -bool PluginPackage::equal(const PluginPackage&, const PluginPackage&) { notImplemented(); return false; } -bool PluginPackage::load() { notImplemented(); return false; } +PluginInfo*PluginInfoStore::createPluginInfoForPluginAtIndex(unsigned) { notImplemented(); return 0;} +unsigned PluginInfoStore::pluginCount() const { notImplemented(); return 0; } +bool WebCore::PluginInfoStore::supportsMIMEType(const WebCore::String&) { notImplemented(); return false; } +String PluginInfoStore::pluginNameForMIMEType(const String& mimeType) { notImplemented(); return String(); } +void WebCore::refreshPlugins(bool) { notImplemented(); } void Widget::setIsSelected(bool) { notImplemented(); } @@ -156,13 +151,13 @@ void PlatformScrollbar::updateThumbPosition() { notImplemented(); } void PlatformScrollbar::updateThumbProportion() { notImplemented(); } void PlatformScrollbar::setRect(const IntRect&) { notImplemented(); } -FileChooser::FileChooser(FileChooserClient*, const String& initialFilename) : RefCounted<FileChooser>(0) { notImplemented(); } +FileChooser::FileChooser(FileChooserClient*, const String& initialFilename) { notImplemented(); } //PassRefPtr<FileChooser> FileChooser::create(FileChooserClient*, const String& initialFilename) { notImplemented(); return PassRefPtr<FileChooser>(); } FileChooser::~FileChooser() { notImplemented(); } void FileChooser::openFileChooser(Document*) { notImplemented(); } String FileChooser::basenameForWidth(const Font&, int width) const { notImplemented(); return String(); } -PopupMenu::PopupMenu(PopupMenuClient*) : RefCounted<PopupMenu>(0) { notImplemented(); } +PopupMenu::PopupMenu(PopupMenuClient*) { notImplemented(); } PopupMenu::~PopupMenu() { notImplemented(); } void PopupMenu::show(const IntRect&, FrameView*, int index) { notImplemented(); } @@ -170,7 +165,7 @@ void PopupMenu::hide() { notImplemented(); } void PopupMenu::updateFromElement() { notImplemented(); } bool PopupMenu::itemWritingDirectionIsNatural() { notImplemented(); return false; } -Icon::Icon() : RefCounted<Icon>(0) { notImplemented(); } +Icon::Icon() { notImplemented(); } Icon::~Icon() { notImplemented(); } PassRefPtr<Icon> Icon::newIconForFile(const String& filename) { notImplemented(); return PassRefPtr<Icon>(new Icon()); } void Icon::paint(GraphicsContext*, const IntRect&) { notImplemented(); } diff --git a/WebCore/platform/wx/MainThreadWx.cpp b/WebCore/platform/wx/ThreadingWx.cpp index b49cb62..7cb90ff 100644 --- a/WebCore/platform/wx/MainThreadWx.cpp +++ b/WebCore/platform/wx/ThreadingWx.cpp @@ -28,7 +28,7 @@ #include "config.h" #include "NotImplemented.h" -#include "MainThread.h" +#include "Threading.h" namespace WebCore { diff --git a/WebCore/platform/wx/wxcode/gtk/non-kerned-drawing.cpp b/WebCore/platform/wx/wxcode/gtk/non-kerned-drawing.cpp deleted file mode 100644 index b86a9bc..0000000 --- a/WebCore/platform/wx/wxcode/gtk/non-kerned-drawing.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Watters, 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 "GlyphBuffer.h" -#include "GraphicsContext.h" -#include "SimpleFontData.h" - -#include <wx/defs.h> -#include <wx/dcclient.h> -#include <wx/gdicmn.h> -#include <vector> - -namespace WebCore { - -void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* font, const wxColour& color, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) -{ -#if USE(WXGC) - wxGCDC* dc = static_cast<wxGCDC*>(graphicsContext->platformContext()); -#else - wxDC* dc = graphicsContext->platformContext(); -#endif - - wxFont wxfont = font->getWxFont(); - if (wxfont.IsOk()) - dc->SetFont(wxfont); - dc->SetTextForeground(color); - - // convert glyphs to wxString - GlyphBufferGlyph* glyphs = const_cast<GlyphBufferGlyph*>(glyphBuffer.glyphs(from)); - int offset = point.x(); - wxString text = wxEmptyString; - for (unsigned i = 0; i < numGlyphs; i++) { - text = text.Append((wxChar)glyphs[i]); - offset += glyphBuffer.advanceAt(from + i); - } - - // the y point is actually the bottom point of the text, turn it into the top - float height = font->ascent() - font->descent(); - wxCoord ypoint = (wxCoord) (point.y() - height); - - dc->DrawText(text, (wxCoord)point.x(), ypoint); -} - -} diff --git a/WebCore/platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp b/WebCore/platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp deleted file mode 100644 index b86a9bc..0000000 --- a/WebCore/platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Watters, 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 "GlyphBuffer.h" -#include "GraphicsContext.h" -#include "SimpleFontData.h" - -#include <wx/defs.h> -#include <wx/dcclient.h> -#include <wx/gdicmn.h> -#include <vector> - -namespace WebCore { - -void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* font, const wxColour& color, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) -{ -#if USE(WXGC) - wxGCDC* dc = static_cast<wxGCDC*>(graphicsContext->platformContext()); -#else - wxDC* dc = graphicsContext->platformContext(); -#endif - - wxFont wxfont = font->getWxFont(); - if (wxfont.IsOk()) - dc->SetFont(wxfont); - dc->SetTextForeground(color); - - // convert glyphs to wxString - GlyphBufferGlyph* glyphs = const_cast<GlyphBufferGlyph*>(glyphBuffer.glyphs(from)); - int offset = point.x(); - wxString text = wxEmptyString; - for (unsigned i = 0; i < numGlyphs; i++) { - text = text.Append((wxChar)glyphs[i]); - offset += glyphBuffer.advanceAt(from + i); - } - - // the y point is actually the bottom point of the text, turn it into the top - float height = font->ascent() - font->descent(); - wxCoord ypoint = (wxCoord) (point.y() - height); - - dc->DrawText(text, (wxCoord)point.x(), ypoint); -} - -} diff --git a/WebCore/platform/wx/wxcode/non-kerned-drawing.h b/WebCore/platform/wx/wxcode/non-kerned-drawing.h deleted file mode 100644 index d005985..0000000 --- a/WebCore/platform/wx/wxcode/non-kerned-drawing.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Watters, 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 "Font.h"
-#include "GlyphBuffer.h"
-
-#include <wx/defs.h>
-#include <wx/dcclient.h>
-
-namespace WebCore {
-
-extern void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* font, const wxColour& color, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point);
-
-}
diff --git a/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp b/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp deleted file mode 100644 index f05923a..0000000 --- a/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Watters, 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 "GlyphBuffer.h" -#include "GraphicsContext.h" -#include "SimpleFontData.h" - -#include <wx/defs.h> -#include <wx/dcclient.h> -#include <wx/gdicmn.h> -#include <vector> - -using namespace std; - -//----------------------------------------------------------------------------- -// constants -//----------------------------------------------------------------------------- - -const double RAD2DEG = 180.0 / M_PI; - -//----------------------------------------------------------------------------- -// Local functions -//----------------------------------------------------------------------------- - -static inline double dmin(double a, double b) { return a < b ? a : b; } -static inline double dmax(double a, double b) { return a > b ? a : b; } - -static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } -static inline double RadToDeg(double deg) { return (deg * 180.0) / M_PI; } - -#include "wx/msw/private.h" - -// TODO remove this dependency (gdiplus needs the macros) - -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif - -#ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif - -#include "gdiplus.h" - - -namespace WebCore { - -void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* font, const wxColour& color, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) -{ -#if USE(WXGC) - wxGCDC* dc = static_cast<wxGCDC*>(graphicsContext->platformContext()); -#else - wxDC* dc = graphicsContext->platformContext(); -#endif - - // get the native HDC handle to draw using native APIs - HDC hdc = 0; -#if USE(WXGC) - wxGraphicsContext* gc = dc->GetGraphicsContext(); - Gdiplus::Graphics* g; - if (gc) { - g = (Gdiplus::Graphics*)gc->GetNativeContext(); - hdc = g->GetHDC(); - } -#else - hdc = static_cast<HDC>(dc->GetHDC()); -#endif - - // ExtTextOut wants the offsets as an array of ints, so extract them - // from the glyph buffer - const GlyphBufferGlyph* glyphs = glyphBuffer.glyphs(from); - const GlyphBufferAdvance* advances = glyphBuffer.advances(from); - - float y = point.y() - font->ascent(); - float x = point.x(); - - int* spacing = new int[numGlyphs - from]; - for (unsigned i = 0; i < numGlyphs; ++i) - spacing[i] = advances[i].width(); - - ::SelectObject(hdc, GetHfontOf(font->getWxFont())); - - if (color.Ok()) - ::SetTextColor(hdc, color.GetPixel()); - - // do not draw background behind characters - ::SetBkMode(hdc, TRANSPARENT); - - // draw text with optional character widths array - wxString string = wxString((wxChar*)(&glyphs[from]), numGlyphs); - ::ExtTextOut(hdc, x, y, 0, NULL, string.c_str(), string.length(), spacing); - - ::SetBkMode(hdc, TRANSPARENT); - - #if USE(WXGC) - g->ReleaseHDC(hdc); - #endif - - delete [] spacing; -} - -} |