[Chromium] Crash when using per-tile painting on Windows.

https://bugs.webkit.org/show_bug.cgi?id=75715

Patch by David Reveman <reveman@chromium.org> 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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106997 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bd3b4ab0
2012-02-07 David Reveman <reveman@chromium.org>
[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 <jer.noble@apple.com>
Unreviewed build fix; make OSStatus the explicit return type for CMTimebase functions.
......@@ -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 @@ BitmapSkPictureCanvasLayerTextureUpdater::Texture::Texture(BitmapSkPictureCanvas
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)
......
......@@ -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 @@ public:
private:
BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; }
OwnArrayPtr<uint8_t> m_pixelData;
OwnPtr<SkDevice> m_device;
BitmapSkPictureCanvasLayerTextureUpdater* m_textureUpdater;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment