Bug 20351 - <canvas> code needs fewer #ifdefs
Summary: <canvas> code needs fewer #ifdefs
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-11 17:20 PDT by Eric Seidel (no email)
Modified: 2008-08-14 15:47 PDT (History)
2 users (show)

See Also:


Attachments
First pass at refactoring Pattern (75.24 KB, patch)
2008-08-11 17:29 PDT, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff
First pass at refactoring Pattern (74.89 KB, patch)
2008-08-11 18:10 PDT, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff
Third pass, now fixing Cairo build issues. (75.21 KB, patch)
2008-08-12 12:50 PDT, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff
Fourth pass, fixing a bogus ASSERT, color float conversions, and more Cairo build issues. (76.50 KB, patch)
2008-08-12 13:53 PDT, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff
Fifth pass, try to fix the non-mac builds (84.44 KB, patch)
2008-08-12 15:11 PDT, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff
Fifth pass, try to fix the non-mac builds (84.39 KB, patch)
2008-08-12 17:41 PDT, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff
Split out HTML5 functional change into separate change (2.04 KB, patch)
2008-08-12 17:41 PDT, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff
Split out Color changes into separate commit (10.60 KB, patch)
2008-08-12 18:13 PDT, Eric Seidel (no email)
zimmermann: review+
Details | Formatted Diff | Diff
Split out Image cleanup into separate commit (25.63 KB, patch)
2008-08-12 18:13 PDT, Eric Seidel (no email)
zimmermann: review+
Details | Formatted Diff | Diff
The final changes needed for Pattern cleanup (36.43 KB, patch)
2008-08-12 18:13 PDT, Eric Seidel (no email)
zimmermann: review+
Details | Formatted Diff | Diff
Split out HTML5 functional change into separate change (2.03 KB, patch)
2008-08-12 18:13 PDT, Eric Seidel (no email)
sam: review+
Details | Formatted Diff | Diff
Move us one step closer to cross-platform svg/graphics code (6.69 KB, patch)
2008-08-14 15:44 PDT, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2008-08-11 17:20:51 PDT
<canvas> code needs fewer #ifdefs

I guess my first attempt will be to abstract out the Pattern stuff a bit more.
Comment 1 Eric Seidel (no email) 2008-08-11 17:29:22 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(-)
Comment 2 Eric Seidel (no email) 2008-08-11 17:32:57 PDT
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.
Comment 3 Eric Seidel (no email) 2008-08-11 18:10:10 PDT
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(-)
Comment 4 Eric Seidel (no email) 2008-08-12 12:50:25 PDT
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(-)
Comment 5 Eric Seidel (no email) 2008-08-12 13:53:30 PDT
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(-)
Comment 6 Eric Seidel (no email) 2008-08-12 15:11:17 PDT
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(-)
Comment 7 Eric Seidel (no email) 2008-08-12 17:41:35 PDT
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(-)
Comment 8 Eric Seidel (no email) 2008-08-12 17:41:37 PDT
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(-)
Comment 9 Eric Seidel (no email) 2008-08-12 18:12:38 PDT
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.
Comment 10 Eric Seidel (no email) 2008-08-12 18:13:08 PDT
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(-)
Comment 11 Eric Seidel (no email) 2008-08-12 18:13:12 PDT
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(-)
Comment 12 Eric Seidel (no email) 2008-08-12 18:13:15 PDT
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(-)
Comment 13 Eric Seidel (no email) 2008-08-12 18:13:17 PDT
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 14 Sam Weinig 2008-08-13 14:42:56 PDT
Comment on attachment 22765 [details]
Split out HTML5 functional change into separate change

Needs expected results and a changelog.
Comment 15 Nikolas Zimmermann 2008-08-13 15:06:50 PDT
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 16 Sam Weinig 2008-08-13 15:11:11 PDT
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 17 Nikolas Zimmermann 2008-08-13 15:11:56 PDT
Comment on attachment 22763 [details]
Split out Image cleanup into separate commit

Looks nice. r=me
Comment 18 Eric Seidel (no email) 2008-08-14 15:44:34 PDT
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 19 Eric Seidel (no email) 2008-08-14 15:47:57 PDT
Comment on attachment 22799 [details]
Move us one step closer to cross-platform svg/graphics code

wrong bug.