diff options
Diffstat (limited to 'WebCore/platform/graphics/win')
19 files changed, 382 insertions, 345 deletions
diff --git a/WebCore/platform/graphics/win/ColorSafari.cpp b/WebCore/platform/graphics/win/ColorSafari.cpp deleted file mode 100644 index 25b6b89..0000000 --- a/WebCore/platform/graphics/win/ColorSafari.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. 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. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 "Color.h" - -#include <CoreGraphics/CGColor.h> -#include <SafariTheme/SafariTheme.h> -#include <wtf/Assertions.h> -#include <wtf/RetainPtr.h> - -using namespace SafariTheme; - -namespace WebCore { - -typedef CGColorRef (APIENTRY*stCopyThemeColorPtr)(unsigned, SafariTheme::ThemeControlState); -static const unsigned stFocusRingColorID = 4; - -static const unsigned aquaFocusRingColor = 0xFF7DADD9; - -static RGBA32 makeRGBAFromCGColor(CGColorRef c) -{ - const CGFloat* components = CGColorGetComponents(c); - return makeRGBA(255 * components[0], 255 * components[1], 255 * components[2], 255 * components[3]); -} - -Color focusRingColor() -{ - static Color focusRingColor; - focusRingColor.isValid(); - - if (!focusRingColor.isValid()) { - if (HMODULE module = LoadLibrary(SAFARITHEMEDLL)) - if (stCopyThemeColorPtr stCopyThemeColor = (stCopyThemeColorPtr)GetProcAddress(module, "STCopyThemeColor")) { - RetainPtr<CGColorRef> c(AdoptCF, stCopyThemeColor(stFocusRingColorID, SafariTheme::ActiveState)); - focusRingColor = makeRGBAFromCGColor(c.get()); - } - if (!focusRingColor.isValid()) - focusRingColor = aquaFocusRingColor; - } - - return focusRingColor; -} - -} // namespace WebCore diff --git a/WebCore/platform/graphics/win/FontPlatformData.h b/WebCore/platform/graphics/win/FontPlatformData.h index 09a8b55..0660d90 100644 --- a/WebCore/platform/graphics/win/FontPlatformData.h +++ b/WebCore/platform/graphics/win/FontPlatformData.h @@ -39,6 +39,7 @@ typedef struct CGFont* CGFontRef; namespace WebCore { class FontDescription; +class String; class FontPlatformData { public: @@ -64,6 +65,9 @@ public: FontPlatformData(HFONT, CGFontRef, float size, bool bold, bool oblique, bool useGDI); #elif PLATFORM(CAIRO) FontPlatformData(cairo_font_face_t*, float size, bool bold, bool oblique); + FontPlatformData(const FontPlatformData&); + + FontPlatformData& operator=(const FontPlatformData&); #endif ~FontPlatformData(); @@ -104,6 +108,10 @@ public: m_useGDI == other.m_useGDI; } +#ifndef NDEBUG + String description() const; +#endif + private: class RefCountedHFONT : public RefCounted<RefCountedHFONT> { public: diff --git a/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp b/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp index 59f7e5c..a92e367 100644 --- a/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp +++ b/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp @@ -137,4 +137,8 @@ FontPlatformData::FontPlatformData(HFONT hfont, CGFontRef font, float size, bool { } +FontPlatformData::~FontPlatformData() +{ +} + } diff --git a/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp b/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp index 438d0a9..b56a71c 100644 --- a/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp +++ b/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp @@ -41,6 +41,7 @@ namespace WebCore { void FontPlatformData::platformDataInit(HFONT font, float size, HDC hdc, WCHAR* faceName) { m_fontFace = cairo_win32_font_face_create_for_hfont(font); + cairo_matrix_t sizeMatrix, ctm; cairo_matrix_init_identity(&ctm); cairo_matrix_init_scale(&sizeMatrix, size, size); @@ -79,6 +80,22 @@ FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, float size, bool cairo_font_options_destroy(options); } +FontPlatformData::FontPlatformData(const FontPlatformData& source) + : m_font(source.m_font) + , m_size(source.m_size) + , m_fontFace(0) + , m_scaledFont(0) + , m_syntheticBold(source.m_syntheticBold) + , m_syntheticOblique(source.m_syntheticOblique) + , m_useGDI(source.m_useGDI) +{ + if (source.m_fontFace) + m_fontFace = cairo_font_face_reference(source.m_fontFace); + + if (source.m_scaledFont) + m_scaledFont = cairo_scaled_font_reference(source.m_scaledFont); +} + void FontPlatformData::setFont(cairo_t* cr) const { ASSERT(m_scaledFont); @@ -86,4 +103,37 @@ void FontPlatformData::setFont(cairo_t* cr) const cairo_set_scaled_font(cr, m_scaledFont); } +FontPlatformData::~FontPlatformData() +{ + cairo_scaled_font_destroy(m_scaledFont); + cairo_font_face_destroy(m_fontFace); +} + +FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other) +{ + // Check for self-assignment. + if (this == &other) + return *this; + + m_font = other.m_font; + m_size = other.m_size; + m_syntheticBold = other.m_syntheticBold; + m_syntheticOblique = other.m_syntheticOblique; + m_useGDI = other.m_useGDI; + + if (other.m_fontFace) + cairo_font_face_reference(other.m_fontFace); + if (m_fontFace) + cairo_font_face_destroy(m_fontFace); + m_fontFace = other.m_fontFace; + + if (other.m_scaledFont) + cairo_scaled_font_reference(other.m_scaledFont); + if (m_scaledFont) + cairo_scaled_font_destroy(m_scaledFont); + m_scaledFont = other.m_scaledFont; + + return *this; +} + } diff --git a/WebCore/platform/graphics/win/FontPlatformDataWin.cpp b/WebCore/platform/graphics/win/FontPlatformDataWin.cpp index 4b4df5a..cc02c4c 100644 --- a/WebCore/platform/graphics/win/FontPlatformDataWin.cpp +++ b/WebCore/platform/graphics/win/FontPlatformDataWin.cpp @@ -85,8 +85,11 @@ FontPlatformData::FontPlatformData(float size, bool bold, bool oblique) { } -FontPlatformData::~FontPlatformData() +#ifndef NDEBUG +String FontPlatformData::description() const { + return String(); } +#endif } diff --git a/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp b/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp index 917631b..9eaf54b 100644 --- a/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp +++ b/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp @@ -77,64 +77,6 @@ GraphicsContext::GraphicsContext(HDC hdc, bool hasAlpha) // FIXME: Is it possible to merge getWindowsContext and createWindowsBitmap into a single API // suitable for all clients? -HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap) -{ - // FIXME: Should a bitmap be created also when a shadow is set? - if (mayCreateBitmap && inTransparencyLayer()) { - if (dstRect.isEmpty()) - return 0; - - // Create a bitmap DC in which to draw. - BITMAPINFO bitmapInfo; - bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bitmapInfo.bmiHeader.biWidth = dstRect.width(); - bitmapInfo.bmiHeader.biHeight = dstRect.height(); - bitmapInfo.bmiHeader.biPlanes = 1; - bitmapInfo.bmiHeader.biBitCount = 32; - bitmapInfo.bmiHeader.biCompression = BI_RGB; - bitmapInfo.bmiHeader.biSizeImage = 0; - bitmapInfo.bmiHeader.biXPelsPerMeter = 0; - bitmapInfo.bmiHeader.biYPelsPerMeter = 0; - bitmapInfo.bmiHeader.biClrUsed = 0; - bitmapInfo.bmiHeader.biClrImportant = 0; - - void* pixels = 0; - HBITMAP bitmap = ::CreateDIBSection(NULL, &bitmapInfo, DIB_RGB_COLORS, &pixels, 0, 0); - if (!bitmap) - return 0; - - HDC bitmapDC = ::CreateCompatibleDC(m_data->m_hdc); - ::SelectObject(bitmapDC, bitmap); - - // Fill our buffer with clear if we're going to alpha blend. - if (supportAlphaBlend) { - BITMAP bmpInfo; - GetObject(bitmap, sizeof(bmpInfo), &bmpInfo); - int bufferSize = bmpInfo.bmWidthBytes * bmpInfo.bmHeight; - memset(bmpInfo.bmBits, 0, bufferSize); - } - - // Make sure we can do world transforms. - SetGraphicsMode(bitmapDC, GM_ADVANCED); - - // Apply a translation to our context so that the drawing done will be at (0,0) of the bitmap. - XFORM xform; - xform.eM11 = 1.0f; - xform.eM12 = 0.0f; - xform.eM21 = 0.0f; - xform.eM22 = 1.0f; - xform.eDx = -dstRect.x(); - xform.eDy = -dstRect.y(); - ::SetWorldTransform(bitmapDC, &xform); - - return bitmapDC; - } - - CGContextFlush(platformContext()); - m_data->save(); - return m_data->m_hdc; -} - void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap) { if (mayCreateBitmap && hdc && inTransparencyLayer()) { @@ -170,52 +112,6 @@ void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, boo m_data->restore(); } -GraphicsContext::WindowsBitmap::WindowsBitmap(HDC hdc, IntSize size) - : m_hdc(0) - , m_size(size) -{ - BITMAPINFO bitmapInfo; - bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bitmapInfo.bmiHeader.biWidth = m_size.width(); - bitmapInfo.bmiHeader.biHeight = m_size.height(); - bitmapInfo.bmiHeader.biPlanes = 1; - bitmapInfo.bmiHeader.biBitCount = 32; - bitmapInfo.bmiHeader.biCompression = BI_RGB; - bitmapInfo.bmiHeader.biSizeImage = 0; - bitmapInfo.bmiHeader.biXPelsPerMeter = 0; - bitmapInfo.bmiHeader.biYPelsPerMeter = 0; - bitmapInfo.bmiHeader.biClrUsed = 0; - bitmapInfo.bmiHeader.biClrImportant = 0; - - m_bitmap = CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, reinterpret_cast<void**>(&m_bitmapBuffer), 0, 0); - if (!m_bitmap) - return; - - m_hdc = CreateCompatibleDC(hdc); - SelectObject(m_hdc, m_bitmap); - - BITMAP bmpInfo; - GetObject(m_bitmap, sizeof(bmpInfo), &bmpInfo); - m_bytesPerRow = bmpInfo.bmWidthBytes; - m_bitmapBufferLength = bmpInfo.bmWidthBytes * bmpInfo.bmHeight; - - SetGraphicsMode(m_hdc, GM_ADVANCED); -} - -GraphicsContext::WindowsBitmap::~WindowsBitmap() -{ - if (!m_bitmap) - return; - - DeleteDC(m_hdc); - DeleteObject(m_bitmap); -} - -GraphicsContext::WindowsBitmap* GraphicsContext::createWindowsBitmap(IntSize size) -{ - return new WindowsBitmap(m_data->m_hdc, size); -} - void GraphicsContext::drawWindowsBitmap(WindowsBitmap* image, const IntPoint& point) { RetainPtr<CGColorSpaceRef> deviceRGB(AdoptCF, CGColorSpaceCreateDeviceRGB()); @@ -228,23 +124,6 @@ void GraphicsContext::drawWindowsBitmap(WindowsBitmap* image, const IntPoint& po CGContextDrawImage(m_data->m_cgContext, CGRectMake(point.x(), point.y(), image->size().width(), image->size().height()), cgImage.get()); } -void GraphicsContextPlatformPrivate::concatCTM(const TransformationMatrix& transform) -{ - if (!m_hdc) - return; - - CGAffineTransform mat = transform; - XFORM xform; - xform.eM11 = mat.a; - xform.eM12 = mat.b; - xform.eM21 = mat.c; - xform.eM22 = mat.d; - xform.eDx = mat.tx; - xform.eDy = mat.ty; - - ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); -} - void GraphicsContext::drawFocusRing(const Color& color) { if (paintingDisabled()) @@ -362,4 +241,9 @@ void GraphicsContext::drawLineForMisspellingOrBadGrammar(const IntPoint& point, CGContextRestoreGState(context); } +void GraphicsContextPlatformPrivate::flush() +{ + CGContextFlush(m_cgContext); +} + } diff --git a/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp b/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp index ca3cb5d..2489e02 100644 --- a/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp +++ b/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp @@ -59,32 +59,6 @@ static cairo_t* createCairoContextWithHDC(HDC hdc, bool hasAlpha) return context; } -static BITMAPINFO bitmapInfoForSize(const IntSize& size) -{ - BITMAPINFO bitmapInfo; - bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bitmapInfo.bmiHeader.biWidth = size.width(); - bitmapInfo.bmiHeader.biHeight = size.height(); - bitmapInfo.bmiHeader.biPlanes = 1; - bitmapInfo.bmiHeader.biBitCount = 32; - bitmapInfo.bmiHeader.biCompression = BI_RGB; - bitmapInfo.bmiHeader.biSizeImage = 0; - bitmapInfo.bmiHeader.biXPelsPerMeter = 0; - bitmapInfo.bmiHeader.biYPelsPerMeter = 0; - bitmapInfo.bmiHeader.biClrUsed = 0; - bitmapInfo.bmiHeader.biClrImportant = 0; - - return bitmapInfo; -} - -static void fillWithClearColor(HBITMAP bitmap) -{ - BITMAP bmpInfo; - GetObject(bitmap, sizeof(bmpInfo), &bmpInfo); - int bufferSize = bmpInfo.bmWidthBytes * bmpInfo.bmHeight; - memset(bmpInfo.bmBits, 0, bufferSize); -} - GraphicsContext::GraphicsContext(HDC dc, bool hasAlpha) : m_common(createGraphicsContextPrivate()) , m_data(new GraphicsContextPlatformPrivate) @@ -105,53 +79,6 @@ GraphicsContext::GraphicsContext(HDC dc, bool hasAlpha) } } -HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap) -{ - // FIXME: Should a bitmap be created also when a shadow is set? - if (mayCreateBitmap && inTransparencyLayer()) { - if (dstRect.isEmpty()) - return 0; - - // Create a bitmap DC in which to draw. - BITMAPINFO bitmapInfo = bitmapInfoForSize(dstRect.size()); - - void* pixels = 0; - HBITMAP bitmap = ::CreateDIBSection(NULL, &bitmapInfo, DIB_RGB_COLORS, &pixels, 0, 0); - if (!bitmap) - return 0; - - HDC bitmapDC = ::CreateCompatibleDC(m_data->m_hdc); - ::SelectObject(bitmapDC, bitmap); - - // Fill our buffer with clear if we're going to alpha blend. - if (supportAlphaBlend) - fillWithClearColor(bitmap); - - // Make sure we can do world transforms. - SetGraphicsMode(bitmapDC, GM_ADVANCED); - - // Apply a translation to our context so that the drawing done will be at (0,0) of the bitmap. - XFORM xform; - xform.eM11 = 1.0f; - xform.eM12 = 0.0f; - xform.eM21 = 0.0f; - xform.eM22 = 1.0f; - xform.eDx = -dstRect.x(); - xform.eDy = -dstRect.y(); - ::SetWorldTransform(bitmapDC, &xform); - - return bitmapDC; - } - - cairo_surface_t* surface = cairo_win32_surface_create(m_data->m_hdc); - cairo_surface_flush(surface); - cairo_surface_destroy(surface); - - m_data->save(); - - return m_data->m_hdc; -} - void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap) { if (!mayCreateBitmap || !hdc || !inTransparencyLayer()) { @@ -194,27 +121,22 @@ void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, boo ::DeleteObject(bitmap); } -void GraphicsContextPlatformPrivate::concatCTM(const TransformationMatrix& transform) -{ - const cairo_matrix_t* matrix = reinterpret_cast<const cairo_matrix_t*>(&transform); - - XFORM xform; - xform.eM11 = matrix->xx; - xform.eM12 = matrix->xy; - xform.eM21 = matrix->yx; - xform.eM22 = matrix->yy; - xform.eDx = matrix->x0; - xform.eDy = matrix->y0; - - ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); -} - void GraphicsContextPlatformPrivate::syncContext(PlatformGraphicsContext* cr) { + if (!cr) + return; + cairo_surface_t* surface = cairo_get_target(cr); m_hdc = cairo_win32_surface_get_dc(surface); SetGraphicsMode(m_hdc, GM_ADVANCED); // We need this call for themes to honor world transforms. } +void GraphicsContextPlatformPrivate::flush() +{ + cairo_surface_t* surface = cairo_win32_surface_create(m_hdc); + cairo_surface_flush(surface); + cairo_surface_destroy(surface); +} + } diff --git a/WebCore/platform/graphics/win/GraphicsContextWin.cpp b/WebCore/platform/graphics/win/GraphicsContextWin.cpp index e4c5b04..54b0cb2 100644 --- a/WebCore/platform/graphics/win/GraphicsContextWin.cpp +++ b/WebCore/platform/graphics/win/GraphicsContextWin.cpp @@ -32,6 +32,7 @@ #include "GraphicsContextPlatformPrivateCairo.h" #endif +#include "BitmapInfo.h" #include "TransformationMatrix.h" #include "NotImplemented.h" #include "Path.h" @@ -43,6 +44,14 @@ namespace WebCore { class SVGResourceImage; +static void fillWithClearColor(HBITMAP bitmap) +{ + BITMAP bmpInfo; + GetObject(bitmap, sizeof(bmpInfo), &bmpInfo); + int bufferSize = bmpInfo.bmWidthBytes * bmpInfo.bmHeight; + memset(bmpInfo.bmBits, 0, bufferSize); +} + bool GraphicsContext::inTransparencyLayer() const { return m_data->m_transparencyCount; } void GraphicsContext::setShouldIncludeChildWindows(bool include) @@ -55,6 +64,79 @@ bool GraphicsContext::shouldIncludeChildWindows() const return m_data->m_shouldIncludeChildWindows; } +GraphicsContext::WindowsBitmap::WindowsBitmap(HDC hdc, IntSize size) + : m_hdc(0) + , m_size(size) +{ + BitmapInfo bitmapInfo = BitmapInfo::create(m_size); + + m_bitmap = CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, reinterpret_cast<void**>(&m_bitmapBuffer), 0, 0); + if (!m_bitmap) + return; + + m_hdc = CreateCompatibleDC(hdc); + SelectObject(m_hdc, m_bitmap); + + BITMAP bmpInfo; + GetObject(m_bitmap, sizeof(bmpInfo), &bmpInfo); + m_bytesPerRow = bmpInfo.bmWidthBytes; + m_bitmapBufferLength = bmpInfo.bmWidthBytes * bmpInfo.bmHeight; + + SetGraphicsMode(m_hdc, GM_ADVANCED); +} + +GraphicsContext::WindowsBitmap::~WindowsBitmap() +{ + if (!m_bitmap) + return; + + DeleteDC(m_hdc); + DeleteObject(m_bitmap); +} + +GraphicsContext::WindowsBitmap* GraphicsContext::createWindowsBitmap(IntSize size) +{ + return new WindowsBitmap(m_data->m_hdc, size); +} + +HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap) +{ + // FIXME: Should a bitmap be created also when a shadow is set? + if (mayCreateBitmap && inTransparencyLayer()) { + if (dstRect.isEmpty()) + return 0; + + // Create a bitmap DC in which to draw. + BitmapInfo bitmapInfo = BitmapInfo::create(dstRect.size()); + + void* pixels = 0; + HBITMAP bitmap = ::CreateDIBSection(NULL, &bitmapInfo, DIB_RGB_COLORS, &pixels, 0, 0); + if (!bitmap) + return 0; + + HDC bitmapDC = ::CreateCompatibleDC(m_data->m_hdc); + ::SelectObject(bitmapDC, bitmap); + + // Fill our buffer with clear if we're going to alpha blend. + if (supportAlphaBlend) + fillWithClearColor(bitmap); + + // Make sure we can do world transforms. + SetGraphicsMode(bitmapDC, GM_ADVANCED); + + // Apply a translation to our context so that the drawing done will be at (0,0) of the bitmap. + XFORM xform = TransformationMatrix().translate(-dstRect.x(), -dstRect.y()); + + ::SetWorldTransform(bitmapDC, &xform); + + return bitmapDC; + } + + m_data->flush(); + m_data->save(); + return m_data->m_hdc; +} + void GraphicsContextPlatformPrivate::save() { if (!m_hdc) @@ -85,13 +167,8 @@ void GraphicsContextPlatformPrivate::scale(const FloatSize& size) { if (!m_hdc) return; - XFORM xform; - xform.eM11 = size.width(); - xform.eM12 = 0.0f; - xform.eM21 = 0.0f; - xform.eM22 = size.height(); - xform.eDx = 0.0f; - xform.eDy = 0.0f; + + XFORM xform = TransformationMatrix().scaleNonUniform(size.width(), size.height()); ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); } @@ -99,16 +176,7 @@ static const double deg2rad = 0.017453292519943295769; // pi/180 void GraphicsContextPlatformPrivate::rotate(float degreesAngle) { - float radiansAngle = degreesAngle * deg2rad; - float cosAngle = cosf(radiansAngle); - float sinAngle = sinf(radiansAngle); - XFORM xform; - xform.eM11 = cosAngle; - xform.eM12 = -sinAngle; - xform.eM21 = sinAngle; - xform.eM22 = cosAngle; - xform.eDx = 0.0f; - xform.eDy = 0.0f; + XFORM xform = TransformationMatrix().rotate(degreesAngle); ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); } @@ -116,13 +184,17 @@ void GraphicsContextPlatformPrivate::translate(float x , float y) { if (!m_hdc) return; - XFORM xform; - xform.eM11 = 1.0f; - xform.eM12 = 0.0f; - xform.eM21 = 0.0f; - xform.eM22 = 1.0f; - xform.eDx = x; - xform.eDy = y; + + XFORM xform = TransformationMatrix().translate(x, y); + ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); +} + +void GraphicsContextPlatformPrivate::concatCTM(const TransformationMatrix& transform) +{ + if (!m_hdc) + return; + + XFORM xform = transform; ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); } diff --git a/WebCore/platform/graphics/win/IconWin.cpp b/WebCore/platform/graphics/win/IconWin.cpp index c02b56e..61f1fd3 100644 --- a/WebCore/platform/graphics/win/IconWin.cpp +++ b/WebCore/platform/graphics/win/IconWin.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. +* Copyright (C) 2007-2009 Torch Mobile, Inc. * * 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,11 @@ #include <tchar.h> #include <windows.h> +#if PLATFORM(WINCE) +// SHGFI_SHELLICONSIZE is not available on WINCE +#define SHGFI_SHELLICONSIZE 0 +#endif + namespace WebCore { static const int shell32MultipleFileIconIndex = 54; @@ -55,6 +61,9 @@ PassRefPtr<Icon> Icon::createIconForFile(const String& filename) PassRefPtr<Icon> Icon::createIconForFiles(const Vector<String>&) { +#if PLATFORM(WINCE) + return 0; +#else TCHAR buffer[MAX_PATH]; UINT length = ::GetSystemDirectory(buffer, ARRAYSIZE(buffer)); if (!length) @@ -67,6 +76,7 @@ PassRefPtr<Icon> Icon::createIconForFiles(const Vector<String>&) if (!::ExtractIconEx(buffer, shell32MultipleFileIconIndex, 0, &hIcon, 1)) return 0; return adoptRef(new Icon(hIcon)); +#endif } void Icon::paint(GraphicsContext* context, const IntRect& r) @@ -74,11 +84,15 @@ void Icon::paint(GraphicsContext* context, const IntRect& r) if (context->paintingDisabled()) return; +#if PLATFORM(WINCE) + context->drawIcon(m_hIcon, r, DI_NORMAL); +#else HDC hdc = context->getWindowsContext(r); DrawIconEx(hdc, r.x(), r.y(), m_hIcon, r.width(), r.height(), 0, 0, DI_NORMAL); context->releaseWindowsContext(hdc, r); +#endif } } diff --git a/WebCore/platform/graphics/win/ImageCGWin.cpp b/WebCore/platform/graphics/win/ImageCGWin.cpp index 752729c..8a8e943 100644 --- a/WebCore/platform/graphics/win/ImageCGWin.cpp +++ b/WebCore/platform/graphics/win/ImageCGWin.cpp @@ -65,8 +65,8 @@ bool BitmapImage::getHBITMAPOfSize(HBITMAP bmp, LPSIZE size) void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext* ctxt, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator compositeOp) { - int frames = frameCount(); - for (int i = 0; i < frames; ++i) { + size_t frames = frameCount(); + for (size_t i = 0; i < frames; ++i) { CGImageRef image = frameAtIndex(i); if (CGImageGetHeight(image) == static_cast<size_t>(srcSize.height()) && CGImageGetWidth(image) == static_cast<size_t>(srcSize.width())) { size_t currentFrame = m_currentFrame; diff --git a/WebCore/platform/graphics/win/ImageCairoWin.cpp b/WebCore/platform/graphics/win/ImageCairoWin.cpp index 06428b8..591375f 100644 --- a/WebCore/platform/graphics/win/ImageCairoWin.cpp +++ b/WebCore/platform/graphics/win/ImageCairoWin.cpp @@ -73,8 +73,8 @@ bool BitmapImage::getHBITMAPOfSize(HBITMAP bmp, LPSIZE size) void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext* ctxt, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator compositeOp) { - int frames = frameCount(); - for (int i = 0; i < frames; ++i) { + size_t frames = frameCount(); + for (size_t i = 0; i < frames; ++i) { cairo_surface_t* image = frameAtIndex(i); if (cairo_image_surface_get_height(image) == static_cast<size_t>(srcSize.height()) && cairo_image_surface_get_width(image) == static_cast<size_t>(srcSize.width())) { size_t currentFrame = m_currentFrame; diff --git a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp index 35ea786..eb7334e 100644 --- a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp +++ b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp @@ -106,7 +106,7 @@ void MediaPlayerPrivate::load(const String& url) cancelSeek(); m_qtMovie.set(new QTMovieWin(this)); - m_qtMovie->load(url.characters(), url.length()); + m_qtMovie->load(url.characters(), url.length(), m_player->preservesPitch()); m_qtMovie->setVolume(m_player->volume()); m_qtMovie->setVisible(m_player->visible()); } @@ -252,8 +252,14 @@ void MediaPlayerPrivate::setRate(float rate) { if (!m_qtMovie) return; - if (!paused()) - m_qtMovie->setRate(rate); + m_qtMovie->setRate(rate); +} + +void MediaPlayerPrivate::setPreservesPitch(bool preservesPitch) +{ + if (!m_qtMovie) + return; + m_qtMovie->setPreservesPitch(preservesPitch); } int MediaPlayerPrivate::dataRate() const @@ -421,9 +427,33 @@ void MediaPlayerPrivate::paint(GraphicsContext* p, const IntRect& r) { if (p->paintingDisabled() || !m_qtMovie || m_hasUnsupportedTracks) return; + + bool usingTempBitmap = false; + OwnPtr<GraphicsContext::WindowsBitmap> bitmap; HDC hdc = p->getWindowsContext(r); + if (!hdc) { + // The graphics context doesn't have an associated HDC so create a temporary + // bitmap where QTMovieWin can draw the frame and we can copy it. + usingTempBitmap = true; + bitmap.set(p->createWindowsBitmap(r.size())); + hdc = bitmap->hdc(); + + // FIXME: is this necessary?? + XFORM xform; + xform.eM11 = 1.0f; + xform.eM12 = 0.0f; + xform.eM21 = 0.0f; + xform.eM22 = 1.0f; + xform.eDx = -r.x(); + xform.eDy = -r.y(); + SetWorldTransform(hdc, &xform); + } + m_qtMovie->paint(hdc, r.x(), r.y()); - p->releaseWindowsContext(hdc, r); + if (usingTempBitmap) + p->drawWindowsBitmap(bitmap.get(), r.topLeft()); + else + p->releaseWindowsContext(hdc, r); #if DRAW_FRAME_RATE if (m_frameCountWhilePlaying > 10) { @@ -486,7 +516,7 @@ MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const String& type, c { // only return "IsSupported" if there is no codecs parameter for now as there is no way to ask QT if it supports an // extended MIME type - return mimeTypeCache().contains(type) ? (!codecs.isEmpty() ? MediaPlayer::MayBeSupported : MediaPlayer::IsSupported) : MediaPlayer::IsNotSupported; + return mimeTypeCache().contains(type) ? (codecs.isEmpty() ? MediaPlayer::MayBeSupported : MediaPlayer::IsSupported) : MediaPlayer::IsNotSupported; } void MediaPlayerPrivate::movieEnded(QTMovieWin* movie) @@ -535,6 +565,13 @@ void MediaPlayerPrivate::movieNewImageAvailable(QTMovieWin* movie) m_player->repaint(); } +bool MediaPlayerPrivate::hasSingleSecurityOrigin() const +{ + // We tell quicktime to disallow resources that come from different origins + // so we all media is single origin. + return true; +} + } #endif diff --git a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h index 3207867..f584148 100644 --- a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h +++ b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h @@ -69,6 +69,7 @@ public: void setRate(float); void setVolume(float); + void setPreservesPitch(bool); int dataRate() const; @@ -89,6 +90,7 @@ public: void paint(GraphicsContext*, const IntRect&); + bool hasSingleSecurityOrigin() const; private: MediaPlayerPrivate(MediaPlayer*); diff --git a/WebCore/platform/graphics/win/QTMovieWin.cpp b/WebCore/platform/graphics/win/QTMovieWin.cpp index 1d10006..aaa61f1 100644 --- a/WebCore/platform/graphics/win/QTMovieWin.cpp +++ b/WebCore/platform/graphics/win/QTMovieWin.cpp @@ -76,7 +76,7 @@ static void updateTaskTimer(int maxInterval = 1000) setSharedTimerFireDelay(static_cast<float>(intervalInMS) / 1000); } -class QTMovieWinPrivate : Noncopyable { +class QTMovieWinPrivate : public Noncopyable { public: QTMovieWinPrivate(); ~QTMovieWinPrivate(); @@ -115,6 +115,9 @@ public: long m_loadError; float m_widthScaleFactor; float m_heightScaleFactor; + CFURLRef m_currentURL; + float m_timeToRestore; + float m_rateToRestore; #if !ASSERT_DISABLED bool m_scaleCached; #endif @@ -141,6 +144,9 @@ QTMovieWinPrivate::QTMovieWinPrivate() , m_loadError(0) , m_widthScaleFactor(1) , m_heightScaleFactor(1) + , m_currentURL(0) + , m_timeToRestore(-1.0f) + , m_rateToRestore(-1.0f) #if !ASSERT_DISABLED , m_scaleCached(false) #endif @@ -156,6 +162,8 @@ QTMovieWinPrivate::~QTMovieWinPrivate() DisposeMovieController(m_movieController); if (m_movie) DisposeMovie(m_movie); + if (m_currentURL) + CFRelease(m_currentURL); } static void taskTimerFired() @@ -230,16 +238,26 @@ void QTMovieWinPrivate::task() // we only need to erase the movie gworld when the load state changes to loaded while it // is visible as the gworld is destroyed/created when visibility changes + bool shouldRestorePlaybackState = false; if (loadState >= QTMovieLoadStateLoaded && m_loadState < QTMovieLoadStateLoaded) { if (m_visible) clearGWorld(); cacheMovieScale(); + shouldRestorePlaybackState = true; } m_loadState = loadState; if (!m_movieController && m_loadState >= QTMovieLoadStateLoaded) createMovieController(); m_client->movieLoadStateChanged(m_movieWin); + + if (shouldRestorePlaybackState && m_timeToRestore != -1.0f) { + m_movieWin->setCurrentTime(m_timeToRestore); + m_timeToRestore = -1.0f; + m_movieWin->setRate(m_rateToRestore); + m_rateToRestore = -1.0f; + } + if (m_movieWin->m_disabled) { endTask(); return; @@ -425,6 +443,8 @@ QTMovieWin::~QTMovieWin() void QTMovieWin::play() { + m_private->m_timeToRestore = -1.0f; + if (m_private->m_movieController) MCDoAction(m_private->m_movieController, mcActionPrerollAndPlay, (void *)GetMoviePreferredRate(m_private->m_movie)); else @@ -434,6 +454,8 @@ void QTMovieWin::play() void QTMovieWin::pause() { + m_private->m_timeToRestore = -1.0f; + if (m_private->m_movieController) MCDoAction(m_private->m_movieController, mcActionPlay, 0); else @@ -451,7 +473,9 @@ float QTMovieWin::rate() const void QTMovieWin::setRate(float rate) { if (!m_private->m_movie) - return; + return; + m_private->m_timeToRestore = -1.0f; + if (m_private->m_movieController) MCDoAction(m_private->m_movieController, mcActionPrerollAndPlay, (void *)FloatToFixed(rate)); else @@ -481,6 +505,9 @@ void QTMovieWin::setCurrentTime(float time) const { if (!m_private->m_movie) return; + + m_private->m_timeToRestore = -1.0f; + m_private->m_seeking = true; TimeScale scale = GetMovieTimeScale(m_private->m_movie); if (m_private->m_movieController){ @@ -498,6 +525,25 @@ void QTMovieWin::setVolume(float volume) SetMovieVolume(m_private->m_movie, static_cast<short>(volume * 256)); } +void QTMovieWin::setPreservesPitch(bool preservesPitch) +{ + if (!m_private->m_movie || !m_private->m_currentURL) + return; + + OSErr error; + bool prop = false; + + error = QTGetMovieProperty(m_private->m_movie, kQTPropertyClass_Audio, kQTAudioPropertyID_RateChangesPreservePitch, + sizeof(kQTAudioPropertyID_RateChangesPreservePitch), static_cast<QTPropertyValuePtr>(&prop), 0); + + if (error || prop == preservesPitch) + return; + + m_private->m_timeToRestore = currentTime(); + m_private->m_rateToRestore = rate(); + load(m_private->m_currentURL, preservesPitch); +} + unsigned QTMovieWin::dataSize() const { if (!m_private->m_movie) @@ -561,8 +607,22 @@ void QTMovieWin::paint(HDC hdc, int x, int y) 0, 0, m_private->m_width, m_private->m_height, blendFunction); } -void QTMovieWin::load(const UChar* url, int len) +void QTMovieWin::load(const UChar* url, int len, bool preservesPitch) { + CFStringRef urlStringRef = CFStringCreateWithCharacters(kCFAllocatorDefault, reinterpret_cast<const UniChar*>(url), len); + CFURLRef cfURL = CFURLCreateWithString(kCFAllocatorDefault, urlStringRef, 0); + + load(cfURL, preservesPitch); + + CFRelease(cfURL); + CFRelease(urlStringRef); +} + +void QTMovieWin::load(CFURLRef url, bool preservesPitch) +{ + if (!url) + return; + if (m_private->m_movie) { m_private->endTask(); if (m_private->m_gWorld) @@ -572,6 +632,7 @@ void QTMovieWin::load(const UChar* url, int len) m_private->m_movieController = 0; DisposeMovie(m_private->m_movie); m_private->m_movie = 0; + m_private->m_loadState = 0; } // Define a property array for NewMovieFromProperties. 8 should be enough for our needs. @@ -579,23 +640,33 @@ void QTMovieWin::load(const UChar* url, int len) ItemCount moviePropCount = 0; bool boolTrue = true; - - // Create a URL data reference of type CFURL - CFStringRef urlStringRef = CFStringCreateWithCharacters(kCFAllocatorDefault, reinterpret_cast<const UniChar*>(url), len); // Disable streaming support for now. - if (CFStringHasPrefix(urlStringRef, CFSTR("rtsp:"))) { + CFStringRef scheme = CFURLCopyScheme(url); + bool isRTSP = CFStringHasPrefix(scheme, CFSTR("rtsp:")); + CFRelease(scheme); + + if (isRTSP) { m_private->m_loadError = noMovieFound; goto end; } - CFURLRef urlRef = CFURLCreateWithString(kCFAllocatorDefault, urlStringRef, 0); + if (m_private->m_currentURL) { + if (m_private->m_currentURL != url) { + CFRelease(m_private->m_currentURL); + m_private->m_currentURL = url; + CFRetain(url); + } + } else { + m_private->m_currentURL = url; + CFRetain(url); + } // Add the movie data location to the property array movieProps[moviePropCount].propClass = kQTPropertyClass_DataLocation; movieProps[moviePropCount].propID = kQTDataLocationPropertyID_CFURL; - movieProps[moviePropCount].propValueSize = sizeof(urlRef); - movieProps[moviePropCount].propValueAddress = &urlRef; + movieProps[moviePropCount].propValueSize = sizeof(m_private->m_currentURL); + movieProps[moviePropCount].propValueAddress = &(m_private->m_currentURL); movieProps[moviePropCount].propStatus = 0; moviePropCount++; @@ -639,12 +710,18 @@ void QTMovieWin::load(const UChar* url, int len) movieProps[moviePropCount].propValueSize = sizeof(boolTrue); movieProps[moviePropCount].propValueAddress = &boolTrue; movieProps[moviePropCount].propStatus = 0; + moviePropCount++; + + movieProps[moviePropCount].propClass = kQTPropertyClass_Audio; + movieProps[moviePropCount].propID = kQTAudioPropertyID_RateChangesPreservePitch; + movieProps[moviePropCount].propValueSize = sizeof(preservesPitch); + movieProps[moviePropCount].propValueAddress = &preservesPitch; + movieProps[moviePropCount].propStatus = 0; moviePropCount++; ASSERT(moviePropCount <= sizeof(movieProps)/sizeof(movieProps[0])); m_private->m_loadError = NewMovieFromProperties(moviePropCount, movieProps, 0, NULL, &m_private->m_movie); - CFRelease(urlRef); end: m_private->startTask(); // get the load fail callback quickly @@ -660,8 +737,6 @@ end: QTSetMovieProperty(m_private->m_movie, kQTPropertyClass_Visual, kQTVisualPropertyID_ApertureMode, sizeof(mode), &mode); m_private->registerDrawingCallback(); } - - CFRelease(urlStringRef); } void QTMovieWin::disableUnsupportedTracks(unsigned& enabledTrackCount, unsigned& totalTrackCount) diff --git a/WebCore/platform/graphics/win/QTMovieWin.h b/WebCore/platform/graphics/win/QTMovieWin.h index 70cbef5..f46efd3 100644 --- a/WebCore/platform/graphics/win/QTMovieWin.h +++ b/WebCore/platform/graphics/win/QTMovieWin.h @@ -53,6 +53,8 @@ enum { QTMovieLoadStateComplete = 100000L }; +typedef const struct __CFURL * CFURLRef; + class QTMOVIEWIN_API QTMovieWin { public: static bool initializeQuickTime(); @@ -60,7 +62,7 @@ public: QTMovieWin(QTMovieWinClient*); ~QTMovieWin(); - void load(const UChar* url, int len); + void load(const UChar* url, int len, bool preservesPitch); long loadState() const; float maxTimeLoaded() const; @@ -75,6 +77,7 @@ public: void setCurrentTime(float) const; void setVolume(float); + void setPreservesPitch(bool); unsigned dataSize() const; @@ -93,6 +96,8 @@ public: static void getSupportedType(unsigned index, const UChar*& str, unsigned& len); private: + void load(CFURLRef, bool preservesPitch); + QTMovieWinPrivate* m_private; bool m_disabled; friend class QTMovieWinPrivate; diff --git a/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp b/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp index aaa089a..6b3a96e 100644 --- a/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp +++ b/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp @@ -126,11 +126,6 @@ void SimpleFontData::platformCharWidthInit() } } -void SimpleFontData::platformDestroy() -{ - platformCommonDestroy(); -} - float SimpleFontData::platformWidthForGlyph(Glyph glyph) const { if (m_platformData.useGDI()) diff --git a/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp b/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp index 2e51621..0343007 100644 --- a/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp +++ b/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp @@ -47,7 +47,6 @@ void SimpleFontData::platformInit() m_scriptCache = 0; m_scriptFontProperties = 0; m_isSystemFont = false; - m_syntheticBoldOffset = 0; m_syntheticBoldOffset = m_platformData.syntheticBold() ? 1.0f : 0.f; @@ -97,16 +96,6 @@ void SimpleFontData::platformCharWidthInit() // charwidths are set in platformInit. } -void SimpleFontData::platformDestroy() -{ - cairo_font_face_destroy(m_platformData.fontFace()); - cairo_scaled_font_destroy(m_platformData.scaledFont()); - - DeleteObject(m_platformData.hfont()); - - platformCommonDestroy(); -} - float SimpleFontData::platformWidthForGlyph(Glyph glyph) const { if (m_platformData.useGDI()) diff --git a/WebCore/platform/graphics/win/SimpleFontDataWin.cpp b/WebCore/platform/graphics/win/SimpleFontDataWin.cpp index 9835e9f..5a3244c 100644 --- a/WebCore/platform/graphics/win/SimpleFontDataWin.cpp +++ b/WebCore/platform/graphics/win/SimpleFontDataWin.cpp @@ -37,10 +37,13 @@ #include <wtf/MathExtras.h> #include <unicode/uchar.h> #include <unicode/unorm.h> -#include <ApplicationServices/ApplicationServices.h> #include <mlang.h> #include <tchar.h> + +#if PLATFORM(CG) +#include <ApplicationServices/ApplicationServices.h> #include <WebKitSystemInterface/WebKitSystemInterface.h> +#endif namespace WebCore { @@ -89,7 +92,7 @@ void SimpleFontData::initGDIFont() return; } -void SimpleFontData::platformCommonDestroy() +void SimpleFontData::platformDestroy() { // We don't hash this on Win32, so it's effectively owned by us. delete m_smallCapsFontData; diff --git a/WebCore/platform/graphics/win/TransformationMatrixWin.cpp b/WebCore/platform/graphics/win/TransformationMatrixWin.cpp new file mode 100644 index 0000000..38dbfbf --- /dev/null +++ b/WebCore/platform/graphics/win/TransformationMatrixWin.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2009 Apple Inc. 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 "TransformationMatrix.h" + +namespace WebCore { + +TransformationMatrix::operator XFORM() const +{ + XFORM xform; + xform.eM11 = a(); + xform.eM12 = b(); + xform.eM21 = c(); + xform.eM22 = d(); + xform.eDx = e(); + xform.eDy = f(); + + return xform; +} + +} |