Description
Eric Seidel (no email)
2008-08-11 17:20:51 PDT
Created attachment 22735 [details]
First pass at refactoring Pattern
WebCore/WebCore.xcodeproj/project.pbxproj | 16 ++-
WebCore/editing/DeleteButtonController.cpp | 10 +-
WebCore/html/CanvasPattern.cpp | 153 +------------------
WebCore/html/CanvasPattern.h | 64 ++-------
WebCore/html/CanvasRenderingContext2D.cpp | 119 ++++-----------
WebCore/html/CanvasRenderingContext2D.h | 4 +-
WebCore/html/CanvasStyle.cpp | 165 ++++----------------
WebCore/html/HTMLCanvasElement.cpp | 44 -----
WebCore/html/HTMLCanvasElement.h | 24 +---
WebCore/loader/CachedImage.cpp | 24 ++--
WebCore/loader/CachedImage.h | 2 +-
WebCore/loader/FrameLoader.cpp | 6 +-
WebCore/loader/icon/IconRecord.cpp | 6 +-
WebCore/loader/icon/IconRecord.h | 2 +-
WebCore/platform/graphics/BitmapImage.h | 17 ++-
WebCore/platform/graphics/Color.cpp | 10 ++
WebCore/platform/graphics/Color.h | 2 +
WebCore/platform/graphics/GeneratedImage.h | 4 +
WebCore/platform/graphics/Gradient.cpp | 2 +-
WebCore/platform/graphics/Gradient.h | 5 -
WebCore/platform/graphics/GraphicsContext.h | 6 +-
WebCore/platform/graphics/Image.cpp | 7 +
WebCore/platform/graphics/Image.h | 20 ++--
WebCore/platform/graphics/ImageBuffer.h | 39 +-----
WebCore/platform/graphics/Pattern.cpp | 45 ++++++
WebCore/platform/graphics/Pattern.h | 62 ++++++++
.../graphics/cairo/GraphicsContextCairo.cpp | 17 ++
WebCore/platform/graphics/cairo/PatternCairo.cpp | 46 ++++++
WebCore/platform/graphics/cg/GraphicsContextCG.cpp | 33 ++++-
WebCore/platform/graphics/cg/ImageBufferCG.cpp | 8 +-
WebCore/platform/graphics/cg/PDFDocumentImage.h | 11 ++-
WebCore/platform/graphics/cg/PatternCG.cpp | 77 +++++++++
WebCore/platform/graphics/mac/ImageMac.mm | 12 +-
WebCore/rendering/RenderImage.cpp | 3 +-
WebCore/rendering/RenderLayer.cpp | 4 +-
WebCore/svg/graphics/SVGImage.cpp | 11 +--
WebCore/svg/graphics/SVGImage.h | 11 ++-
.../svg/graphics/cg/SVGPaintServerPatternCg.cpp | 2 +-
WebCore/svg/graphics/cg/SVGResourceMaskerCg.mm | 2 +-
39 files changed, 484 insertions(+), 611 deletions(-)
So there were several non-intentional consequences of this patch. 1. I needed to make Image refcounted (for my own personal sanity, if nothing else). 2. I now correctly (according to HTML5) return an exception when the image isn't fully loaded and one tries to create a pattern from it. 3. I added Image::nullImage() (which is slightly ugly, since it causes Image.cpp to need BitmapImage.h) 4. I added a constructor to Color() and fixed the "set stroke/fill style" paths in the 2d-context code. Created attachment 22736 [details]
First pass at refactoring Pattern
WebCore/WebCore.xcodeproj/project.pbxproj | 16 ++-
WebCore/editing/DeleteButtonController.cpp | 10 +-
WebCore/html/CanvasPattern.cpp | 165 +-------------------
WebCore/html/CanvasPattern.h | 58 +------
WebCore/html/CanvasRenderingContext2D.cpp | 115 ++++-----------
WebCore/html/CanvasRenderingContext2D.h | 4 +-
WebCore/html/CanvasStyle.cpp | 165 ++++----------------
WebCore/html/HTMLCanvasElement.cpp | 44 -----
WebCore/html/HTMLCanvasElement.h | 24 +---
WebCore/loader/CachedImage.cpp | 24 ++--
WebCore/loader/CachedImage.h | 2 +-
WebCore/loader/FrameLoader.cpp | 6 +-
WebCore/loader/icon/IconRecord.cpp | 6 +-
WebCore/loader/icon/IconRecord.h | 2 +-
WebCore/platform/graphics/BitmapImage.h | 17 ++-
WebCore/platform/graphics/Color.cpp | 10 ++
WebCore/platform/graphics/Color.h | 2 +
WebCore/platform/graphics/GeneratedImage.h | 4 +
WebCore/platform/graphics/Gradient.cpp | 2 +-
WebCore/platform/graphics/Gradient.h | 5 -
WebCore/platform/graphics/GraphicsContext.h | 6 +-
WebCore/platform/graphics/Image.cpp | 7 +
WebCore/platform/graphics/Image.h | 20 ++--
WebCore/platform/graphics/ImageBuffer.h | 39 +-----
WebCore/platform/graphics/Pattern.cpp | 45 ++++++
WebCore/platform/graphics/Pattern.h | 62 ++++++++
.../graphics/cairo/GraphicsContextCairo.cpp | 17 ++
WebCore/platform/graphics/cairo/PatternCairo.cpp | 46 ++++++
WebCore/platform/graphics/cg/GraphicsContextCG.cpp | 33 ++++-
WebCore/platform/graphics/cg/ImageBufferCG.cpp | 8 +-
WebCore/platform/graphics/cg/PDFDocumentImage.h | 11 ++-
WebCore/platform/graphics/cg/PatternCG.cpp | 77 +++++++++
WebCore/platform/graphics/mac/ImageMac.mm | 12 +-
WebCore/rendering/RenderImage.cpp | 3 +-
WebCore/rendering/RenderLayer.cpp | 4 +-
WebCore/svg/graphics/SVGImage.cpp | 11 +--
WebCore/svg/graphics/SVGImage.h | 11 ++-
.../svg/graphics/cg/SVGPaintServerPatternCg.cpp | 2 +-
WebCore/svg/graphics/cg/SVGResourceMaskerCg.mm | 2 +-
39 files changed, 482 insertions(+), 615 deletions(-)
Created attachment 22754 [details]
Third pass, now fixing Cairo build issues.
WebCore/WebCore.xcodeproj/project.pbxproj | 19 ++-
WebCore/editing/DeleteButtonController.cpp | 10 +-
WebCore/html/CanvasPattern.cpp | 165 +-------------------
WebCore/html/CanvasPattern.h | 58 +------
WebCore/html/CanvasRenderingContext2D.cpp | 115 ++++-----------
WebCore/html/CanvasRenderingContext2D.h | 4 +-
WebCore/html/CanvasStyle.cpp | 165 ++++----------------
WebCore/html/HTMLCanvasElement.cpp | 44 -----
WebCore/html/HTMLCanvasElement.h | 24 +---
WebCore/loader/CachedImage.cpp | 24 ++--
WebCore/loader/CachedImage.h | 2 +-
WebCore/loader/FrameLoader.cpp | 6 +-
WebCore/loader/icon/IconRecord.cpp | 6 +-
WebCore/loader/icon/IconRecord.h | 2 +-
WebCore/platform/graphics/BitmapImage.h | 17 ++-
WebCore/platform/graphics/Color.cpp | 10 ++
WebCore/platform/graphics/Color.h | 2 +
WebCore/platform/graphics/GeneratedImage.h | 4 +
WebCore/platform/graphics/Gradient.cpp | 2 +-
WebCore/platform/graphics/Gradient.h | 5 -
WebCore/platform/graphics/GraphicsContext.h | 6 +-
WebCore/platform/graphics/Image.cpp | 7 +
WebCore/platform/graphics/Image.h | 20 ++--
WebCore/platform/graphics/ImageBuffer.h | 39 +-----
WebCore/platform/graphics/Pattern.cpp | 45 ++++++
WebCore/platform/graphics/Pattern.h | 63 ++++++++
.../graphics/cairo/GraphicsContextCairo.cpp | 17 ++
WebCore/platform/graphics/cairo/PatternCairo.cpp | 46 ++++++
WebCore/platform/graphics/cg/GraphicsContextCG.cpp | 33 ++++-
WebCore/platform/graphics/cg/ImageBufferCG.cpp | 8 +-
WebCore/platform/graphics/cg/PDFDocumentImage.h | 11 ++-
WebCore/platform/graphics/cg/PatternCG.cpp | 77 +++++++++
WebCore/platform/graphics/mac/ImageMac.mm | 12 +-
WebCore/rendering/RenderImage.cpp | 3 +-
WebCore/rendering/RenderLayer.cpp | 4 +-
WebCore/svg/graphics/SVGImage.cpp | 11 +--
WebCore/svg/graphics/SVGImage.h | 11 ++-
.../svg/graphics/cg/SVGPaintServerPatternCg.cpp | 2 +-
WebCore/svg/graphics/cg/SVGResourceMaskerCg.mm | 2 +-
39 files changed, 483 insertions(+), 618 deletions(-)
Created attachment 22755 [details]
Fourth pass, fixing a bogus ASSERT, color float conversions, and more Cairo build issues.
WebCore/WebCore.xcodeproj/project.pbxproj | 19 ++-
WebCore/editing/DeleteButtonController.cpp | 10 +-
WebCore/html/CanvasPattern.cpp | 165 +-------------------
WebCore/html/CanvasPattern.h | 58 +------
WebCore/html/CanvasRenderingContext2D.cpp | 116 ++++-----------
WebCore/html/CanvasRenderingContext2D.h | 4 +-
WebCore/html/CanvasStyle.cpp | 165 ++++----------------
WebCore/html/HTMLCanvasElement.cpp | 44 -----
WebCore/html/HTMLCanvasElement.h | 24 +---
WebCore/loader/CachedImage.cpp | 24 ++--
WebCore/loader/CachedImage.h | 2 +-
WebCore/loader/FrameLoader.cpp | 6 +-
WebCore/loader/icon/IconRecord.cpp | 6 +-
WebCore/loader/icon/IconRecord.h | 2 +-
WebCore/platform/graphics/BitmapImage.h | 17 ++-
WebCore/platform/graphics/Color.cpp | 10 ++
WebCore/platform/graphics/Color.h | 5 +
WebCore/platform/graphics/GeneratedImage.h | 4 +
WebCore/platform/graphics/Gradient.cpp | 2 +-
WebCore/platform/graphics/Gradient.h | 5 -
WebCore/platform/graphics/GraphicsContext.h | 6 +-
WebCore/platform/graphics/Image.cpp | 7 +
WebCore/platform/graphics/Image.h | 20 ++--
WebCore/platform/graphics/ImageBuffer.h | 39 +-----
WebCore/platform/graphics/Pattern.cpp | 46 ++++++
WebCore/platform/graphics/Pattern.h | 63 ++++++++
.../graphics/cairo/GraphicsContextCairo.cpp | 17 ++
.../platform/graphics/cairo/ImageBufferCairo.cpp | 8 +-
WebCore/platform/graphics/cairo/PatternCairo.cpp | 46 ++++++
WebCore/platform/graphics/cg/GraphicsContextCG.cpp | 33 ++++-
WebCore/platform/graphics/cg/ImageBufferCG.cpp | 8 +-
WebCore/platform/graphics/cg/PDFDocumentImage.h | 11 ++-
WebCore/platform/graphics/cg/PatternCG.cpp | 77 +++++++++
WebCore/platform/graphics/mac/ImageMac.mm | 12 +-
WebCore/rendering/RenderImage.cpp | 3 +-
WebCore/rendering/RenderLayer.cpp | 4 +-
WebCore/svg/graphics/SVGImage.cpp | 11 +--
WebCore/svg/graphics/SVGImage.h | 11 ++-
.../svg/graphics/cg/SVGPaintServerPatternCg.cpp | 2 +-
WebCore/svg/graphics/cg/SVGResourceMaskerCg.mm | 2 +-
40 files changed, 490 insertions(+), 624 deletions(-)
Created attachment 22756 [details]
Fifth pass, try to fix the non-mac builds
WebCore/GNUmakefile.am | 3 +
WebCore/WebCore.pro | 2 +
WebCore/WebCore.vcproj/WebCore.vcproj | 28 ++++
WebCore/WebCore.xcodeproj/project.pbxproj | 19 ++-
WebCore/WebCoreSources.bkl | 1 +
WebCore/editing/DeleteButtonController.cpp | 10 +-
WebCore/html/CanvasPattern.cpp | 156 +------------------
WebCore/html/CanvasPattern.h | 58 +------
WebCore/html/CanvasRenderingContext2D.cpp | 116 ++++-----------
WebCore/html/CanvasRenderingContext2D.h | 4 +-
WebCore/html/CanvasStyle.cpp | 165 ++++----------------
WebCore/html/HTMLCanvasElement.cpp | 44 -----
WebCore/html/HTMLCanvasElement.h | 24 +---
WebCore/loader/CachedImage.cpp | 24 ++--
WebCore/loader/CachedImage.h | 2 +-
WebCore/loader/FrameLoader.cpp | 6 +-
WebCore/loader/icon/IconRecord.cpp | 6 +-
WebCore/loader/icon/IconRecord.h | 2 +-
WebCore/platform/graphics/BitmapImage.h | 17 ++-
WebCore/platform/graphics/Color.cpp | 10 ++
WebCore/platform/graphics/Color.h | 5 +
WebCore/platform/graphics/GeneratedImage.h | 4 +
WebCore/platform/graphics/Gradient.cpp | 2 +-
WebCore/platform/graphics/Gradient.h | 5 -
WebCore/platform/graphics/GraphicsContext.h | 6 +-
WebCore/platform/graphics/Image.cpp | 7 +
WebCore/platform/graphics/Image.h | 20 ++--
WebCore/platform/graphics/ImageBuffer.h | 39 +-----
WebCore/platform/graphics/Pattern.cpp | 46 ++++++
WebCore/platform/graphics/Pattern.h | 66 ++++++++
.../graphics/cairo/GraphicsContextCairo.cpp | 17 ++
.../platform/graphics/cairo/ImageBufferCairo.cpp | 8 +-
WebCore/platform/graphics/cairo/PatternCairo.cpp | 46 ++++++
WebCore/platform/graphics/cg/GraphicsContextCG.cpp | 33 ++++-
WebCore/platform/graphics/cg/ImageBufferCG.cpp | 8 +-
WebCore/platform/graphics/cg/PDFDocumentImage.h | 11 ++-
WebCore/platform/graphics/cg/PatternCG.cpp | 77 +++++++++
WebCore/platform/graphics/gtk/ImageGtk.cpp | 9 +-
WebCore/platform/graphics/mac/ImageMac.mm | 12 +-
WebCore/platform/graphics/qt/PatternQt.cpp | 41 +++++
WebCore/rendering/RenderImage.cpp | 3 +-
WebCore/rendering/RenderLayer.cpp | 4 +-
WebCore/svg/graphics/SVGImage.cpp | 11 +--
WebCore/svg/graphics/SVGImage.h | 11 ++-
.../graphics/cairo/SVGPaintServerPatternCairo.cpp | 4 +-
.../svg/graphics/cairo/SVGResourceMaskerCairo.cpp | 8 +-
.../svg/graphics/cg/SVGPaintServerPatternCg.cpp | 2 +-
WebCore/svg/graphics/cg/SVGResourceMaskerCg.mm | 2 +-
48 files changed, 579 insertions(+), 625 deletions(-)
Created attachment 22760 [details]
Fifth pass, try to fix the non-mac builds
WebCore/GNUmakefile.am | 3 +
WebCore/WebCore.pro | 2 +
WebCore/WebCore.vcproj/WebCore.vcproj | 28 ++++
WebCore/WebCore.xcodeproj/project.pbxproj | 19 ++-
WebCore/WebCoreSources.bkl | 1 +
WebCore/editing/DeleteButtonController.cpp | 10 +-
WebCore/html/CanvasPattern.cpp | 156 +------------------
WebCore/html/CanvasPattern.h | 58 +------
WebCore/html/CanvasRenderingContext2D.cpp | 113 +++-----------
WebCore/html/CanvasRenderingContext2D.h | 4 +-
WebCore/html/CanvasStyle.cpp | 165 ++++----------------
WebCore/html/HTMLCanvasElement.cpp | 44 -----
WebCore/html/HTMLCanvasElement.h | 24 +---
WebCore/loader/CachedImage.cpp | 24 ++--
WebCore/loader/CachedImage.h | 2 +-
WebCore/loader/FrameLoader.cpp | 6 +-
WebCore/loader/icon/IconRecord.cpp | 6 +-
WebCore/loader/icon/IconRecord.h | 2 +-
WebCore/platform/graphics/BitmapImage.h | 17 ++-
WebCore/platform/graphics/Color.cpp | 10 ++
WebCore/platform/graphics/Color.h | 5 +
WebCore/platform/graphics/GeneratedImage.h | 4 +
WebCore/platform/graphics/Gradient.cpp | 2 +-
WebCore/platform/graphics/Gradient.h | 5 -
WebCore/platform/graphics/GraphicsContext.h | 6 +-
WebCore/platform/graphics/Image.cpp | 7 +
WebCore/platform/graphics/Image.h | 20 ++--
WebCore/platform/graphics/ImageBuffer.h | 39 +-----
WebCore/platform/graphics/Pattern.cpp | 46 ++++++
WebCore/platform/graphics/Pattern.h | 66 ++++++++
.../graphics/cairo/GraphicsContextCairo.cpp | 17 ++
.../platform/graphics/cairo/ImageBufferCairo.cpp | 8 +-
WebCore/platform/graphics/cairo/PatternCairo.cpp | 46 ++++++
WebCore/platform/graphics/cg/GraphicsContextCG.cpp | 33 ++++-
WebCore/platform/graphics/cg/ImageBufferCG.cpp | 8 +-
WebCore/platform/graphics/cg/PDFDocumentImage.h | 11 ++-
WebCore/platform/graphics/cg/PatternCG.cpp | 77 +++++++++
WebCore/platform/graphics/gtk/ImageGtk.cpp | 9 +-
WebCore/platform/graphics/mac/ImageMac.mm | 12 +-
WebCore/platform/graphics/qt/PatternQt.cpp | 41 +++++
WebCore/rendering/RenderImage.cpp | 3 +-
WebCore/rendering/RenderLayer.cpp | 4 +-
WebCore/svg/graphics/SVGImage.cpp | 11 +--
WebCore/svg/graphics/SVGImage.h | 11 ++-
.../graphics/cairo/SVGPaintServerPatternCairo.cpp | 4 +-
.../svg/graphics/cairo/SVGResourceMaskerCairo.cpp | 8 +-
.../svg/graphics/cg/SVGPaintServerPatternCg.cpp | 2 +-
WebCore/svg/graphics/cg/SVGResourceMaskerCg.mm | 2 +-
48 files changed, 575 insertions(+), 626 deletions(-)
Created attachment 22761 [details]
Split out HTML5 functional change into separate change
.../canvas-pattern-from-incremental-image.html | 19 +++++++++++++++++++
.../http/tests/misc/resources/image-slow.pl | 19 +++++++++++++++++++
WebCore/html/CanvasRenderingContext2D.cpp | 5 +++++
3 files changed, 43 insertions(+), 0 deletions(-)
Ok. Sam finally guilt-tripped me into it. I've split this big honken patch into 4 separate smaller commits. None of them have ChangeLogs yet, but I'll add those when I land. A test case was added for the one commit which needed one. There is no way to test the loss of more-than-32-bit color support on the Mac which is caused by my Color refactor. Hyatt and I agreed that it wasn't important to maintain support for float colors (and no other platform had support). If we decide it's required in the future, we'll add a FloatColor class or similar. Created attachment 22762 [details]
Split out Color changes into separate commit
WebCore/html/CanvasStyle.cpp | 165 +++++++----------------------------
WebCore/platform/graphics/Color.cpp | 10 ++
WebCore/platform/graphics/Color.h | 5 +
3 files changed, 48 insertions(+), 132 deletions(-)
Created attachment 22763 [details]
Split out Image cleanup into separate commit
WebCore/editing/DeleteButtonController.cpp | 10 ++---
WebCore/loader/CachedImage.cpp | 24 ++++++-------
WebCore/loader/CachedImage.h | 2 +-
WebCore/loader/icon/IconRecord.cpp | 6 ++--
WebCore/loader/icon/IconRecord.h | 2 +-
WebCore/platform/graphics/BitmapImage.h | 17 ++++++---
WebCore/platform/graphics/GeneratedImage.h | 4 ++
WebCore/platform/graphics/Gradient.cpp | 2 +-
WebCore/platform/graphics/Gradient.h | 5 ---
WebCore/platform/graphics/Image.cpp | 7 ++++
WebCore/platform/graphics/Image.h | 20 +++++-----
WebCore/platform/graphics/ImageBuffer.h | 39 ++------------------
.../platform/graphics/cairo/ImageBufferCairo.cpp | 8 +---
WebCore/platform/graphics/cg/ImageBufferCG.cpp | 8 ++---
WebCore/platform/graphics/cg/PDFDocumentImage.h | 11 +++++-
WebCore/platform/graphics/gtk/ImageGtk.cpp | 9 ++---
WebCore/platform/graphics/mac/ImageMac.mm | 12 +++----
WebCore/rendering/RenderImage.cpp | 3 +-
WebCore/rendering/RenderLayer.cpp | 4 +-
WebCore/svg/graphics/SVGImage.cpp | 11 +-----
WebCore/svg/graphics/SVGImage.h | 11 +++++-
.../graphics/cairo/SVGPaintServerPatternCairo.cpp | 4 ++-
.../svg/graphics/cairo/SVGResourceMaskerCairo.cpp | 8 ++++-
.../svg/graphics/cg/SVGPaintServerPatternCg.cpp | 2 +-
WebCore/svg/graphics/cg/SVGResourceMaskerCg.mm | 2 +-
25 files changed, 106 insertions(+), 125 deletions(-)
Created attachment 22764 [details]
The final changes needed for Pattern cleanup
WebCore/GNUmakefile.am | 3 +
WebCore/WebCore.pro | 2 +
WebCore/WebCore.vcproj/WebCore.vcproj | 28 ++++
WebCore/WebCore.xcodeproj/project.pbxproj | 19 ++-
WebCore/WebCoreSources.bkl | 1 +
WebCore/html/CanvasPattern.cpp | 156 +-------------------
WebCore/html/CanvasPattern.h | 58 +-------
WebCore/html/CanvasRenderingContext2D.cpp | 113 +++-----------
WebCore/html/CanvasRenderingContext2D.h | 4 +-
WebCore/html/HTMLCanvasElement.cpp | 44 ------
WebCore/html/HTMLCanvasElement.h | 24 +---
WebCore/loader/FrameLoader.cpp | 6 +-
WebCore/platform/graphics/GraphicsContext.h | 6 +-
.../graphics/cairo/GraphicsContextCairo.cpp | 17 ++
WebCore/platform/graphics/cg/GraphicsContextCG.cpp | 33 ++++-
15 files changed, 145 insertions(+), 369 deletions(-)
Created attachment 22765 [details]
Split out HTML5 functional change into separate change
.../canvas-pattern-from-incremental-image.html | 18 ++++++++++++++++++
.../http/tests/misc/resources/image-slow.pl | 19 +++++++++++++++++++
WebCore/html/CanvasRenderingContext2D.cpp | 5 +++++
3 files changed, 42 insertions(+), 0 deletions(-)
Comment on attachment 22765 [details]
Split out HTML5 functional change into separate change
Needs expected results and a changelog.
Comment on attachment 22764 [details]
The final changes needed for Pattern cleanup
Nice work Eric! Some comments:
No ChangeLog?
FrameLoader.cpp - change looks unrelated (style cleanup)
PatternQt.cpp missing (would break Qt build)
Other than that, r=me.
Comment on attachment 22762 [details]
Split out Color changes into separate commit
In the color code, we usually use nextafterf(256.0f, 0.0f); to conver from float to byte.
Comment on attachment 22763 [details]
Split out Image cleanup into separate commit
Looks nice. r=me
Created attachment 22799 [details]
Move us one step closer to cross-platform svg/graphics code
WebCore/WebCore.xcodeproj/project.pbxproj | 3 --
WebCore/html/CanvasStyle.cpp | 7 -----
WebCore/platform/graphics/Color.cpp | 7 +++++
WebCore/platform/graphics/Color.h | 2 +-
WebCore/svg/graphics/cg/CgSupport.cpp | 7 +++--
WebCore/svg/graphics/cg/SVGPaintServerSolidCg.cpp | 27 ++++++++++-----------
6 files changed, 25 insertions(+), 28 deletions(-)
Comment on attachment 22799 [details]
Move us one step closer to cross-platform svg/graphics code
wrong bug.
|