Title: [106997] trunk/Source/WebCore
- Revision
- 106997
- Author
- [email protected]
- Date
- 2012-02-07 15:29:58 -0800 (Tue, 07 Feb 2012)
Log Message
[Chromium] Crash when using per-tile painting on Windows.
https://bugs.webkit.org/show_bug.cgi?id=75715
Patch by David Reveman <[email protected]> on 2012-02-07
Reviewed by James Robinson.
PlatformCanvas constructor on win32 expects forth argument to be a
shared section handle. Passing a pointer to a system memory causes
it to crash. Fix this by not using the PlatformCanvas API for
SkCanvas construction in per-tile texture uploader.
Tested with manual tests.
* platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp:
(WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect):
(WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect):
* platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h:
(Texture):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (106996 => 106997)
--- trunk/Source/WebCore/ChangeLog 2012-02-07 23:12:27 UTC (rev 106996)
+++ trunk/Source/WebCore/ChangeLog 2012-02-07 23:29:58 UTC (rev 106997)
@@ -1,3 +1,23 @@
+2012-02-07 David Reveman <[email protected]>
+
+ [Chromium] Crash when using per-tile painting on Windows.
+ https://bugs.webkit.org/show_bug.cgi?id=75715
+
+ Reviewed by James Robinson.
+
+ PlatformCanvas constructor on win32 expects forth argument to be a
+ shared section handle. Passing a pointer to a system memory causes
+ it to crash. Fix this by not using the PlatformCanvas API for
+ SkCanvas construction in per-tile texture uploader.
+
+ Tested with manual tests.
+
+ * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp:
+ (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect):
+ (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect):
+ * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h:
+ (Texture):
+
2012-02-07 Jer Noble <[email protected]>
Unreviewed build fix; make OSStatus the explicit return type for CMTimebase functions.
Modified: trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp (106996 => 106997)
--- trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp 2012-02-07 23:12:27 UTC (rev 106996)
+++ trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp 2012-02-07 23:29:58 UTC (rev 106997)
@@ -33,7 +33,7 @@
#include "LayerPainterChromium.h"
#include "SkCanvas.h"
-#include "skia/ext/platform_canvas.h"
+#include "SkDevice.h"
namespace WebCore {
@@ -45,18 +45,21 @@
void BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect(const IntRect& sourceRect)
{
- size_t bufferSize = TextureManager::memoryUseBytes(sourceRect.size(), texture()->format());
- m_pixelData = adoptArrayPtr(new uint8_t[bufferSize]);
- OwnPtr<SkCanvas> canvas = adoptPtr(new skia::PlatformCanvas(sourceRect.width(), sourceRect.height(), false, m_pixelData.get()));
+ m_device = adoptPtr(new SkDevice(SkBitmap::kARGB_8888_Config, sourceRect.width(), sourceRect.height()));
+ OwnPtr<SkCanvas> canvas = adoptPtr(new SkCanvas(m_device.get()));
textureUpdater()->paintContentsRect(canvas.get(), sourceRect);
}
void BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect(GraphicsContext3D* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect)
{
texture()->bindTexture(context, allocator);
- ASSERT(m_pixelData.get());
- textureUpdater()->updateTextureRect(context, texture()->format(), destRect, m_pixelData.get());
- m_pixelData.clear();
+
+ ASSERT(m_device);
+ const SkBitmap* bitmap = &m_device->accessBitmap(false);
+ bitmap->lockPixels();
+ textureUpdater()->updateTextureRect(context, texture()->format(), destRect, static_cast<uint8_t*>(bitmap->getPixels()));
+ bitmap->unlockPixels();
+ m_device.clear();
}
PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> BitmapSkPictureCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage)
Modified: trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h (106996 => 106997)
--- trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h 2012-02-07 23:12:27 UTC (rev 106996)
+++ trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h 2012-02-07 23:29:58 UTC (rev 106997)
@@ -34,6 +34,8 @@
#include "PlatformColor.h"
#include "SkPictureCanvasLayerTextureUpdater.h"
+class SkDevice;
+
namespace WebCore {
// This class records the contentRect into an SkPicture, then software rasterizes
@@ -50,7 +52,7 @@
private:
BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; }
- OwnArrayPtr<uint8_t> m_pixelData;
+ OwnPtr<SkDevice> m_device;
BitmapSkPictureCanvasLayerTextureUpdater* m_textureUpdater;
};
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes