Changeset 90831 in webkit


Ignore:
Timestamp:
Jul 12, 2011 11:31:53 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

[skia] optimize getImageData to avoid a copy when not needed. lockPixels() now does the right thing.
https://bugs.webkit.org/show_bug.cgi?id=64302

Patch by Mike Reed <reed@google.com> on 2011-07-12
Reviewed by Stephen White.

No new tests. Just an optimization for getImageData(), existing <canvas> tests apply

  • platform/graphics/skia/ImageBufferSkia.cpp:

(WebCore::getImageData):
(WebCore::putImageData):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90830 r90831  
     12011-07-12  Mike Reed  <reed@google.com>
     2
     3        [skia] optimize getImageData to avoid a copy when not needed. lockPixels() now does the right thing.
     4        https://bugs.webkit.org/show_bug.cgi?id=64302
     5
     6        Reviewed by Stephen White.
     7
     8        No new tests. Just an optimization for getImageData(), existing <canvas> tests apply
     9
     10        * platform/graphics/skia/ImageBufferSkia.cpp:
     11        (WebCore::getImageData):
     12        (WebCore::putImageData):
     13
    1142011-07-12  Pavel Feldman  <pfeldman@google.com>
    215
  • trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp

    r90645 r90831  
    224224
    225225    SkBitmap srcBitmap;
    226     srcDevice.readPixels(SkIRect::MakeXYWH(originX, originY, numColumns, numRows), &srcBitmap);
     226    SkIRect srcRect = SkIRect::MakeXYWH(originX, originY, numColumns, numRows);
     227    if (!srcDevice.accessBitmap(false).extractSubset(&srcBitmap, srcRect))
     228        return result.release();
     229    SkAutoLockPixels alp(srcBitmap);
    227230
    228231    unsigned char* destRow = data + destY * destBytesPerRow + destX * 4;
     
    299302    unsigned srcBytesPerRow = 4 * sourceSize.width();
    300303
    301     SkBitmap deviceBitmap = dstDevice->accessBitmap(true);
    302 
    303     // If the device's bitmap doesn't have pixels we will make a temp and call writePixels on the device.
    304     bool temporaryBitmap = !!deviceBitmap.getTexture();
     304    const SkBitmap& deviceBitmap = dstDevice->accessBitmap(true);
     305    bool temporaryBitmap = !deviceBitmap.lockPixelsAreWritable();
    305306    SkBitmap destBitmap;
    306307
Note: See TracChangeset for help on using the changeset viewer.