[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
kbalazs at webkit.org
kbalazs at webkit.org
Wed Dec 22 15:44:26 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit f2c5899ea8b66652e5a6c23ccc158fd0cfb8a29b
Author: kbalazs at webkit.org <kbalazs at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Nov 11 15:47:40 2010 +0000
2010-11-11 Balazs Kelemen <kbalazs at webkit.org>
Reviewed by Andreas Kling.
[Qt][WK2] Implement BackingStore
https://bugs.webkit.org/show_bug.cgi?id=49377
No change in functionality so no tests.
Add a way to hand off ownership of the QPainter and the underlying
QPaintDevice to the GraphicsContext.
* platform/graphics/GraphicsContext.h:
* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::GraphicsContextPlatformPrivate::takeOwnershipOfPlatformContext):
(WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
(WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate):
(WebCore::GraphicsContext::takeOwnershipOfPlatformContext):
2010-11-11 Balazs Kelemen <kbalazs at webkit.org>
Reviewed by Andreas Kling.
[Qt][WK2] Implement BackingStore
https://bugs.webkit.org/show_bug.cgi?id=49377
* Shared/qt/BackingStoreQt.cpp:
(WebKit::createQImage): Added static helper. Creates a QImage
from the shared memory buffer.
(WebKit::BackingStore::createGraphicsContext):
(WebKit::BackingStore::createFlippedGraphicsContext): Leave
unimplemented with an ASSERT_NOT_REACHED since this is only
needed for the CoreGraphics backend.
(WebKit::BackingStore::paint):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71821 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c663a1f..cfa3a60 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-11-11 Balazs Kelemen <kbalazs at webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt][WK2] Implement BackingStore
+ https://bugs.webkit.org/show_bug.cgi?id=49377
+ No change in functionality so no tests.
+
+ Add a way to hand off ownership of the QPainter and the underlying
+ QPaintDevice to the GraphicsContext.
+ * platform/graphics/GraphicsContext.h:
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+ (WebCore::GraphicsContextPlatformPrivate::takeOwnershipOfPlatformContext):
+ (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
+ (WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate):
+ (WebCore::GraphicsContext::takeOwnershipOfPlatformContext):
+
2010-11-11 Ryuan Choi <ryuan.choi at samsung.com>
Reviewed by Adam Barth.
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index 592bf6f..71a4c48 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -395,6 +395,7 @@ namespace WebCore {
bool inTransparencyLayer() const;
PlatformPath* currentPath();
void pushTransparencyLayerInternal(const QRect &rect, qreal opacity, QPixmap& alphaMask);
+ void takeOwnershipOfPlatformContext();
static QPainter::CompositionMode toQtCompositionMode(CompositeOperator op);
#endif
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 4f68577..06e1e1c 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -220,8 +220,11 @@ public:
#endif
}
+ void takeOwnershipOfPlatformContext() { platformContextIsOwned = true; }
+
private:
QPainter* painter;
+ bool platformContextIsOwned;
};
@@ -231,6 +234,7 @@ GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPainter* p, cons
, solidColor(initialSolidColor)
, imageInterpolationQuality(InterpolationDefault)
, painter(p)
+ , platformContextIsOwned(false)
{
if (!painter)
return;
@@ -243,6 +247,13 @@ GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPainter* p, cons
GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate()
{
+ if (!platformContextIsOwned)
+ return;
+
+ painter->end();
+ QPaintDevice* device = painter->device();
+ delete painter;
+ delete device;
}
GraphicsContext::GraphicsContext(PlatformGraphicsContext* painter)
@@ -1400,6 +1411,11 @@ InterpolationQuality GraphicsContext::imageInterpolationQuality() const
return m_data->imageInterpolationQuality;
}
+void GraphicsContext::takeOwnershipOfPlatformContext()
+{
+ m_data->takeOwnershipOfPlatformContext();
+}
+
}
// vim: ts=4 sw=4 et
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 47daf78..6c6ca9f 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,19 @@
+2010-11-11 Balazs Kelemen <kbalazs at webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt][WK2] Implement BackingStore
+ https://bugs.webkit.org/show_bug.cgi?id=49377
+
+ * Shared/qt/BackingStoreQt.cpp:
+ (WebKit::createQImage): Added static helper. Creates a QImage
+ from the shared memory buffer.
+ (WebKit::BackingStore::createGraphicsContext):
+ (WebKit::BackingStore::createFlippedGraphicsContext): Leave
+ unimplemented with an ASSERT_NOT_REACHED since this is only
+ needed for the CoreGraphics backend.
+ (WebKit::BackingStore::paint):
+
2010-11-11 Kenneth Rohde Christiansen <kenneth at webkit.org>
Reviewed by Andreas Kling.
diff --git a/WebKit2/Shared/qt/BackingStoreQt.cpp b/WebKit2/Shared/qt/BackingStoreQt.cpp
index 105c5e5..afec4f2 100644
--- a/WebKit2/Shared/qt/BackingStoreQt.cpp
+++ b/WebKit2/Shared/qt/BackingStoreQt.cpp
@@ -25,28 +25,41 @@
#include "BackingStore.h"
-#include "NotImplemented.h"
+#include <QImage>
+#include <QPainter>
#include <WebCore/GraphicsContext.h>
using namespace WebCore;
namespace WebKit {
+static inline QImage createQImage(void* data, int width, int height)
+{
+ return QImage(reinterpret_cast<uchar*>(data), width, height, width * 4, QImage::Format_RGB32);
+}
+
PassOwnPtr<GraphicsContext> BackingStore::createGraphicsContext()
{
- notImplemented();
- return 0;
+ QImage* image = new QImage(createQImage(data(), m_size.width(), m_size.height()));
+ GraphicsContext* context = new GraphicsContext(new QPainter(image));
+ context->takeOwnershipOfPlatformContext();
+ return context;
}
PassOwnPtr<GraphicsContext> BackingStore::createFlippedGraphicsContext()
{
- notImplemented();
+ // This is CG specific so we should not use it.
+ ASSERT_NOT_REACHED();
return 0;
}
-void BackingStore::paint(GraphicsContext&, const IntPoint&, const IntRect&)
+void BackingStore::paint(GraphicsContext& context, const IntPoint& dstPoint, const IntRect& srcRect)
{
- notImplemented();
+ QImage image = createQImage(data(), m_size.width(), m_size.height());
+ QPainter* painter = context.platformContext();
+ painter->translate(-srcRect.x(), -srcRect.y());
+ painter->drawImage(dstPoint, image, QRect(srcRect));
+ painter->translate(srcRect.x(), srcRect.y());
}
-
+
} // namespace WebKit
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list