summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/qt
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-18 13:36:51 +0100
committerSteve Block <steveblock@google.com>2011-05-24 15:38:28 +0100
commit2fc2651226baac27029e38c9d6ef883fa32084db (patch)
treee396d4bf89dcce6ed02071be66212495b1df1dec /Source/WebCore/platform/graphics/qt
parentb3725cedeb43722b3b175aaeff70552e562d2c94 (diff)
downloadexternal_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.zip
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.gz
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.bz2
Merge WebKit at r78450: Initial merge by git.
Change-Id: I6d3e5f1f868ec266a0aafdef66182ddc3f265dc1
Diffstat (limited to 'Source/WebCore/platform/graphics/qt')
-rw-r--r--Source/WebCore/platform/graphics/qt/ContextShadowQt.cpp5
-rw-r--r--Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp4
-rw-r--r--Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h3
-rw-r--r--Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp2
-rw-r--r--Source/WebCore/platform/graphics/qt/FontQt.cpp37
-rw-r--r--Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp30
-rw-r--r--Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp30
-rw-r--r--Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp16
-rw-r--r--Source/WebCore/platform/graphics/qt/GraphicsLayerQt.h4
-rw-r--r--Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp14
-rw-r--r--Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp2
-rw-r--r--Source/WebCore/platform/graphics/qt/ImageQt.cpp23
-rw-r--r--Source/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp2
-rw-r--r--Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp19
-rw-r--r--Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h2
-rw-r--r--Source/WebCore/platform/graphics/qt/PathQt.cpp21
-rw-r--r--Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp22
-rw-r--r--Source/WebCore/platform/graphics/qt/TransparencyLayer.h3
18 files changed, 115 insertions, 124 deletions
diff --git a/Source/WebCore/platform/graphics/qt/ContextShadowQt.cpp b/Source/WebCore/platform/graphics/qt/ContextShadowQt.cpp
index 37d6b44..9eb31a7 100644
--- a/Source/WebCore/platform/graphics/qt/ContextShadowQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/ContextShadowQt.cpp
@@ -57,7 +57,7 @@ private:
ShadowBuffer::ShadowBuffer(QObject* parent)
: QObject(parent)
- , timerId(0)
+ , timerId(-1)
{
}
@@ -89,7 +89,8 @@ QImage* ShadowBuffer::scratchImage(const QSize& size)
void ShadowBuffer::schedulePurge()
{
static const double BufferPurgeDelay = 2; // seconds
- killTimer(timerId);
+ if (timerId >= 0)
+ killTimer(timerId);
timerId = startTimer(BufferPurgeDelay * 1000);
}
diff --git a/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp b/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp
index cd28f0e..5238d46 100644
--- a/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "Extensions3DQt.h"
@@ -58,4 +58,4 @@ int Extensions3DQt::getGraphicsResetStatusARB()
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h
index 54fa679..e8441d2 100644
--- a/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h
+++ b/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h
@@ -24,6 +24,7 @@
#include "FontOrientation.h"
#include "FontRenderingMode.h"
+#include "FontWidthVariant.h"
#include <wtf/FastAllocBase.h>
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
@@ -42,7 +43,7 @@ public:
// for use with QFontDatabase::addApplicationFont/removeApplicationFont
int m_handle;
- FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontRenderingMode = NormalRenderingMode);
+ FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
static bool supportsFormat(const String&);
};
diff --git a/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp b/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
index e2f009b..ec8747d 100644
--- a/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
@@ -34,7 +34,7 @@ FontCustomPlatformData::~FontCustomPlatformData()
QFontDatabase::removeApplicationFont(m_handle);
}
-FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontRenderingMode)
+FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontWidthVariant, FontRenderingMode)
{
QFont font;
font.setFamily(QFontDatabase::applicationFontFamilies(m_handle)[0]);
diff --git a/Source/WebCore/platform/graphics/qt/FontQt.cpp b/Source/WebCore/platform/graphics/qt/FontQt.cpp
index 778a13f..646cd0e 100644
--- a/Source/WebCore/platform/graphics/qt/FontQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/FontQt.cpp
@@ -61,14 +61,14 @@ static const QString fromRawDataWithoutRef(const String& string, int start = 0,
static QTextLine setupLayout(QTextLayout* layout, const TextRun& style)
{
int flags = style.rtl() ? Qt::TextForceRightToLeft : Qt::TextForceLeftToRight;
- if (style.padding())
+ if (style.expansion())
flags |= Qt::TextJustificationForced;
layout->setFlags(flags);
layout->beginLayout();
QTextLine line = layout->createLine();
line.setLineWidth(INT_MAX/256);
- if (style.padding())
- line.setLineWidth(line.naturalTextWidth() + style.padding());
+ if (style.expansion())
+ line.setLineWidth(line.naturalTextWidth() + style.expansion());
layout->endLayout();
return line;
}
@@ -107,7 +107,7 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float
textStrokePen = QPen(QColor(ctx->strokeColor()), ctx->strokeThickness());
}
- String sanitized = Font::normalizeSpaces(String(run.characters(), run.length()));
+ String sanitized = Font::normalizeSpaces(run.characters(), run.length());
QString string = fromRawDataWithoutRef(sanitized);
QPointF pt(point.x(), point.y());
@@ -196,7 +196,7 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float
p->save();
p->setPen(ctxShadow->m_color);
p->translate(ctxShadow->offset());
- p->drawText(pt, string, flags, run.padding());
+ p->drawText(pt, string, flags, run.expansion());
p->restore();
} else {
QFontMetrics fm(font);
@@ -210,7 +210,7 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float
// Since it will be blurred anyway, we don't care about render hints.
shadowPainter->setFont(p->font());
shadowPainter->setPen(ctxShadow->m_color);
- shadowPainter->drawText(pt, string, flags, run.padding());
+ shadowPainter->drawText(pt, string, flags, run.expansion());
ctxShadow->endShadowLayer(ctx);
}
}
@@ -243,7 +243,7 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float
if (ctx->textDrawingMode() & TextModeFill) {
QPen previousPen = p->pen();
p->setPen(textFillPen);
- p->drawText(pt, string, flags, run.padding());
+ p->drawText(pt, string, flags, run.expansion());
p->setPen(previousPen);
}
}
@@ -299,7 +299,7 @@ float Font::floatWidthForSimpleText(const TextRun& run, GlyphBuffer* glyphBuffer
if (!run.length())
return 0;
- String sanitized = Font::normalizeSpaces(String(run.characters(), run.length()));
+ String sanitized = Font::normalizeSpaces(run.characters(), run.length());
QString string = fromRawDataWithoutRef(sanitized);
int w = QFontMetrics(font()).width(string, -1, Qt::TextBypassShaping);
@@ -308,7 +308,7 @@ float Font::floatWidthForSimpleText(const TextRun& run, GlyphBuffer* glyphBuffer
if (treatAsSpace(run[0]))
w -= m_wordSpacing;
- return w + run.padding();
+ return w + run.expansion();
#else
Q_ASSERT(false);
return 0;
@@ -324,9 +324,9 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon
return 0;
if (run.length() == 1 && treatAsSpace(run[0]))
- return QFontMetrics(font()).width(space) + run.padding();
+ return QFontMetrics(font()).width(space) + run.expansion();
- String sanitized = Font::normalizeSpaces(String(run.characters(), run.length()));
+ String sanitized = Font::normalizeSpaces(run.characters(), run.length());
QString string = fromRawDataWithoutRef(sanitized);
int w = QFontMetrics(font()).width(string);
@@ -334,13 +334,13 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon
if (treatAsSpace(run[0]))
w -= m_wordSpacing;
- return w + run.padding();
+ return w + run.expansion();
}
int Font::offsetForPositionForSimpleText(const TextRun& run, float position, bool includePartialGlyphs) const
{
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
- String sanitized = Font::normalizeSpaces(String(run.characters(), run.length()));
+ String sanitized = Font::normalizeSpaces(run.characters(), run.length());
QString string = fromRawDataWithoutRef(sanitized);
QFontMetrics fm(font());
@@ -367,7 +367,7 @@ int Font::offsetForPositionForSimpleText(const TextRun& run, float position, boo
int Font::offsetForPositionForComplexText(const TextRun& run, float position, bool) const
{
- String sanitized = Font::normalizeSpaces(String(run.characters(), run.length()));
+ String sanitized = Font::normalizeSpaces(run.characters(), run.length());
QString string = fromRawDataWithoutRef(sanitized);
QTextLayout layout(string, font());
@@ -378,7 +378,7 @@ int Font::offsetForPositionForComplexText(const TextRun& run, float position, bo
FloatRect Font::selectionRectForSimpleText(const TextRun& run, const FloatPoint& pt, int h, int from, int to) const
{
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
- String sanitized = Font::normalizeSpaces(String(run.characters(), run.length()));
+ String sanitized = Font::normalizeSpaces(run.characters(), run.length());
QString wholeText = fromRawDataWithoutRef(sanitized);
QString selectedText = fromRawDataWithoutRef(sanitized, from, qMin(to - from, wholeText.length() - from));
@@ -394,7 +394,7 @@ FloatRect Font::selectionRectForSimpleText(const TextRun& run, const FloatPoint&
FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& pt, int h, int from, int to) const
{
- String sanitized = Font::normalizeSpaces(String(run.characters(), run.length()));
+ String sanitized = Font::normalizeSpaces(run.characters(), run.length());
QString string = fromRawDataWithoutRef(sanitized);
QTextLayout layout(string, font());
@@ -413,6 +413,11 @@ bool Font::canReturnFallbackFontsForComplexText()
return false;
}
+bool Font::canExpandAroundIdeographsInComplexText()
+{
+ return false;
+}
+
bool Font::primaryFontHasGlyphForCharacter(UChar32) const
{
notImplemented();
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
index 295212c..8b87f5f 100644
--- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
@@ -34,7 +34,7 @@
#include <wtf/UnusedParam.h>
#include <wtf/text/CString.h>
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
namespace WebCore {
@@ -1611,28 +1611,6 @@ void GraphicsContext3D::deleteTexture(Platform3DObject texture)
glDeleteTextures(1, &texture);
}
-unsigned int GraphicsContext3D::sizeInBytes(GC3Denum type)
-{
- switch (type) {
- case GraphicsContext3D::BYTE:
- return sizeof(GLbyte);
- case GraphicsContext3D::UNSIGNED_BYTE:
- return sizeof(GLubyte);
- case GraphicsContext3D::SHORT:
- return sizeof(GLshort);
- case GraphicsContext3D::UNSIGNED_SHORT:
- return sizeof(GLushort);
- case GraphicsContext3D::INT:
- return sizeof(GLint);
- case GraphicsContext3D::UNSIGNED_INT:
- return sizeof(GLuint);
- case GraphicsContext3D::FLOAT:
- return sizeof(GLfloat);
- default:
- return 0;
- }
-}
-
void GraphicsContext3D::synthesizeGLError(GC3Denum error)
{
m_internal->m_syntheticErrors.add(error);
@@ -1669,6 +1647,10 @@ bool GraphicsContext3D::getImageData(Image* image,
format, type, neededAlphaOp, outputVector.data());
}
+void GraphicsContext3D::setContextLostCallback(PassOwnPtr<ContextLostCallback>)
+{
+}
+
}
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 4dabe09..bf2826c 100644
--- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -62,14 +62,11 @@
#include <QPolygonF>
#include <QStack>
#include <QVector>
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
+#include <wtf/MathExtras.h>
namespace WebCore {
-QPainter::CompositionMode GraphicsContext::toQtCompositionMode(CompositeOperator op)
+static inline QPainter::CompositionMode toQtCompositionMode(CompositeOperator op)
{
switch (op) {
case CompositeClear:
@@ -231,8 +228,15 @@ GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPainter* p, cons
if (!painter)
return;
+#if OS(SYMBIAN)
+ if (painter->paintEngine()->type() == QPaintEngine::OpenVG)
+ antiAliasingForRectsAndLines = true;
+ else
+ antiAliasingForRectsAndLines = painter->testRenderHint(QPainter::Antialiasing);
+#else
// Use the default the QPainter was constructed with.
antiAliasingForRectsAndLines = painter->testRenderHint(QPainter::Antialiasing);
+#endif
// Used for default image interpolation quality.
initialSmoothPixmapTransformHint = painter->testRenderHint(QPainter::SmoothPixmapTransform);
@@ -784,7 +788,7 @@ void GraphicsContext::clipPath(const Path& path, WindRule clipRule)
p->setClipPath(platformPath, Qt::IntersectClip);
}
-void drawFocusRingForPath(QPainter* p, const QPainterPath& path, int width, const Color& color, bool antiAliasing)
+void drawFocusRingForPath(QPainter* p, const QPainterPath& path, const Color& color, bool antiAliasing)
{
const bool antiAlias = p->testRenderHint(QPainter::Antialiasing);
p->setRenderHint(QPainter::Antialiasing, antiAliasing);
@@ -794,9 +798,8 @@ void drawFocusRingForPath(QPainter* p, const QPainterPath& path, int width, cons
QPen nPen = p->pen();
nPen.setColor(color);
- nPen.setWidth(width);
p->setBrush(Qt::NoBrush);
- nPen.setStyle(Qt::SolidLine);
+ nPen.setStyle(Qt::DotLine);
p->strokePath(path, nPen);
p->setBrush(oldBrush);
@@ -805,14 +808,14 @@ void drawFocusRingForPath(QPainter* p, const QPainterPath& path, int width, cons
p->setRenderHint(QPainter::Antialiasing, antiAlias);
}
-void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color)
+void GraphicsContext::drawFocusRing(const Path& path, int /* width */, int offset, const Color& color)
{
// FIXME: Use 'offset' for something? http://webkit.org/b/49909
if (paintingDisabled() || !color.isValid())
return;
- drawFocusRingForPath(m_data->p(), path.platformPath(), width, color, m_data->antiAliasingForRectsAndLines);
+ drawFocusRingForPath(m_data->p(), path.platformPath(), color, m_data->antiAliasingForRectsAndLines);
}
/**
@@ -840,8 +843,7 @@ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int
tmpPath.addRoundedRect(rect, radius, radius);
path = path.united(tmpPath);
}
-
- drawFocusRingForPath(m_data->p(), path, width, color, m_data->antiAliasingForRectsAndLines);
+ drawFocusRingForPath(m_data->p(), path, color, m_data->antiAliasingForRectsAndLines);
}
void GraphicsContext::drawLineForText(const IntPoint& origin, int width, bool)
@@ -896,7 +898,7 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect)
qreal deviceScaleY = sqrtf(deviceTransform.m21() * deviceTransform.m21() + deviceTransform.m22() * deviceTransform.m22());
QPoint deviceOrigin(frect.x() * deviceScaleX, frect.y() * deviceScaleY);
- QPoint deviceLowerRight(frect.right() * deviceScaleX, frect.bottom() * deviceScaleY);
+ QPoint deviceLowerRight(frect.maxX() * deviceScaleX, frect.maxY() * deviceScaleY);
// Don't let the height or width round to 0 unless either was originally 0
if (deviceOrigin.y() == deviceLowerRight.y() && frect.height())
@@ -1135,7 +1137,7 @@ void GraphicsContext::rotate(float radians)
if (paintingDisabled())
return;
- m_data->p()->rotate(180 / M_PI*radians);
+ m_data->p()->rotate(rad2deg(qreal(radians)));
}
void GraphicsContext::scale(const FloatSize& s)
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
index 75fb427..0d7aa45 100644
--- a/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
@@ -305,7 +305,7 @@ public:
}
} m_state;
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
const GraphicsContext3D* m_gc3D;
#endif
@@ -335,7 +335,7 @@ GraphicsLayerQtImpl::GraphicsLayerQtImpl(GraphicsLayerQt* newLayer)
#if ENABLE(TILED_BACKING_STORE)
, m_tiledBackingStore(0)
#endif
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
, m_gc3D(0)
#endif
{
@@ -529,12 +529,12 @@ void GraphicsLayerQtImpl::updateTransform()
// have to maintain that ourselves for 3D.
localTransform
.translate3d(originX + m_state.pos.x(), originY + m_state.pos.y(), m_state.anchorPoint.z())
- .multLeft(m_baseTransform)
+ .multiply(m_baseTransform)
.translate3d(-originX, -originY, -m_state.anchorPoint.z());
// This is the actual 3D transform of this item, with the ancestors' transform baked in.
m_transformRelativeToRootLayer = TransformationMatrix(parent ? parent->m_transformRelativeToRootLayer : TransformationMatrix())
- .multLeft(localTransform);
+ .multiply(localTransform);
// Now we have enough information to determine if the layer is facing backwards.
if (!m_state.backfaceVisibility && m_transformRelativeToRootLayer.inverse().m33() < 0) {
@@ -562,7 +562,7 @@ void GraphicsLayerQtImpl::updateTransform()
if (!m_state.childrenTransform.isIdentity()) {
m_transformRelativeToRootLayer
.translate(m_size.width() / 2, m_size.height() /2)
- .multLeft(m_state.childrenTransform)
+ .multiply(m_state.childrenTransform)
.translate(-m_size.width() / 2, -m_size.height() /2);
}
@@ -647,7 +647,7 @@ void GraphicsLayerQtImpl::paint(QPainter* painter, const QStyleOptionGraphicsIte
case MediaContentType:
// we don't need to paint anything: we have a QGraphicsItem from the media element
break;
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
case Canvas3DContentType:
m_gc3D->paint(painter, option->rect);
break;
@@ -791,7 +791,7 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform
setFlag(ItemHasNoContents, !m_layer->drawsContent());
break;
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
case Canvas3DContentType:
if (m_pendingContent.contentType != m_currentContent.contentType)
update();
@@ -1250,7 +1250,7 @@ void GraphicsLayerQt::setContentsBackgroundColor(const Color& color)
GraphicsLayer::setContentsBackgroundColor(color);
}
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
void GraphicsLayerQt::setContentsToGraphicsContext3D(const GraphicsContext3D* ctx)
{
if (ctx == m_impl->m_gc3D)
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.h b/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.h
index 8027143..569bd8d 100644
--- a/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.h
+++ b/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.h
@@ -20,7 +20,7 @@
#ifndef GraphicsLayerQt_h
#define GraphicsLayerQt_h
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "GraphicsContext3D.h"
#endif
#include "GraphicsLayer.h"
@@ -79,7 +79,7 @@ public:
virtual void setContentsNeedsDisplay();
virtual void setContentsToMedia(PlatformLayer*);
virtual void setContentsBackgroundColor(const Color&);
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
virtual void setContentsToGraphicsContext3D(const GraphicsContext3D*);
virtual void setGraphicsContext3DNeedsDisplay();
#endif
diff --git a/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp
index d1567ec..62f5c3e 100644
--- a/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp
@@ -188,7 +188,7 @@ PassRefPtr<ByteArray> getImageData(const IntRect& rect, const ImageBufferData& i
RefPtr<ByteArray> result = ByteArray::create(rect.width() * rect.height() * 4);
unsigned char* data = result->data();
- if (rect.x() < 0 || rect.y() < 0 || rect.right() > size.width() || rect.bottom() > size.height())
+ if (rect.x() < 0 || rect.y() < 0 || rect.maxX() > size.width() || rect.maxY() > size.height())
memset(data, 0, result->length());
int originx = rect.x();
@@ -197,7 +197,7 @@ PassRefPtr<ByteArray> getImageData(const IntRect& rect, const ImageBufferData& i
destx = -originx;
originx = 0;
}
- int endx = rect.right();
+ int endx = rect.maxX();
if (endx > size.width())
endx = size.width();
int numColumns = endx - originx;
@@ -208,7 +208,7 @@ PassRefPtr<ByteArray> getImageData(const IntRect& rect, const ImageBufferData& i
desty = -originy;
originy = 0;
}
- int endy = rect.bottom();
+ int endy = rect.maxY();
if (endy > size.height())
endy = size.height();
int numRows = endy - originy;
@@ -302,9 +302,9 @@ void putImageData(ByteArray*& source, const IntSize& sourceSize, const IntRect&
ASSERT(destx >= 0);
ASSERT(destx < size.width());
ASSERT(originx >= 0);
- ASSERT(originx <= sourceRect.right());
+ ASSERT(originx <= sourceRect.maxX());
- int endx = destPoint.x() + sourceRect.right();
+ int endx = destPoint.x() + sourceRect.maxX();
ASSERT(endx <= size.width());
int numColumns = endx - destx;
@@ -314,9 +314,9 @@ void putImageData(ByteArray*& source, const IntSize& sourceSize, const IntRect&
ASSERT(desty >= 0);
ASSERT(desty < size.height());
ASSERT(originy >= 0);
- ASSERT(originy <= sourceRect.bottom());
+ ASSERT(originy <= sourceRect.maxY());
- int endy = destPoint.y() + sourceRect.bottom();
+ int endy = destPoint.y() + sourceRect.maxY();
ASSERT(endy <= size.height());
int numRows = endy - desty;
diff --git a/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp
index 71352e4..3540994 100644
--- a/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp
@@ -213,7 +213,7 @@ bool ImageDecoderQt::internalHandleCurrentImage(size_t frameIndex)
// now into the ImageFrame - even if the image is not
ImageFrame* const buffer = &m_frameBufferCache[frameIndex];
- buffer->setRect(m_reader->currentImageRect());
+ buffer->setOriginalFrameRect(m_reader->currentImageRect());
buffer->setStatus(ImageFrame::FrameComplete);
buffer->setDuration(m_reader->nextImageDelay());
buffer->setPixmap(pixmap);
diff --git a/Source/WebCore/platform/graphics/qt/ImageQt.cpp b/Source/WebCore/platform/graphics/qt/ImageQt.cpp
index 58f82ef..0c8ce9e 100644
--- a/Source/WebCore/platform/graphics/qt/ImageQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/ImageQt.cpp
@@ -120,11 +120,9 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const
CompositeOperator previousOperator = ctxt->compositeOperation();
- ctxt->setCompositeOperation(op);
- QPainter* p = ctxt->platformContext();
- if (!pixmap.hasAlpha() && p->compositionMode() == QPainter::CompositionMode_SourceOver)
- p->setCompositionMode(QPainter::CompositionMode_Source);
+ ctxt->setCompositeOperation(!pixmap.hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
+ QPainter* p = ctxt->platformContext();
QTransform transform(patternTransform);
// If this would draw more than one scaled tile, we scale the pixmap first and then use the result to draw.
@@ -223,15 +221,8 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst,
return;
}
- QPainter* painter(ctxt->platformContext());
-
- QPainter::CompositionMode compositionMode = GraphicsContext::toQtCompositionMode(op);
-
- if (!image->hasAlpha() && painter->compositionMode() == QPainter::CompositionMode_SourceOver)
- compositionMode = QPainter::CompositionMode_Source;
-
- QPainter::CompositionMode lastCompositionMode = painter->compositionMode();
- painter->setCompositionMode(compositionMode);
+ CompositeOperator previousOperator = ctxt->compositeOperation();
+ ctxt->setCompositeOperation(!image->hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
ContextShadow* shadow = ctxt->contextShadow();
if (shadow->m_type != ContextShadow::NoShadow) {
@@ -243,11 +234,9 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst,
}
}
- // Test using example site at
- // http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html
- painter->drawPixmap(normalizedDst, *image, normalizedSrc);
+ ctxt->platformContext()->drawPixmap(normalizedDst, *image, normalizedSrc);
- painter->setCompositionMode(lastCompositionMode);
+ ctxt->setCompositeOperation(previousOperator);
if (imageObserver())
imageObserver()->didDraw(this);
diff --git a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
index b881036..fab4db1 100644
--- a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
+++ b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
@@ -102,7 +102,7 @@ MediaPlayerPrivatePhonon::MediaPlayerPrivatePhonon(MediaPlayer* player)
// Make sure we get updates for each frame
m_videoWidget->installEventFilter(this);
- foreach (QWidget* widget, qFindChildren<QWidget*>(m_videoWidget))
+ foreach (QWidget* widget, m_videoWidget->findChildren<QWidget*>())
widget->installEventFilter(this);
connect(m_mediaObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)),
diff --git a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
index 0a4c0f6..caf9c2d 100644
--- a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
@@ -215,7 +215,7 @@ void MediaPlayerPrivateQt::commitLoad(const String& url)
// Don't set the header if there are no cookies.
// This prevents a warning from being emitted.
if (!cookies.isEmpty())
- request.setHeader(QNetworkRequest::CookieHeader, qVariantFromValue(cookies));
+ request.setHeader(QNetworkRequest::CookieHeader, QVariant::fromValue(cookies));
// Set the refferer, but not when requesting insecure content from a secure page
QUrl documentUrl = QUrl(QString(document->documentURI()));
@@ -543,7 +543,7 @@ void MediaPlayerPrivateQt::updateStates()
m_readyState = MediaPlayer::HaveCurrentData;
} else if (currentStatus == QMediaPlayer::BufferedMedia
|| currentStatus == QMediaPlayer::EndOfMedia) {
- m_networkState = MediaPlayer::Idle;
+ m_networkState = MediaPlayer::Loaded;
m_readyState = MediaPlayer::HaveEnoughData;
} else if (currentStatus == QMediaPlayer::InvalidMedia) {
m_networkState = MediaPlayer::NetworkError;
@@ -618,6 +618,21 @@ void MediaPlayerPrivateQt::paint(GraphicsContext* context, const IntRect& rect)
m_videoScene->render(painter, QRectF(QRect(rect)), m_videoItem->sceneBoundingRect());
}
+void MediaPlayerPrivateQt::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& rect)
+{
+ if (context->paintingDisabled())
+ return;
+
+ if (!m_isVisible)
+ return;
+
+ // Grab the painter and widget
+ QPainter* painter = context->platformContext();
+
+ // Render the video, using the item as it might not be in the scene
+ m_videoItem->paint(painter, 0, 0);
+}
+
void MediaPlayerPrivateQt::repaint()
{
m_webCorePlayer->repaint();
diff --git a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
index 2621432..e4133db 100644
--- a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
+++ b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
@@ -89,6 +89,8 @@ public:
void setSize(const IntSize&);
void paint(GraphicsContext*, const IntRect&);
+ // reimplemented for canvas drawImage(HTMLVideoElement)
+ void paintCurrentFrameInContext(GraphicsContext*, const IntRect&);
bool supportsFullscreen() const { return true; }
diff --git a/Source/WebCore/platform/graphics/qt/PathQt.cpp b/Source/WebCore/platform/graphics/qt/PathQt.cpp
index 571b405..ad482f7 100644
--- a/Source/WebCore/platform/graphics/qt/PathQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/PathQt.cpp
@@ -39,15 +39,9 @@
#include <QPainterPath>
#include <QTransform>
#include <QString>
+#include <wtf/MathExtras.h>
#include <wtf/OwnPtr.h>
-#define _USE_MATH_DEFINES
-#include <math.h>
-
-#ifndef M_PI
-# define M_PI 3.14159265358979323846
-#endif
-
namespace WebCore {
Path::Path()
@@ -263,7 +257,6 @@ void Path::closeSubpath()
m_path.closeSubpath();
}
-#define DEGREES(t) ((t) * 180.0 / M_PI)
void Path::addArc(const FloatPoint& p, float r, float sar, float ear, bool anticlockwise)
{
qreal xc = p.x();
@@ -280,8 +273,8 @@ void Path::addArc(const FloatPoint& p, float r, float sar, float ear, bool antic
anticlockwise = !anticlockwise;
//end hack
- float sa = DEGREES(sar);
- float ea = DEGREES(ear);
+ float sa = rad2deg(sar);
+ float ea = rad2deg(ear);
double span = 0;
@@ -438,6 +431,14 @@ float Path::normalAngleAtLength(float length, bool& ok)
qreal percent = m_path.percentAtLength(length);
qreal angle = m_path.angleAtPercent(percent);
+ // Normalize angle value.
+ // QPainterPath returns angle values with the origo being at the top left corner.
+ // In case of moveTo(0, 0) and addLineTo(0, 10) the angle is 270,
+ // while the caller expects it to be 90.
+ // Normalize the value by mirroring it to the x-axis.
+ // For more info look at pathLengthApplierFunction().
+ if (angle > 0)
+ angle = 360 - angle;
return angle;
}
diff --git a/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp b/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp
index 47ddf02..9e43558 100644
--- a/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp
@@ -24,7 +24,7 @@
#include "config.h"
#include "SimpleFontData.h"
-#include <QFontMetrics>
+#include <QFontMetricsF>
namespace WebCore {
@@ -41,25 +41,19 @@ bool SimpleFontData::containsCharacters(const UChar*, int) const
void SimpleFontData::platformInit()
{
if (!m_platformData.size()) {
- m_ascent = 0;
- m_descent = 0;
- m_lineGap = 0;
- m_lineSpacing = 0;
+ m_fontMetrics.reset();
m_avgCharWidth = 0;
m_maxCharWidth = 0;
- m_xHeight = 0;
- m_unitsPerEm = 0;
return;
}
- QFontMetrics fm(m_platformData.font());
-
- m_ascent = fm.ascent();
- m_descent = fm.descent();
- m_lineSpacing = fm.lineSpacing();
- m_xHeight = fm.xHeight();
+ QFontMetricsF fm(m_platformData.font());
+ m_fontMetrics.setAscent(fm.ascent());
+ m_fontMetrics.setDescent(fm.descent());
+ m_fontMetrics.setXHeight(fm.xHeight());
+ m_fontMetrics.setLineGap(fm.leading());
+ m_fontMetrics.setLineSpacing(fm.lineSpacing());
m_spaceWidth = fm.width(QLatin1Char(' '));
- m_lineGap = fm.leading();
}
void SimpleFontData::platformGlyphInit()
diff --git a/Source/WebCore/platform/graphics/qt/TransparencyLayer.h b/Source/WebCore/platform/graphics/qt/TransparencyLayer.h
index ff9ef20..f13deb0 100644
--- a/Source/WebCore/platform/graphics/qt/TransparencyLayer.h
+++ b/Source/WebCore/platform/graphics/qt/TransparencyLayer.h
@@ -59,9 +59,8 @@ public:
painter.setPen(p->pen());
painter.setBrush(p->brush());
painter.setTransform(p->transform(), true);
- painter.setOpacity(p->opacity());
painter.setFont(p->font());
- painter.setCompositionMode(p->compositionMode());
+ painter.setOpacity(1);
}
TransparencyLayer()