-
commit-queue@webkit.org authored
https://bugs.webkit.org/show_bug.cgi?id=124626 Patch by Myles C. Maxfield <mmaxfield@apple.com> on 2013-12-04 Reviewed by Simon Fraser. Source/WebCore: Because creating ImageBuffer's backing store can be so expensive, it would be beneficial to have a pool of pre-created backing stores available. However, this means that ImageBuffer might have to use a backing store that is larger than the exact dimensions that it needs. This patch adds a field, m_backingStoreSize, to CG's ImageBufferData class, and uses this new field when performing ImageBuffer operations to allow for larger-than-necessary backing stores. Content is always drawn in the top left corner of the backing store. No new tests are necessary because there is no behavior change. * platform/graphics/ImageBuffer.h: (WebCore::ImageBuffer::baseTransform): The base transform has to put content at the top left corner instead of bottom left * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::createCroppedImageIfNecessary): Convenience function to figure out the dimensions of the backing texture in user space (WebCore::ImageBuffer::ImageBuffer): Set up new m_backingStoreSize member (WebCore::maybeCropToBounds): Some ImageBuffer API functions require outputting an image with logical size. This function performs the cropping (WebCore::ImageBuffer::copyImage): Updated for larger-than-necessary backing stores (WebCore::ImageBuffer::copyNativeImage): Ditto (WebCore::ImageBuffer::draw): Ditto (WebCore::ImageBuffer::clip): Ditto (WebCore::ImageBuffer::putByteArray): Ditto (WebCore::ImageBuffer::toDataURL): Ditto * platform/graphics/cg/ImageBufferDataCG.cpp: (WebCore::ImageBufferData::getData): Ditto (WebCore::ImageBufferData::putData): Ditto * platform/graphics/cg/ImageBufferDataCG.h: New m_backingStoreSize field LayoutTests: Update tests to be more robust with respect to accelerated vs non-accelerated ImageBuffers. * fast/canvas/script-tests/canvas-fillPath-shadow.js: Don't sample a canvas at exactly the corner of a drawn shape (because the corner might be antialiased). Instead, sample a single pixel inside the shape * fast/canvas/script-tests/canvas-scale-shadowBlur.js: Don't sample a canvas at exactly the edge of the blur radius. Instead, sample a single pixel past the blur radius. * fast/canvas/script-tests/canvas-scale-strokePath-shadow.js: (shouldBeAround): Allow this test to be less strict when sampling inside a blurred region * platform/mac/fast/canvas/canvas-scale-shadowBlur-expected.txt: Matching update w/r/t canvas-scale-shadowBlur.js git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160121 268f45cc-cd09-0410-ab3c-d52691b4dbfc
60dcc5f6