summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/qt
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-24 11:24:40 +0100
committerBen Murdoch <benm@google.com>2011-06-02 09:53:15 +0100
commit81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch)
tree7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebCore/platform/graphics/qt
parent94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff)
downloadexternal_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip
external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz
external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebCore/platform/graphics/qt')
-rw-r--r--Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp26
-rw-r--r--Source/WebCore/platform/graphics/qt/Extensions3DQt.h6
-rw-r--r--Source/WebCore/platform/graphics/qt/FontPlatformData.h134
-rw-r--r--Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp67
-rw-r--r--Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp36
-rw-r--r--Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp40
-rw-r--r--Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp34
-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.h1
-rw-r--r--Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp1
11 files changed, 200 insertions, 166 deletions
diff --git a/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp b/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp
index 5238d46..dcea72f 100644
--- a/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp
@@ -56,6 +56,32 @@ int Extensions3DQt::getGraphicsResetStatusARB()
return GraphicsContext3D::NO_ERROR;
}
+void Extensions3DQt::blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter)
+{
+}
+
+void Extensions3DQt::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height)
+{
+}
+
+Platform3DObject Extensions3DQt::createVertexArrayOES()
+{
+ return 0;
+}
+
+void Extensions3DQt::deleteVertexArrayOES(Platform3DObject)
+{
+}
+
+GC3Dboolean Extensions3DQt::isVertexArrayOES(Platform3DObject)
+{
+ return GL_FALSE;
+}
+
+void Extensions3DQt::bindVertexArrayOES(Platform3DObject)
+{
+}
+
} // namespace WebCore
#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/platform/graphics/qt/Extensions3DQt.h b/Source/WebCore/platform/graphics/qt/Extensions3DQt.h
index ae4b375..c67fbed 100644
--- a/Source/WebCore/platform/graphics/qt/Extensions3DQt.h
+++ b/Source/WebCore/platform/graphics/qt/Extensions3DQt.h
@@ -38,6 +38,12 @@ public:
virtual bool supports(const String&);
virtual void ensureEnabled(const String&);
virtual int getGraphicsResetStatusARB();
+ virtual void blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter);
+ virtual void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height);
+ virtual Platform3DObject createVertexArrayOES();
+ virtual void deleteVertexArrayOES(Platform3DObject);
+ virtual GC3Dboolean isVertexArrayOES(Platform3DObject);
+ virtual void bindVertexArrayOES(Platform3DObject);
private:
// This class only needs to be instantiated by GraphicsContext3D implementations.
diff --git a/Source/WebCore/platform/graphics/qt/FontPlatformData.h b/Source/WebCore/platform/graphics/qt/FontPlatformData.h
index f268370..32e8a2d 100644
--- a/Source/WebCore/platform/graphics/qt/FontPlatformData.h
+++ b/Source/WebCore/platform/graphics/qt/FontPlatformData.h
@@ -24,142 +24,120 @@
#ifndef FontPlatformData_h
#define FontPlatformData_h
-#include <wtf/Forward.h>
#include "FontDescription.h"
#include "FontOrientation.h"
#include <QFont>
#include <QHash>
+#include <wtf/Forward.h>
+#include <wtf/RefCounted.h>
namespace WebCore {
-class FontPlatformDataPrivate {
+class FontPlatformDataPrivate : public RefCounted<FontPlatformDataPrivate> {
WTF_MAKE_NONCOPYABLE(FontPlatformDataPrivate); WTF_MAKE_FAST_ALLOCATED;
public:
FontPlatformDataPrivate()
- : refCount(1)
- , size(font.pixelSize())
+ : size(font.pixelSize())
, bold(font.bold())
, oblique(false)
- {}
+ , isDeletedValue(false)
+ { }
FontPlatformDataPrivate(const float size, const bool bold, const bool oblique)
- : refCount(1)
- , size(size)
+ : size(size)
, bold(bold)
, oblique(oblique)
- {}
+ , isDeletedValue(false)
+ { }
FontPlatformDataPrivate(const QFont& font)
- : refCount(1)
- , font(font)
+ : font(font)
, size(font.pixelSize())
, bold(font.bold())
, oblique(false)
- {}
- unsigned refCount;
+ , isDeletedValue(false)
+ { }
+ FontPlatformDataPrivate(WTF::HashTableDeletedValueType)
+ : isDeletedValue(true)
+ { }
+
QFont font;
float size;
bool bold : 1;
bool oblique : 1;
+ bool isDeletedValue : 1;
};
-
-
class FontPlatformData {
WTF_MAKE_FAST_ALLOCATED;
public:
- FontPlatformData() { }
FontPlatformData(float size, bool bold, bool oblique);
- FontPlatformData(const FontPlatformData &);
FontPlatformData(const FontDescription&, const AtomicString& familyName, int wordSpacing = 0, int letterSpacing = 0);
FontPlatformData(const QFont& font)
- : m_data(new FontPlatformDataPrivate(font))
- {}
+ : m_data(adoptRef(new FontPlatformDataPrivate(font)))
+ { }
FontPlatformData(WTF::HashTableDeletedValueType)
- : m_data(reinterpret_cast<FontPlatformDataPrivate*>(-1))
- {}
-
- ~FontPlatformData();
+ : m_data(adoptRef(new FontPlatformDataPrivate()))
+ {
+ m_data->isDeletedValue = true;
+ }
- FontPlatformData& operator=(const FontPlatformData&);
bool operator==(const FontPlatformData&) const;
bool isHashTableDeletedValue() const
{
- return m_data == reinterpret_cast<FontPlatformDataPrivate*>(-1);
- }
-
- static inline QFont::Weight toQFontWeight(FontWeight fontWeight)
- {
- switch (fontWeight) {
- case FontWeight100:
- case FontWeight200:
- return QFont::Light; // QFont::Light == Weight of 25
- case FontWeight600:
- return QFont::DemiBold; // QFont::DemiBold == Weight of 63
- case FontWeight700:
- case FontWeight800:
- return QFont::Bold; // QFont::Bold == Weight of 75
- case FontWeight900:
- return QFont::Black; // QFont::Black == Weight of 87
- case FontWeight300:
- case FontWeight400:
- case FontWeight500:
- default:
- return QFont::Normal; // QFont::Normal == Weight of 50
- }
+ return m_data && m_data->isDeletedValue;
}
QFont font() const
{
- Q_ASSERT(m_data != reinterpret_cast<FontPlatformDataPrivate*>(-1));
- if (m_data)
- return m_data->font;
- return QFont();
+ Q_ASSERT(!isHashTableDeletedValue());
+ if (!m_data)
+ return QFont();
+ return m_data->font;
}
float size() const
{
- Q_ASSERT(m_data != reinterpret_cast<FontPlatformDataPrivate*>(-1));
- if (m_data)
- return m_data->size;
- return 0.0f;
+ Q_ASSERT(!isHashTableDeletedValue());
+ if (!m_data)
+ return 0;
+ return m_data->size;
}
QString family() const
{
- Q_ASSERT(m_data != reinterpret_cast<FontPlatformDataPrivate*>(-1));
- if (m_data)
- return m_data->font.family();
- return QString();
+ Q_ASSERT(!isHashTableDeletedValue());
+ if (!m_data)
+ return QString();
+ return m_data->font.family();
}
bool bold() const
{
- Q_ASSERT(m_data != reinterpret_cast<FontPlatformDataPrivate*>(-1));
- if (m_data)
- return m_data->bold;
- return false;
+ Q_ASSERT(!isHashTableDeletedValue());
+ if (!m_data)
+ return false;
+ return m_data->bold;
}
bool italic() const
{
- Q_ASSERT(m_data != reinterpret_cast<FontPlatformDataPrivate*>(-1));
- if (m_data)
- return m_data->font.italic();
- return false;
+ Q_ASSERT(!isHashTableDeletedValue());
+ if (!m_data)
+ return false;
+ return m_data->font.italic();
}
bool smallCaps() const
{
- Q_ASSERT(m_data != reinterpret_cast<FontPlatformDataPrivate*>(-1));
- if (m_data)
- return m_data->font.capitalization() == QFont::SmallCaps;
- return false;
+ Q_ASSERT(!isHashTableDeletedValue());
+ if (!m_data)
+ return false;
+ return m_data->font.capitalization() == QFont::SmallCaps;
}
int pixelSize() const
{
- Q_ASSERT(m_data != reinterpret_cast<FontPlatformDataPrivate*>(-1));
- if (m_data) {
- // WebKit allows font size zero but QFont does not.
- if (!m_data->size)
- return m_data->size;
- return m_data->font.pixelSize();
- }
- return 0;
+ Q_ASSERT(!isHashTableDeletedValue());
+ if (!m_data)
+ return 0;
+ // WebCore allows a font size of zero, but QFont does not.
+ if (!m_data->size)
+ return 0;
+ return m_data->font.pixelSize();
}
FontOrientation orientation() const { return Horizontal; } // FIXME: Implement.
@@ -170,7 +148,7 @@ public:
String description() const;
#endif
private:
- FontPlatformDataPrivate* m_data;
+ RefPtr<FontPlatformDataPrivate> m_data;
};
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp b/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp
index 4c9eb32..185ae85 100644
--- a/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp
@@ -1,6 +1,7 @@
/*
Copyright (C) 2008 Holger Hans Peter Freyther
Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
+ Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -26,6 +27,27 @@
namespace WebCore {
+static inline QFont::Weight toQFontWeight(FontWeight fontWeight)
+{
+ switch (fontWeight) {
+ case FontWeight100:
+ case FontWeight200:
+ return QFont::Light; // QFont::Light == Weight of 25
+ case FontWeight600:
+ return QFont::DemiBold; // QFont::DemiBold == Weight of 63
+ case FontWeight700:
+ case FontWeight800:
+ return QFont::Bold; // QFont::Bold == Weight of 75
+ case FontWeight900:
+ return QFont::Black; // QFont::Black == Weight of 87
+ case FontWeight300:
+ case FontWeight400:
+ case FontWeight500:
+ default:
+ return QFont::Normal; // QFont::Normal == Weight of 50
+ }
+}
+
static inline bool isEmptyValue(const float size, const bool bold, const bool oblique)
{
// this is the empty value by definition of the trait FontDataCacheKeyTraits
@@ -34,20 +56,12 @@ static inline bool isEmptyValue(const float size, const bool bold, const bool ob
FontPlatformData::FontPlatformData(float size, bool bold, bool oblique)
{
- if (isEmptyValue(size, bold, oblique))
- m_data = 0;
- else
- m_data = new FontPlatformDataPrivate(size, bold, oblique);
-}
-
-FontPlatformData::FontPlatformData(const FontPlatformData &other) : m_data(other.m_data)
-{
- if (m_data && m_data != reinterpret_cast<FontPlatformDataPrivate*>(-1))
- ++m_data->refCount;
+ if (!isEmptyValue(size, bold, oblique))
+ m_data = adoptRef(new FontPlatformDataPrivate(size, bold, oblique));
}
FontPlatformData::FontPlatformData(const FontDescription& description, const AtomicString& familyName, int wordSpacing, int letterSpacing)
- : m_data(new FontPlatformDataPrivate())
+ : m_data(adoptRef(new FontPlatformDataPrivate()))
{
QFont& font = m_data->font;
int requestedSize = qRound(description.computedPixelSize());
@@ -70,38 +84,13 @@ FontPlatformData::FontPlatformData(const FontDescription& description, const Ato
m_data->size = (!requestedSize) ? requestedSize : font.pixelSize();
}
-FontPlatformData::~FontPlatformData()
-{
- if (!m_data || m_data == reinterpret_cast<FontPlatformDataPrivate*>(-1))
- return;
- --m_data->refCount;
- if (!m_data->refCount)
- delete m_data;
-}
-
-FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other)
-{
- if (m_data == other.m_data)
- return *this;
- if (m_data && m_data != reinterpret_cast<FontPlatformDataPrivate*>(-1)) {
- --m_data->refCount;
- if (!m_data->refCount)
- delete m_data;
- }
- m_data = other.m_data;
- if (m_data && m_data != reinterpret_cast<FontPlatformDataPrivate*>(-1))
- ++m_data->refCount;
- return *this;
-}
-
bool FontPlatformData::operator==(const FontPlatformData& other) const
{
if (m_data == other.m_data)
return true;
- if (!m_data || !other.m_data
- || m_data == reinterpret_cast<FontPlatformDataPrivate*>(-1) || other.m_data == reinterpret_cast<FontPlatformDataPrivate*>(-1))
- return false;
+ if (!m_data || !other.m_data || m_data->isDeletedValue || other.m_data->isDeletedValue)
+ return false;
const bool equals = (m_data->size == other.m_data->size
&& m_data->bold == other.m_data->bold
@@ -114,7 +103,7 @@ unsigned FontPlatformData::hash() const
{
if (!m_data)
return 0;
- if (m_data == reinterpret_cast<FontPlatformDataPrivate*>(-1))
+ if (m_data->isDeletedValue)
return 1;
return qHash(m_data->font.toString())
^ qHash(*reinterpret_cast<quint32*>(&m_data->size))
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
index 8b87f5f..b849214 100644
--- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
@@ -252,7 +252,7 @@ public:
GLuint m_currentFbo;
GLuint m_depthBuffer;
QImage m_pixels;
- ListHashSet<unsigned long> m_syntheticErrors;
+ ListHashSet<unsigned int> m_syntheticErrors;
OwnPtr<Extensions3DQt> m_extensions;
@@ -277,24 +277,6 @@ bool GraphicsContext3D::isGLES2Compliant() const
#endif
}
-// Even with underlying GLES2 driver, the below flags should still be set to
-// false if extentions exist (and they almost always do).
-bool GraphicsContext3D::isGLES2NPOTStrict() const
-{
- return false;
-}
-
-bool GraphicsContext3D::isErrorGeneratedOnOutOfBoundsAccesses() const
-{
- return false;
-}
-
-int GraphicsContext3D::getGraphicsResetStatusARB()
-{
- return NO_ERROR;
-}
-
-
GraphicsContext3DInternal::GraphicsContext3DInternal(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow)
: m_attrs(attrs)
, m_hostWindow(hostWindow)
@@ -499,12 +481,12 @@ void* GraphicsContext3DInternal::getProcAddress(const String& proc)
return 0;
}
-PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
+PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
{
// This implementation doesn't currently support rendering directly to the HostWindow.
if (renderStyle == RenderDirectlyToHostWindow)
return 0;
- OwnPtr<GraphicsContext3D> context(new GraphicsContext3D(attrs, hostWindow, false));
+ RefPtr<GraphicsContext3D> context = adoptRef(new GraphicsContext3D(attrs, hostWindow, false));
return context->m_internal ? context.release() : 0;
}
@@ -1038,7 +1020,7 @@ GC3Dboolean GraphicsContext3D::isTexture(Platform3DObject texture)
return glIsTexture(texture);
}
-void GraphicsContext3D::lineWidth(double width)
+void GraphicsContext3D::lineWidth(GC3Dfloat width)
{
m_internal->m_glWidget->makeCurrent();
glLineWidth(static_cast<float>(width));
@@ -1489,7 +1471,7 @@ void GraphicsContext3D::getUniformiv(Platform3DObject program, GC3Dint location,
m_internal->getUniformiv(program, location, value);
}
-long GraphicsContext3D::getUniformLocation(Platform3DObject program, const String& name)
+GC3Dint GraphicsContext3D::getUniformLocation(Platform3DObject program, const String& name)
{
ASSERT(program);
@@ -1620,7 +1602,7 @@ Extensions3D* GraphicsContext3D::getExtensions()
{
if (!m_internal->m_extensions)
m_internal->m_extensions = adoptPtr(new Extensions3DQt);
- return m_internal->m_extensions;
+ return m_internal->m_extensions.get();
}
bool GraphicsContext3D::getImageData(Image* image,
@@ -1637,13 +1619,13 @@ bool GraphicsContext3D::getImageData(Image* image,
if (!nativePixmap)
return false;
- AlphaOp neededAlphaOp = kAlphaDoNothing;
+ AlphaOp neededAlphaOp = AlphaDoNothing;
if (!premultiplyAlpha)
// FIXME: must fetch the image data before the premultiplication step
- neededAlphaOp = kAlphaDoUnmultiply;
+ neededAlphaOp = AlphaDoUnmultiply;
QImage nativeImage = nativePixmap->toImage().convertToFormat(QImage::Format_ARGB32);
outputVector.resize(nativeImage.byteCount());
- return packPixels(nativeImage.rgbSwapped().bits(), kSourceFormatRGBA8, image->width(), image->height(), 0,
+ return packPixels(nativeImage.rgbSwapped().bits(), SourceFormatRGBA8, image->width(), image->height(), 0,
format, type, neededAlphaOp, outputVector.data());
}
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index bf2826c..9742755 100644
--- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -555,8 +555,17 @@ void GraphicsContext::strokePath(const Path& path)
boundingRect.inflate(pen.miterLimit() + pen.widthF());
QPainter* shadowPainter = shadow->beginShadowLayer(this, boundingRect);
if (shadowPainter) {
- shadowPainter->setOpacity(static_cast<qreal>(m_data->shadow.m_color.alpha()) / 255);
- shadowPainter->strokePath(platformPath, pen);
+ if (m_state.strokeGradient) {
+ QBrush brush(*m_state.strokeGradient->platformGradient());
+ brush.setTransform(m_state.strokeGradient->gradientSpaceTransform());
+ QPen shadowPen(pen);
+ shadowPen.setBrush(brush);
+ shadowPainter->setOpacity(static_cast<qreal>(shadow->m_color.alpha()) / 255);
+ shadowPainter->strokePath(platformPath, shadowPen);
+ } else {
+ shadowPainter->setOpacity(static_cast<qreal>(m_data->shadow.m_color.alpha()) / 255);
+ shadowPainter->strokePath(platformPath, pen);
+ }
shadow->endShadowLayer(this);
}
} else {
@@ -769,6 +778,14 @@ ContextShadow* GraphicsContext::contextShadow()
return &m_data->shadow;
}
+void GraphicsContext::clip(const IntRect& rect)
+{
+ if (paintingDisabled())
+ return;
+
+ m_data->p()->setClipRect(rect, Qt::IntersectClip);
+}
+
void GraphicsContext::clip(const FloatRect& rect)
{
if (paintingDisabled())
@@ -846,13 +863,13 @@ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int
drawFocusRingForPath(m_data->p(), path, color, m_data->antiAliasingForRectsAndLines);
}
-void GraphicsContext::drawLineForText(const IntPoint& origin, int width, bool)
+void GraphicsContext::drawLineForText(const FloatPoint& origin, float width, bool)
{
if (paintingDisabled())
return;
- IntPoint startPoint = origin;
- IntPoint endPoint = origin + IntSize(width, 0);
+ FloatPoint startPoint = origin;
+ FloatPoint endPoint = origin + FloatSize(width, 0);
// If paintengine type is X11 to avoid artifacts
// like bug https://bugs.webkit.org/show_bug.cgi?id=42248
@@ -872,10 +889,11 @@ void GraphicsContext::drawLineForText(const IntPoint& origin, int width, bool)
}
#endif // defined(Q_WS_X11)
- drawLine(startPoint, endPoint);
+ // FIXME: Loss of precision here. Might consider rounding.
+ drawLine(IntPoint(startPoint.x(), startPoint.y()), IntPoint(endPoint.x(), endPoint.y()));
}
-void GraphicsContext::drawLineForTextChecking(const IntPoint&, int, TextCheckingLineStyle)
+void GraphicsContext::drawLineForTextChecking(const FloatPoint&, float, TextCheckingLineStyle)
{
if (paintingDisabled())
return;
@@ -1204,6 +1222,14 @@ void GraphicsContext::concatCTM(const AffineTransform& transform)
m_data->p()->setWorldTransform(transform, true);
}
+void GraphicsContext::setCTM(const AffineTransform& transform)
+{
+ if (paintingDisabled())
+ return;
+
+ m_data->p()->setWorldTransform(transform);
+}
+
void GraphicsContext::setURLForRect(const KURL&, const IntRect&)
{
notImplemented();
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
index 0d7aa45..f3cfc47 100644
--- a/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
@@ -54,7 +54,6 @@
#define GRAPHICS_LAYER_TILING_THRESHOLD 2000
#endif
-
#define QT_DEBUG_RECACHE 0
#define QT_DEBUG_CACHEDUMP 0
@@ -62,6 +61,8 @@
namespace WebCore {
+static const int gMinimumPixmapCacheLimit = 2048;
+
#ifndef QT_NO_GRAPHICSEFFECT
class MaskEffectQt : public QGraphicsEffect {
public:
@@ -207,6 +208,10 @@ public:
virtual Color tiledBackingStoreBackgroundColor() const;
#endif
+ static bool allowAcceleratedCompositingCache() { return QPixmapCache::cacheLimit() > gMinimumPixmapCacheLimit; }
+
+ void drawLayerContent(QPainter*, const QRect&);
+
public slots:
// We need to notify the client (ie. the layer compositor) when the animation actually starts.
void notifyAnimationStarted();
@@ -381,6 +386,15 @@ const GraphicsLayerQtImpl* GraphicsLayerQtImpl::rootLayer() const
return this;
}
+
+void GraphicsLayerQtImpl::drawLayerContent(QPainter* painter, const QRect& clipRect)
+{
+ painter->setClipRect(clipRect, Qt::IntersectClip);
+ painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
+ GraphicsContext gc(painter);
+ m_layer->paintGraphicsLayerContents(gc, clipRect);
+}
+
QPixmap GraphicsLayerQtImpl::recache(const QRegion& regionToUpdate)
{
if (!m_layer->drawsContent() || m_size.isEmpty() || !m_size.isValid())
@@ -630,12 +644,16 @@ void GraphicsLayerQtImpl::paint(QPainter* painter, const QStyleOptionGraphicsIte
switch (m_currentContent.contentType) {
case HTMLContentType:
if (m_state.drawsContent) {
- QPixmap backingStore;
- // We might need to recache, in case we try to paint and the cache was purged (e.g. if it was full).
- if (!QPixmapCache::find(m_backingStore.key, &backingStore) || backingStore.size() != m_size.toSize())
- backingStore = recache(QRegion(m_state.contentsRect));
- const QRectF bounds(0, 0, m_backingStore.size.width(), m_backingStore.size.height());
- painter->drawPixmap(0, 0, backingStore);
+ if (!allowAcceleratedCompositingCache())
+ drawLayerContent(painter, option->exposedRect.toRect());
+ else {
+ QPixmap backingStore;
+ // We might need to recache, in case we try to paint and the cache was purged (e.g. if it was full).
+ if (!QPixmapCache::find(m_backingStore.key, &backingStore) || backingStore.size() != m_size.toSize())
+ backingStore = recache(QRegion(m_state.contentsRect));
+ const QRectF bounds(0, 0, m_backingStore.size.width(), m_backingStore.size.height());
+ painter->drawPixmap(0, 0, backingStore);
+ }
}
break;
case PixmapContentType:
@@ -837,7 +855,7 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform
// Recache now: all the content is ready and we don't want to wait until the paint event.
// We only need to do this for HTML content, there's no point in caching directly composited
// content like images or solid rectangles.
- if (m_pendingContent.contentType == HTMLContentType)
+ if (m_pendingContent.contentType == HTMLContentType && allowAcceleratedCompositingCache())
recache(m_pendingContent.regionToUpdate);
#endif
update(m_pendingContent.regionToUpdate.boundingRect());
diff --git a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
index fab4db1..547dabc 100644
--- a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
+++ b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
@@ -126,7 +126,7 @@ MediaPlayerPrivateInterface* MediaPlayerPrivatePhonon::create(MediaPlayer* playe
void MediaPlayerPrivatePhonon::registerMediaEngine(MediaEngineRegistrar registrar)
{
if (isAvailable())
- registrar(create, getSupportedTypes, supportsType);
+ registrar(create, getSupportedTypes, supportsType, 0, 0, 0);
}
diff --git a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
index caf9c2d..001d45b 100644
--- a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
@@ -24,7 +24,6 @@
#include "GraphicsContext.h"
#include "HTMLMediaElement.h"
#include "HTMLVideoElement.h"
-#include "QtNAMThreadSafeProxy.h"
#include "NetworkingContext.h"
#include "NotImplemented.h"
#include "RenderVideo.h"
@@ -66,7 +65,7 @@ MediaPlayerPrivateInterface* MediaPlayerPrivateQt::create(MediaPlayer* player)
void MediaPlayerPrivateQt::registerMediaEngine(MediaEngineRegistrar registrar)
{
- registrar(create, getSupportedTypes, supportsType);
+ registrar(create, getSupportedTypes, supportsType, 0, 0, 0);
}
void MediaPlayerPrivateQt::getSupportedTypes(HashSet<String> &supported)
@@ -106,6 +105,7 @@ MediaPlayerPrivateQt::MediaPlayerPrivateQt(MediaPlayer* player)
, m_composited(false)
, m_queuedSeek(-1)
, m_preload(MediaPlayer::Auto)
+ , m_suppressNextPlaybackChanged(false)
{
m_mediaPlayer->setVideoOutput(m_videoItem);
m_videoScene->addItem(m_videoItem);
@@ -187,7 +187,8 @@ void MediaPlayerPrivateQt::commitLoad(const String& url)
m_webCorePlayer->readyStateChanged();
}
- const QUrl rUrl = QUrl(QString(url));
+ KURL kUrl(ParsedURLString, url);
+ const QUrl rUrl = kUrl;
const QString scheme = rUrl.scheme().toLower();
// Grab the client media element
@@ -209,8 +210,8 @@ void MediaPlayerPrivateQt::commitLoad(const String& url)
if (manager) {
// Set the cookies
- QtNAMThreadSafeProxy managerProxy(manager);
- QList<QNetworkCookie> cookies = managerProxy.cookiesForUrl(rUrl);
+ QNetworkCookieJar* jar = manager->cookieJar();
+ QList<QNetworkCookie> cookies = jar->cookiesForUrl(rUrl);
// Don't set the header if there are no cookies.
// This prevents a warning from being emitted.
@@ -239,6 +240,9 @@ void MediaPlayerPrivateQt::commitLoad(const String& url)
m_mediaPlayer->setMuted(element->muted());
m_mediaPlayer->setVolume(static_cast<int>(element->volume() * 100.0));
+ // Don't send PlaybackChanged notification for pre-roll.
+ m_suppressNextPlaybackChanged = true;
+
// Setting a media source will start loading the media, but we need
// to pre-roll as well to get video size-hints and buffer-status
if (element->paused())
@@ -445,6 +449,11 @@ void MediaPlayerPrivateQt::stateChanged(QMediaPlayer::State state)
m_mediaPlayer->setPosition(m_queuedSeek);
m_queuedSeek = -1;
}
+
+ if (!m_suppressNextPlaybackChanged)
+ m_webCorePlayer->playbackStateChanged();
+ else
+ m_suppressNextPlaybackChanged = false;
}
void MediaPlayerPrivateQt::nativeSizeChanged(const QSizeF& size)
diff --git a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
index e4133db..81cdd79 100644
--- a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
+++ b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
@@ -157,6 +157,7 @@ private:
MediaPlayer::Preload m_preload;
bool m_delayingLoad;
String m_mediaUrl;
+ bool m_suppressNextPlaybackChanged;
};
}
diff --git a/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp b/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp
index 9e43558..5d0b302 100644
--- a/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp
@@ -61,7 +61,6 @@ void SimpleFontData::platformGlyphInit()
if (!m_platformData.size())
return;
m_spaceGlyph = 0;
- m_adjustedSpaceWidth = m_spaceWidth;
determinePitch();
m_missingGlyphData.fontData = this;
m_missingGlyphData.glyph = 0;