Changeset 106997 in webkit


Ignore:
Timestamp:
Feb 7, 2012 3:29:58 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[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):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106996 r106997  
     12012-02-07  David Reveman  <reveman@chromium.org>
     2
     3        [Chromium] Crash when using per-tile painting on Windows.
     4        https://bugs.webkit.org/show_bug.cgi?id=75715
     5
     6        Reviewed by James Robinson.
     7
     8        PlatformCanvas constructor on win32 expects forth argument to be a
     9        shared section handle. Passing a pointer to a system memory causes
     10        it to crash. Fix this by not using the PlatformCanvas API for
     11        SkCanvas construction in per-tile texture uploader.
     12
     13        Tested with manual tests.
     14
     15        * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp:
     16        (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect):
     17        (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect):
     18        * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h:
     19        (Texture):
     20
    1212012-02-07  Jer Noble  <jer.noble@apple.com>
    222
  • trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp

    r105314 r106997  
    3434#include "LayerPainterChromium.h"
    3535#include "SkCanvas.h"
    36 #include "skia/ext/platform_canvas.h"
     36#include "SkDevice.h"
    3737
    3838namespace WebCore {
     
    4646void BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect(const IntRect& sourceRect)
    4747{
    48     size_t bufferSize = TextureManager::memoryUseBytes(sourceRect.size(), texture()->format());
    49     m_pixelData = adoptArrayPtr(new uint8_t[bufferSize]);
    50     OwnPtr<SkCanvas> canvas = adoptPtr(new skia::PlatformCanvas(sourceRect.width(), sourceRect.height(), false, m_pixelData.get()));
     48    m_device = adoptPtr(new SkDevice(SkBitmap::kARGB_8888_Config, sourceRect.width(), sourceRect.height()));
     49    OwnPtr<SkCanvas> canvas = adoptPtr(new SkCanvas(m_device.get()));
    5150    textureUpdater()->paintContentsRect(canvas.get(), sourceRect);
    5251}
     
    5554{
    5655    texture()->bindTexture(context, allocator);
    57     ASSERT(m_pixelData.get());
    58     textureUpdater()->updateTextureRect(context, texture()->format(), destRect, m_pixelData.get());
    59     m_pixelData.clear();
     56
     57    ASSERT(m_device);
     58    const SkBitmap* bitmap = &m_device->accessBitmap(false);
     59    bitmap->lockPixels();
     60    textureUpdater()->updateTextureRect(context, texture()->format(), destRect, static_cast<uint8_t*>(bitmap->getPixels()));
     61    bitmap->unlockPixels();
     62    m_device.clear();
    6063}
    6164
  • trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h

    r105314 r106997  
    3535#include "SkPictureCanvasLayerTextureUpdater.h"
    3636
     37class SkDevice;
     38
    3739namespace WebCore {
    3840
     
    5153        BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; }
    5254
    53         OwnArrayPtr<uint8_t> m_pixelData;
     55        OwnPtr<SkDevice> m_device;
    5456        BitmapSkPictureCanvasLayerTextureUpdater* m_textureUpdater;
    5557    };
Note: See TracChangeset for help on using the changeset viewer.