[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/unity
From: Simon Hausmann <hausmann () kde ! org>
Date: 2006-07-11 19:17:28
Message-ID: 1152645448.586505.9739.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 561271 by hausmann:
r237@rhea (orig r236): shausman | 2006-07-09 20:03:23 +0200
- get complex text rendering working (sort of)
_M . (directory)
M +2 -2 WebKit/WebCore/platform/GraphicsContext.h
M +2 -1 WebKit/WebCore/platform/qt/CanvasQt.cpp
M +16 -1 WebKit/WebCore/platform/qt/FontQt.cpp
M +0 -9 WebKit/WebCore/platform/qt/FrameQt.cpp
M +0 -2 WebKit/WebCore/platform/qt/FrameQt.h
M +8 -8 WebKit/WebCore/platform/qt/GraphicsContextQt.cpp
M +4 -6 WebKit/WebCore/platform/qt/ImageQt.cpp
M +0 -2 WebKit/WebCore/platform/qt/TemporaryLinkStubs.cpp
--- branches/work/unity/WebKit/WebCore/platform/GraphicsContext.h #561270:561271
@@ -43,8 +43,8 @@
#elif PLATFORM(GDK)
typedef struct _cairo PlatformGraphicsContext;
#elif PLATFORM(QT)
-class QPaintDevice;
-typedef QPaintDevice PlatformGraphicsContext;
+class QPainter;
+typedef QPainter PlatformGraphicsContext;
#else
typedef void PlatformGraphicsContext;
#endif
--- branches/work/unity/WebKit/WebCore/platform/qt/CanvasQt.cpp #561270:561271
@@ -21,7 +21,8 @@
{
//qDebug("CanvasQt::paintEvent %p", \
dynamic_cast<FrameView*>(m_frameView)->frame()); QRect clip = ev->rect();
- GraphicsContext ctx(this);
+ QPainter p(this);
+ GraphicsContext ctx(&p);
dynamic_cast<FrameView*>(m_frameView)->frame()->paint(&ctx, clip);
}
--- branches/work/unity/WebKit/WebCore/platform/qt/FontQt.cpp #561270:561271
@@ -40,7 +40,7 @@
int from, int numGlyphs, const FloatPoint& point) const
{
//qDebug("FontData::drawGlyphs");
- QPainter p(graphicsContext->platformContext());
+ QPainter &p = *graphicsContext->platformContext();
//p.setPen(graphicsContext->pen());
p.setFont(font->platformData().font());
QChar *buffer = reinterpret_cast<QChar*>(glyphBuffer.glyphs(from));
@@ -49,6 +49,21 @@
p.drawText(QPointF(point.x(),point.y()), str);
}
+void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const \
TextStyle&, const FloatPoint& point) const +{
+ // ### style, run.from()/length() cut-off
+ ctx->platformContext()->drawText(point.x(),
+ point.y(),
+ QString::fromRawData(reinterpret_cast<const \
QChar *>(run.characters() + run.from()), run.length())); }
+float Font::floatWidthForComplexText(const TextRun& run, const TextStyle&) const
+{
+ // ### style
+ QFontMetricsF metrics(primaryFont()->m_font.font());
+ return metrics.width(QString::fromRawData(reinterpret_cast<const QChar \
*>(run.characters() + run.from()), run.length())); +}
+
+}
+
// vim: ts=4 sw=4 et
--- branches/work/unity/WebKit/WebCore/platform/qt/FrameQt.cpp #561270:561271
@@ -638,16 +638,7 @@
#endif
-void FrameQt::paintEvent(QPaintEvent *e)
-{
- qDebug("painting!!!");
- QRect clip = e->rect();
- GraphicsContext* ctx = new \
GraphicsContext(qobject_cast<QScrollArea*>(view()->qwidget())->widget());
- paint(ctx, clip);
- delete ctx;
}
-}
-
// vim: ts=4 sw=4 et
--- branches/work/unity/WebKit/WebCore/platform/qt/FrameQt.h #561270:561271
@@ -136,8 +136,6 @@
virtual void receivedAllData(TransferJob*,PlatformData);
void setFrameGeometry(const IntRect&);
-protected:
- virtual void paintEvent(QPaintEvent *e);
private:
void init();
virtual bool passMouseDownEventToWidget(Widget*);
--- branches/work/unity/WebKit/WebCore/platform/qt/GraphicsContextQt.cpp \
#561270:561271 @@ -129,13 +129,13 @@
class GraphicsContextPlatformPrivate {
public:
- GraphicsContextPlatformPrivate(QPaintDevice *device);
+ GraphicsContextPlatformPrivate(QPainter *painter);
~GraphicsContextPlatformPrivate();
inline QPainter &p()
{
if (layers.isEmpty())
- return painter;
+ return *painter;
else
return *layers.top().painter;
}
@@ -146,20 +146,20 @@
IntRect focusRingClip;
private:
- QPainter painter;
+ QPainter *painter;
};
-GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPaintDevice \
*surface)
- : device(surface)
+GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPainter *p)
+ : device(p->device())
{
- painter.begin(device);
+ painter = p;
//painter.setRenderHint(QPainter::Antialiasing);
}
GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate()
{
- painter.end();
+ painter->end();
}
GraphicsContext::GraphicsContext(PlatformGraphicsContext* context)
@@ -181,7 +181,7 @@
PlatformGraphicsContext* GraphicsContext::platformContext() const
{
- return m_data->device;
+ return &m_data->p();
}
void GraphicsContext::savePlatformState()
--- branches/work/unity/WebKit/WebCore/platform/qt/ImageQt.cpp #561270:561271
@@ -82,12 +82,11 @@
// Set the compositing operation.
ctxt->setCompositeOperation(op);
- QPainter painter(ctxt->platformContext());
+ QPainter *painter(ctxt->platformContext());
// Test using example site at
// http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html
- painter.drawImage(dst, *image, src);
- painter.end();
+ painter->drawImage(dst, *image, src);
ctxt->restore();
@@ -125,9 +124,8 @@
ctxt->save();
// Set the compositing operation.
ctxt->setCompositeOperation(op);
- QPainter p(ctxt->platformContext());
- p.drawTiledPixmap(dstRect, pix);
- p.end();
+ QPainter *p = ctxt->platformContext();
+ p->drawTiledPixmap(dstRect, pix);
ctxt->restore();
startAnimation();
--- branches/work/unity/WebKit/WebCore/platform/qt/TemporaryLinkStubs.cpp \
#561270:561271 @@ -70,8 +70,6 @@
JavaAppletWidget::JavaAppletWidget(IntSize const&, Element*, WTF::HashMap<String, \
String> const&) { notImplemented(); }
FloatRect Font::selectionRectForComplexText(const TextRun&, const TextStyle&, const \
IntPoint&, int) const { notImplemented(); return FloatRect(); }
-void Font::drawComplexText(GraphicsContext*, const TextRun&, const TextStyle&, const \
FloatPoint&) const { notImplemented(); }
-float Font::floatWidthForComplexText(const TextRun&, const TextStyle&) const { \
notImplemented(); return 0; } int Font::offsetForPositionForComplexText(const \
TextRun&, const TextStyle&, int, bool) const { notImplemented(); return 0; }
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic