Add fast path for ImageBuffer::draw
authormdelaney@apple.com <mdelaney@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Jul 2011 04:24:40 +0000 (04:24 +0000)
committermdelaney@apple.com <mdelaney@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Jul 2011 04:24:40 +0000 (04:24 +0000)
commitc4280074c2b72a8e132c0436ed734f5efc4cd1d6
tree5b1199e3c94c9e9b6bcc3872ee1aff140388ca48
parentcbbce259f1148925a30d06bdd8ff43964bfe2d9c
Add fast path for ImageBuffer::draw
https://bugs.webkit.org/show_bug.cgi?id=64535

Reviewed by Simon Fraser.

No new tests. This patch doesn't change behavior; current tests are sufficient.

* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawImage): Moved the main method version next to wrapper versions.

* platform/graphics/ImageBuffer.h:
1) Added BackingStoreCopy enum for choosing to copy backing store or not in copyImage().
2) Added copyNativeImage() behind USE(CG) - same as copyImage() but gives NativeImagePtr.
* platform/graphics/cg/ImageBufferCG.cpp: Added new methods described above.

* platform/graphics/GraphicsContext.h: Adding drawNativeImage() for fast draw path.
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawNativeImage): Added. Draws a nativeImagePtr into context.

* platform/graphics/Image.h: Added imageWithColorSpace behind CG platform ifdef
* platform/graphics/cg/ImageCG.cpp:
(WebCore::BitmapImage::draw): Refactored out actual image drawing code into GraphicsContext,
so that it can be used by more than just BitmapImage without having to copy code.
(WebCore::Image::imageWithColorSpace): Made into an Image class function.

Updated copyImage() to for BackingStoreCopy:
* platform/graphics/qt/ImageBufferQt.cpp
* platform/graphics/filters/FETile.cpp
* platform/graphics/cairo/ImageBufferCairo.cpp
* platform/graphics/skia/ImageBufferSkia.cpp
* platform/graphics/wx/ImageBufferWx.cpp
* platform/graphics/wince/ImageBufferWinCE.cpp
* svg/SVGFEImageElement.cpp
* svg/graphics/SVGImage.cpp
* html/HTMLCanvasElement.cpp
* html/canvas/WebGLRenderingContext.cpp
* rendering/svg/RenderSVGResourcePattern.cpp

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@91332 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLCanvasElement.cpp
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/platform/graphics/GraphicsContext.cpp
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/Image.h
Source/WebCore/platform/graphics/ImageBuffer.h
Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
Source/WebCore/platform/graphics/cg/ImageCG.cpp
Source/WebCore/platform/graphics/filters/FETile.cpp
Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp
Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp
Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp
Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp
Source/WebCore/svg/SVGFEImageElement.cpp
Source/WebCore/svg/graphics/SVGImage.cpp