summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics')
-rw-r--r--Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp4
-rw-r--r--Source/WebCore/platform/graphics/qt/FontCacheQt.cpp1
-rw-r--r--Source/WebCore/platform/graphics/qt/FontCascadeQt.cpp9
-rw-r--r--Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h1
-rw-r--r--Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp1
-rw-r--r--Source/WebCore/platform/graphics/qt/FontPlatformData.h1
-rw-r--r--Source/WebCore/platform/graphics/qt/GradientQt.cpp1
-rw-r--r--Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp3
-rw-r--r--Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp2
-rw-r--r--Source/WebCore/platform/graphics/qt/IconQt.cpp1
-rw-r--r--Source/WebCore/platform/graphics/qt/ImageBufferDataQt.cpp1
-rw-r--r--Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp2
-rw-r--r--Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp3
-rw-r--r--Source/WebCore/platform/graphics/qt/PathQt.cpp1
-rw-r--r--Source/WebCore/platform/graphics/qt/PatternQt.cpp3
-rw-r--r--Source/WebCore/platform/graphics/qt/StillImageQt.cpp1
-rw-r--r--Source/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp2
-rw-r--r--Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp76
-rw-r--r--Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h7
19 files changed, 73 insertions, 47 deletions
diff --git a/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp b/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp
index 9b0fe49fb..6340107aa 100644
--- a/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp
+++ b/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp
@@ -241,7 +241,7 @@ ALWAYS_INLINE void setDestinationPixels(Uint8ClampedArray* image, int& pixel, fl
image->set(pixel++, maxAlpha);
}
-#if defined(_MSC_VER) && (_MSC_VER >= 1700)
+#if COMPILER(MSVC)
// Incorrectly diagnosing overwrite of stack in |totals| due to |preserveAlphaValues|.
#pragma warning(push)
#pragma warning(disable: 4789)
@@ -385,7 +385,7 @@ void FEConvolveMatrix::fastSetOuterPixels(PaintingData& paintingData, int x1, in
}
}
-#if defined(_MSC_VER) && (_MSC_VER >= 1700)
+#if COMPILER(MSVC)
#pragma warning(pop) // Disable of 4789
#endif
diff --git a/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp b/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp
index 1222196dd..7be647748 100644
--- a/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp
@@ -29,7 +29,6 @@
#include "FontDescription.h"
#include "FontPlatformData.h"
#include <utility>
-#include <wtf/ListHashSet.h>
#include <wtf/StdLibExtras.h>
#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
diff --git a/Source/WebCore/platform/graphics/qt/FontCascadeQt.cpp b/Source/WebCore/platform/graphics/qt/FontCascadeQt.cpp
index 1ead333ce..47bcd8df6 100644
--- a/Source/WebCore/platform/graphics/qt/FontCascadeQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/FontCascadeQt.cpp
@@ -24,9 +24,7 @@
#include "Font.h"
-#include "AffineTransform.h"
#include "FontDescription.h"
-#include "FontSelector.h"
#include "GlyphBuffer.h"
#include "Gradient.h"
#include "GraphicsContext.h"
@@ -264,8 +262,13 @@ void FontCascade::initFormatForTextLayout(QTextLayout* layout, const TextRun& ru
if (isSmallCaps())
range.format.setFontCapitalization(QFont::SmallCaps);
- if (range.format.propertyCount() && range.length)
+ if (range.format.propertyCount() && range.length) {
+#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
+ layout->setFormats(QVector<QTextLayout::FormatRange>() << range);
+#else
layout->setAdditionalFormats(QList<QTextLayout::FormatRange>() << range);
+#endif
+ }
}
bool FontCascade::canReturnFallbackFontsForComplexText()
diff --git a/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h
index 31d169f62..c2d0c9fa2 100644
--- a/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h
+++ b/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h
@@ -22,7 +22,6 @@
#ifndef FontCustomPlatformData_h
#define FontCustomPlatformData_h
-#include "TextFlags.h"
#include <QRawFont>
#include <wtf/FastMalloc.h>
#include <wtf/Forward.h>
diff --git a/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp b/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
index bc65c0511..908d881f1 100644
--- a/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
@@ -24,7 +24,6 @@
#include "FontPlatformData.h"
#include "SharedBuffer.h"
-#include "WOFFFileFormat.h"
#include <QStringList>
namespace WebCore {
diff --git a/Source/WebCore/platform/graphics/qt/FontPlatformData.h b/Source/WebCore/platform/graphics/qt/FontPlatformData.h
index c8375ebcd..8c1327e13 100644
--- a/Source/WebCore/platform/graphics/qt/FontPlatformData.h
+++ b/Source/WebCore/platform/graphics/qt/FontPlatformData.h
@@ -29,7 +29,6 @@
#include <QFont>
#include <QHash>
#include <QRawFont>
-#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
namespace WebCore {
diff --git a/Source/WebCore/platform/graphics/qt/GradientQt.cpp b/Source/WebCore/platform/graphics/qt/GradientQt.cpp
index 72bb00938..3412cfadd 100644
--- a/Source/WebCore/platform/graphics/qt/GradientQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/GradientQt.cpp
@@ -27,7 +27,6 @@
#include "config.h"
#include "Gradient.h"
-#include "CSSParser.h"
#include "GraphicsContext.h"
#include <QGradient>
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
index 7f2f07b60..fe63ff7bb 100644
--- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
@@ -24,16 +24,13 @@
#include "GraphicsSurface.h"
#include "HostWindow.h"
#include "ImageBuffer.h"
-#include "ImageData.h"
#include "NativeImageQt.h"
-#include "NotImplemented.h"
#include "QWebPageClient.h"
#include "SharedBuffer.h"
#include "TextureMapperPlatformLayer.h"
#include <QOffscreenSurface>
#include <private/qopenglextensions_p.h>
#include <qpa/qplatformpixmap.h>
-#include <wtf/text/CString.h>
#if USE(TEXTURE_MAPPER_GL)
#include <texmap/TextureMapperGL.h>
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 59519398e..260081946 100644
--- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -47,10 +47,8 @@
#include "Color.h"
#include "DisplayListRecorder.h"
#include "FloatConversion.h"
-#include "Font.h"
#include "ImageBuffer.h"
#include "ImageBufferDataQt.h"
-#include "NotImplemented.h"
#include "Path.h"
#include "Pattern.h"
#include "ShadowBlur.h"
diff --git a/Source/WebCore/platform/graphics/qt/IconQt.cpp b/Source/WebCore/platform/graphics/qt/IconQt.cpp
index 24f13067d..9bd3d5323 100644
--- a/Source/WebCore/platform/graphics/qt/IconQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/IconQt.cpp
@@ -23,7 +23,6 @@
#include "GraphicsContext.h"
#include "IntRect.h"
-#include "NotImplemented.h"
#include <QMimeDatabase>
#include <wtf/text/WTFString.h>
diff --git a/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.cpp b/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.cpp
index e76572134..9037ae6ac 100644
--- a/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.cpp
@@ -32,7 +32,6 @@
#include "GraphicsContext.h"
#include "GraphicsSurface.h"
-#include "ImageData.h"
#include "IntRect.h"
#include "StillImageQt.h"
diff --git a/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp
index 380d22bb5..2295362aa 100644
--- a/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp
@@ -31,14 +31,12 @@
#include "ImageBuffer.h"
#include "GraphicsContext.h"
-#include "ImageData.h"
#include "IntRect.h"
#include "MIMETypeRegistry.h"
#include "StillImageQt.h"
#include "TransparencyLayer.h"
#include <runtime/JSCInlines.h>
#include <runtime/TypedArrayInlines.h>
-#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
#include <QBuffer>
diff --git a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
index 95548dff3..9091fdc72 100644
--- a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
@@ -25,13 +25,10 @@
#include "GraphicsContext.h"
#include "GraphicsLayer.h"
#include "HTMLMediaElement.h"
-#include "HTMLVideoElement.h"
#include "Logging.h"
#include "NetworkingContext.h"
#include "NotImplemented.h"
#include "RenderVideo.h"
-#include "TimeRanges.h"
-#include "Widget.h"
#include <QMediaPlayerControl>
#include <QMediaService>
diff --git a/Source/WebCore/platform/graphics/qt/PathQt.cpp b/Source/WebCore/platform/graphics/qt/PathQt.cpp
index ecafcdb0e..f3d7481ea 100644
--- a/Source/WebCore/platform/graphics/qt/PathQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/PathQt.cpp
@@ -34,7 +34,6 @@
#include "AffineTransform.h"
#include "FloatRect.h"
#include "GraphicsContext.h"
-#include "ImageBuffer.h"
#include "NativeImageQt.h"
#include "StrokeStyleApplier.h"
#include <QPainterPath>
diff --git a/Source/WebCore/platform/graphics/qt/PatternQt.cpp b/Source/WebCore/platform/graphics/qt/PatternQt.cpp
index 7aae62599..8795f3547 100644
--- a/Source/WebCore/platform/graphics/qt/PatternQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/PatternQt.cpp
@@ -26,8 +26,7 @@
#include "config.h"
#include "Pattern.h"
-#include "AffineTransform.h"
-#include "GraphicsContext.h"
+#include "Image.h"
namespace WebCore {
diff --git a/Source/WebCore/platform/graphics/qt/StillImageQt.cpp b/Source/WebCore/platform/graphics/qt/StillImageQt.cpp
index 5569474f0..a2fc59e9f 100644
--- a/Source/WebCore/platform/graphics/qt/StillImageQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/StillImageQt.cpp
@@ -29,7 +29,6 @@
#include "StillImageQt.h"
#include "GraphicsContext.h"
-#include "IntSize.h"
#include "ShadowBlur.h"
#include <QPainter>
diff --git a/Source/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp b/Source/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp
index 73a0e414f..bf3e8c6c5 100644
--- a/Source/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp
@@ -27,8 +27,6 @@
#include "AffineTransform.h"
#include "TransformationMatrix.h"
-#include "FloatRect.h"
-#include "IntRect.h"
namespace WebCore {
diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
index b6bdf60ca..0610c85b6 100644
--- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
+++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
@@ -47,6 +47,7 @@
#include <wtf/MainThread.h>
#include <wtf/NeverDestroyed.h>
+#include <wtf/text/win/WCharStringExtras.h>
SOFT_LINK_LIBRARY(Mf);
SOFT_LINK_OPTIONAL(Mf, MFCreateSourceResolver, HRESULT, STDAPICALLTYPE, (IMFSourceResolver**));
@@ -98,6 +99,7 @@ MediaPlayerPrivateMediaFoundation::MediaPlayerPrivateMediaFoundation(MediaPlayer
, m_hasVideo(false)
, m_preparingToPlay(false)
, m_hwndVideo(nullptr)
+ , m_volume(1.0)
, m_networkState(MediaPlayer::Empty)
, m_readyState(MediaPlayer::HaveNothing)
, m_weakPtrFactory(this)
@@ -147,7 +149,7 @@ static const HashSet<String, ASCIICaseInsensitiveHash>& mimeTypeCache()
if (SUCCEEDED(hr)) {
CALPWSTR mimeTypeArray = propVarMimeTypeArray.calpwstr;
for (unsigned i = 0; i < mimeTypeArray.cElems; i++)
- cachedTypes.get().add(mimeTypeArray.pElems[i]);
+ cachedTypes.get().add(nullTerminatedWCharToString(mimeTypeArray.pElems[i]));
}
PropVariantClear(&propVarMimeTypeArray);
@@ -173,6 +175,11 @@ MediaPlayer::SupportsType MediaPlayerPrivateMediaFoundation::supportsType(const
void MediaPlayerPrivateMediaFoundation::load(const String& url)
{
+ {
+ LockHolder locker(m_cachedNaturalSizeLock);
+ m_cachedNaturalSize = FloatSize();
+ }
+
startCreateMediaSource(url);
m_networkState = MediaPlayer::Loading;
@@ -215,9 +222,10 @@ bool MediaPlayerPrivateMediaFoundation::supportsFullscreen() const
return true;
}
-FloatSize MediaPlayerPrivateMediaFoundation::naturalSize() const
+FloatSize MediaPlayerPrivateMediaFoundation::naturalSize() const
{
- return m_size;
+ LockHolder locker(m_cachedNaturalSizeLock);
+ return m_cachedNaturalSize;
}
bool MediaPlayerPrivateMediaFoundation::hasVideo() const
@@ -299,16 +307,27 @@ bool MediaPlayerPrivateMediaFoundation::paused() const
return m_paused;
}
-void MediaPlayerPrivateMediaFoundation::setVolume(float volume)
+bool MediaPlayerPrivateMediaFoundation::setAllChannelVolumes(float volume)
{
if (!MFGetServicePtr())
- return;
+ return false;
- COMPtr<IMFSimpleAudioVolume> audioVolume;
- if (SUCCEEDED(MFGetServicePtr()(m_mediaSession.get(), MR_POLICY_VOLUME_SERVICE, __uuidof(IMFSimpleAudioVolume), (void **)&audioVolume))) {
- HRESULT hr = audioVolume->SetMasterVolume(volume);
- ASSERT(SUCCEEDED(hr));
- }
+ COMPtr<IMFAudioStreamVolume> audioVolume;
+ if (!SUCCEEDED(MFGetServicePtr()(m_mediaSession.get(), MR_STREAM_VOLUME_SERVICE, __uuidof(IMFAudioStreamVolume), (void **)&audioVolume)))
+ return false;
+
+ UINT32 channelsCount;
+ HRESULT hr = audioVolume->GetChannelCount(&channelsCount);
+ ASSERT(SUCCEEDED(hr));
+
+ Vector<float> volumes(channelsCount, volume);
+ return SUCCEEDED(audioVolume->SetAllVolumes(channelsCount, volumes.data()));
+}
+
+void MediaPlayerPrivateMediaFoundation::setVolume(float volume)
+{
+ if (setAllChannelVolumes(volume))
+ m_volume = volume;
}
bool MediaPlayerPrivateMediaFoundation::supportsMuting() const
@@ -318,14 +337,7 @@ bool MediaPlayerPrivateMediaFoundation::supportsMuting() const
void MediaPlayerPrivateMediaFoundation::setMuted(bool muted)
{
- if (!MFGetServicePtr())
- return;
-
- COMPtr<IMFSimpleAudioVolume> audioVolume;
- if (SUCCEEDED(MFGetServicePtr()(m_mediaSession.get(), MR_POLICY_VOLUME_SERVICE, __uuidof(IMFSimpleAudioVolume), (void **)&audioVolume))) {
- HRESULT hr = audioVolume->SetMute(muted ? TRUE : FALSE);
- ASSERT(SUCCEEDED(hr));
- }
+ setAllChannelVolumes(muted ? 0.0 : m_volume);
}
MediaPlayer::NetworkState MediaPlayerPrivateMediaFoundation::networkState() const
@@ -465,7 +477,7 @@ bool MediaPlayerPrivateMediaFoundation::startCreateMediaSource(const String& url
return false;
COMPtr<IUnknown> cancelCookie;
- Vector<UChar> urlSource = url.charactersWithNullTermination();
+ Vector<wchar_t> urlSource = stringToNullTerminatedWChar(url);
AsyncCallback* callback = new AsyncCallback(this, false);
@@ -749,6 +761,12 @@ void MediaPlayerPrivateMediaFoundation::notifyDeleted()
(*it)->onMediaPlayerDeleted();
}
+void MediaPlayerPrivateMediaFoundation::setNaturalSize(const FloatSize& size)
+{
+ LockHolder locker(m_cachedNaturalSizeLock);
+ m_cachedNaturalSize = size;
+}
+
bool MediaPlayerPrivateMediaFoundation::createOutputNode(COMPtr<IMFStreamDescriptor> sourceSD, COMPtr<IMFTopologyNode>& node)
{
if (!MFCreateTopologyNodePtr() || !MFCreateAudioRendererActivatePtr() || !MFCreateVideoRendererActivatePtr())
@@ -1554,6 +1572,22 @@ static bool areMediaTypesEqual(IMFMediaType* type1, IMFMediaType* type2)
return S_OK == type1->IsEqual(type2, &flags);
}
+static FloatSize calculateNaturalSize(IMFMediaType* mediaType)
+{
+ UINT32 width = 0, height = 0;
+ HRESULT hr = MFGetAttributeSize(mediaType, MF_MT_FRAME_SIZE, &width, &height);
+ if (FAILED(hr) || !height)
+ return FloatSize();
+
+ UINT32 pixelAspectRatioNumerator = 0;
+ UINT32 pixelAspectRatioDenominator = 0;
+ hr = MFGetAttributeRatio(mediaType, MF_MT_PIXEL_ASPECT_RATIO, &pixelAspectRatioNumerator, &pixelAspectRatioDenominator);
+ if (SUCCEEDED(hr) && pixelAspectRatioNumerator && pixelAspectRatioDenominator)
+ return FloatSize(float(width) * pixelAspectRatioNumerator / pixelAspectRatioDenominator, height);
+
+ return FloatSize();
+}
+
HRESULT MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::setMediaType(IMFMediaType* mediaType)
{
if (!mediaType) {
@@ -1611,6 +1645,10 @@ HRESULT MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::setMediaType(IM
m_scheduler.setFrameRate(defaultFrameRate);
}
+ // Update natural size
+ if (m_mediaPlayer)
+ m_mediaPlayer->setNaturalSize(calculateNaturalSize(mediaType));
+
ASSERT(mediaType);
m_mediaType = mediaType;
diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h
index 2fdce58ee..c3303cf7b 100644
--- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h
+++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h
@@ -112,6 +112,7 @@ private:
bool m_hasAudio;
bool m_hasVideo;
bool m_preparingToPlay;
+ float m_volume;
HWND m_hwndVideo;
MediaPlayer::NetworkState m_networkState;
MediaPlayer::ReadyState m_readyState;
@@ -121,6 +122,9 @@ private:
HashSet<MediaPlayerListener*> m_listeners;
Lock m_mutexListeners;
+ FloatSize m_cachedNaturalSize;
+ mutable Lock m_cachedNaturalSizeLock;
+
WeakPtrFactory<MediaPlayerPrivateMediaFoundation> m_weakPtrFactory;
COMPtr<IMFMediaSession> m_mediaSession;
COMPtr<IMFSourceResolver> m_sourceResolver;
@@ -158,10 +162,13 @@ private:
void addListener(MediaPlayerListener*);
void removeListener(MediaPlayerListener*);
+ void setNaturalSize(const FloatSize&);
void notifyDeleted();
static LRESULT CALLBACK VideoViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+ bool setAllChannelVolumes(float);
+
class MediaPlayerListener {
public:
MediaPlayerListener() { }