Refactor Cairo and CoreGraphics to use platform ifdefs. This patch
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Aug 2006 00:02:51 +0000 (00:02 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Aug 2006 00:02:51 +0000 (00:02 +0000)
        separates the graphics engines from their respective platforms and replaces
        #ifdef PLATFORM(MAC) and PLATFORM(WIN) with PLATFORM(CG) and PLATFORM(CAIRO).

        Reviewed by darin

        * WebCore.xcodeproj/project.pbxproj:
        * platform/AffineTransform.h:
        * platform/Color.h:
        * platform/Cursor.h:
        * platform/FloatPoint.h:
        * platform/FloatRect.h:
        * platform/FloatSize.h:
        * platform/Font.h:
        * platform/FontData.h:
        * platform/GlyphBuffer.h:
        (WebCore::GlyphBuffer::glyphAt):
        (WebCore::GlyphBuffer::advanceAt):
        (WebCore::GlyphBuffer::add):
        * platform/GraphicsContext.h:
        * platform/Image.h:
        * platform/ImageSource.h:
        * platform/IntPoint.h:
        * platform/IntRect.h:
        * platform/IntSize.h:
        * platform/ResourceLoader.h:
        * platform/ResourceLoaderClient.h:
        * platform/Widget.h:
        * platform/cairo/GraphicsContextCairo.cpp:
        * platform/cairo/ImageCairo.cpp:
        * platform/cairo/ImageSourceCairo.cpp:
        * platform/cg/AffineTransformCG.cpp:
        * platform/cg/FloatPointCG.cpp: Added.
        * platform/cg/FloatRectCG.cpp: Added.
        * platform/cg/FloatSizeCG.cpp: Added.
        * platform/cg/GraphicsContextCG.cpp:
        (WebCore::GraphicsContext::GraphicsContext):
        (WebCore::GraphicsContext::~GraphicsContext):
        (WebCore::GraphicsContext::setFocusRingClip):
        (WebCore::GraphicsContext::clearFocusRingClip):
        (WebCore::GraphicsContext::platformContext):
        (WebCore::GraphicsContext::drawRect):
        (WebCore::GraphicsContext::drawLine):
        * platform/cg/GraphicsContextPlatformPrivate.h: Added.
        (WebCore::GraphicsContextPlatformPrivate:::m_cgContext):
        (WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate):
        * platform/cg/ImageCG.cpp: Added.
        (WebCore::Image::drawTiled):
        * platform/cg/ImageSourceCG.cpp: Added.
        * platform/cg/IntPointCG.cpp: Added.
        * platform/cg/IntRectCG.cpp: Added.
        * platform/cg/IntSizeCG.cpp: Added.
        * platform/cg/PDFDocumentImage.cpp: Added.
        (WebCore::PDFDocumentImage::adjustCTM):
        * platform/cg/PDFDocumentImage.h: Added.
        * platform/cg/PathCG.cpp:
        * platform/image-decoders/bmp/BMPImageDecoder.cpp:
        * platform/image-decoders/gif/GIFImageDecoder.cpp:
        * platform/image-decoders/gif/GIFImageReader.cpp:
        * platform/image-decoders/ico/ICOImageDecoder.cpp:
        * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
        * platform/image-decoders/png/PNGImageDecoder.cpp:
        * platform/image-decoders/xbm/XBMImageDecoder.cpp:
        * platform/mac/FloatPointMac.mm:
        * platform/mac/FloatRectMac.mm:
        * platform/mac/FloatSizeMac.mm:
        * platform/mac/GraphicsContextMac.mm:
        * platform/mac/ImageMac.mm:
        * platform/mac/ImageSourceMac.cpp: Removed.
        * platform/mac/IntPointMac.mm:
        * platform/mac/IntRectMac.mm:
        * platform/mac/IntSizeMac.mm:
        * platform/mac/PDFDocumentImage.h: Removed.
        * platform/mac/PDFDocumentImage.mm: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15999 268f45cc-cd09-0410-ab3c-d52691b4dbfc

52 files changed:
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/platform/AffineTransform.h
WebCore/platform/Color.h
WebCore/platform/Cursor.h
WebCore/platform/FloatPoint.h
WebCore/platform/FloatRect.h
WebCore/platform/FloatSize.h
WebCore/platform/Font.h
WebCore/platform/FontData.h
WebCore/platform/GlyphBuffer.h
WebCore/platform/GraphicsContext.h
WebCore/platform/Image.h
WebCore/platform/ImageSource.h
WebCore/platform/IntPoint.h
WebCore/platform/IntRect.h
WebCore/platform/IntSize.h
WebCore/platform/ResourceLoader.h
WebCore/platform/ResourceLoaderClient.h
WebCore/platform/Widget.h
WebCore/platform/cairo/GraphicsContextCairo.cpp
WebCore/platform/cairo/ImageCairo.cpp
WebCore/platform/cairo/ImageSourceCairo.cpp
WebCore/platform/cg/AffineTransformCG.cpp
WebCore/platform/cg/FloatPointCG.cpp [new file with mode: 0644]
WebCore/platform/cg/FloatRectCG.cpp [new file with mode: 0644]
WebCore/platform/cg/FloatSizeCG.cpp [new file with mode: 0644]
WebCore/platform/cg/GraphicsContextCG.cpp
WebCore/platform/cg/GraphicsContextPlatformPrivate.h [new file with mode: 0644]
WebCore/platform/cg/ImageCG.cpp [new file with mode: 0644]
WebCore/platform/cg/ImageSourceCG.cpp [moved from WebCore/platform/mac/ImageSourceMac.cpp with 98% similarity]
WebCore/platform/cg/IntPointCG.cpp [new file with mode: 0644]
WebCore/platform/cg/IntRectCG.cpp [new file with mode: 0644]
WebCore/platform/cg/IntSizeCG.cpp [new file with mode: 0644]
WebCore/platform/cg/PDFDocumentImage.cpp [moved from WebCore/platform/mac/PDFDocumentImage.mm with 95% similarity]
WebCore/platform/cg/PDFDocumentImage.h [moved from WebCore/platform/mac/PDFDocumentImage.h with 98% similarity]
WebCore/platform/cg/PathCG.cpp
WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp
WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp
WebCore/platform/image-decoders/gif/GIFImageReader.cpp
WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp
WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
WebCore/platform/image-decoders/png/PNGImageDecoder.cpp
WebCore/platform/image-decoders/xbm/XBMImageDecoder.cpp
WebCore/platform/mac/FloatPointMac.mm
WebCore/platform/mac/FloatRectMac.mm
WebCore/platform/mac/FloatSizeMac.mm
WebCore/platform/mac/GraphicsContextMac.mm
WebCore/platform/mac/ImageMac.mm
WebCore/platform/mac/IntPointMac.mm
WebCore/platform/mac/IntRectMac.mm
WebCore/platform/mac/IntSizeMac.mm

index 54b5bc14a5476acb93d4c251913826a4d4ab92df..528e532390871c39d744ebe8172ec70bacbab55e 100644 (file)
@@ -1,3 +1,80 @@
+2006-08-23  David Hyatt  <hyatt@apple.com>
+
+        Refactor Cairo and CoreGraphics to use platform ifdefs.  This patch
+        separates the graphics engines from their respective platforms and replaces
+        #ifdef PLATFORM(MAC) and PLATFORM(WIN) with PLATFORM(CG) and PLATFORM(CAIRO).
+
+        Reviewed by darin
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/AffineTransform.h:
+        * platform/Color.h:
+        * platform/Cursor.h:
+        * platform/FloatPoint.h:
+        * platform/FloatRect.h:
+        * platform/FloatSize.h:
+        * platform/Font.h:
+        * platform/FontData.h:
+        * platform/GlyphBuffer.h:
+        (WebCore::GlyphBuffer::glyphAt):
+        (WebCore::GlyphBuffer::advanceAt):
+        (WebCore::GlyphBuffer::add):
+        * platform/GraphicsContext.h:
+        * platform/Image.h:
+        * platform/ImageSource.h:
+        * platform/IntPoint.h:
+        * platform/IntRect.h:
+        * platform/IntSize.h:
+        * platform/ResourceLoader.h:
+        * platform/ResourceLoaderClient.h:
+        * platform/Widget.h:
+        * platform/cairo/GraphicsContextCairo.cpp:
+        * platform/cairo/ImageCairo.cpp:
+        * platform/cairo/ImageSourceCairo.cpp:
+        * platform/cg/AffineTransformCG.cpp:
+        * platform/cg/FloatPointCG.cpp: Added.
+        * platform/cg/FloatRectCG.cpp: Added.
+        * platform/cg/FloatSizeCG.cpp: Added.
+        * platform/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::GraphicsContext):
+        (WebCore::GraphicsContext::~GraphicsContext):
+        (WebCore::GraphicsContext::setFocusRingClip):
+        (WebCore::GraphicsContext::clearFocusRingClip):
+        (WebCore::GraphicsContext::platformContext):
+        (WebCore::GraphicsContext::drawRect):
+        (WebCore::GraphicsContext::drawLine):
+        * platform/cg/GraphicsContextPlatformPrivate.h: Added.
+        (WebCore::GraphicsContextPlatformPrivate:::m_cgContext):
+        (WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate):
+        * platform/cg/ImageCG.cpp: Added.
+        (WebCore::Image::drawTiled):
+        * platform/cg/ImageSourceCG.cpp: Added.
+        * platform/cg/IntPointCG.cpp: Added.
+        * platform/cg/IntRectCG.cpp: Added.
+        * platform/cg/IntSizeCG.cpp: Added.
+        * platform/cg/PDFDocumentImage.cpp: Added.
+        (WebCore::PDFDocumentImage::adjustCTM):
+        * platform/cg/PDFDocumentImage.h: Added.
+        * platform/cg/PathCG.cpp:
+        * platform/image-decoders/bmp/BMPImageDecoder.cpp:
+        * platform/image-decoders/gif/GIFImageDecoder.cpp:
+        * platform/image-decoders/gif/GIFImageReader.cpp:
+        * platform/image-decoders/ico/ICOImageDecoder.cpp:
+        * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
+        * platform/image-decoders/png/PNGImageDecoder.cpp:
+        * platform/image-decoders/xbm/XBMImageDecoder.cpp:
+        * platform/mac/FloatPointMac.mm:
+        * platform/mac/FloatRectMac.mm:
+        * platform/mac/FloatSizeMac.mm:
+        * platform/mac/GraphicsContextMac.mm:
+        * platform/mac/ImageMac.mm:
+        * platform/mac/ImageSourceMac.cpp: Removed.
+        * platform/mac/IntPointMac.mm:
+        * platform/mac/IntRectMac.mm:
+        * platform/mac/IntSizeMac.mm:
+        * platform/mac/PDFDocumentImage.h: Removed.
+        * platform/mac/PDFDocumentImage.mm: Removed.
+
 2006-08-23  David Hyatt  <hyatt@apple.com>
 
         Remove the ifdef for platform scrollbars vs. engine scrollbars until
index 2b820038d7baf1cd2e594e9f24d7959519689707..34b916696bd9e9bcb97f679411150477eba2e8de 100644 (file)
                6582A15909999D6D00BEEB6D /* FloatRectMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6582A14B09999D6C00BEEB6D /* FloatRectMac.mm */; };
                6582A15A09999D6D00BEEB6D /* FloatSizeMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6582A14C09999D6C00BEEB6D /* FloatSizeMac.mm */; };
                6582A15B09999D6D00BEEB6D /* ImageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6582A14D09999D6C00BEEB6D /* ImageMac.mm */; };
-               6582A15C09999D6D00BEEB6D /* ImageSourceMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6582A14E09999D6D00BEEB6D /* ImageSourceMac.cpp */; };
                6582A15D09999D6D00BEEB6D /* IntPointMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6582A14F09999D6D00BEEB6D /* IntPointMac.mm */; };
                6582A15E09999D6D00BEEB6D /* IntRectMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6582A15009999D6D00BEEB6D /* IntRectMac.mm */; };
                6582A15F09999D6D00BEEB6D /* IntSizeMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6582A15109999D6D00BEEB6D /* IntSizeMac.mm */; };
-               6582A16009999D6D00BEEB6D /* PDFDocumentImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 6582A15209999D6D00BEEB6D /* PDFDocumentImage.h */; };
-               6582A16109999D6D00BEEB6D /* PDFDocumentImage.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6582A15309999D6D00BEEB6D /* PDFDocumentImage.mm */; };
                6582A16209999D6D00BEEB6D /* ScreenMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6582A15409999D6D00BEEB6D /* ScreenMac.mm */; };
                6582A16309999D6D00BEEB6D /* SystemTimeMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6582A15509999D6D00BEEB6D /* SystemTimeMac.cpp */; };
                6582A17809999EA000BEEB6D /* DeprecatedStringMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6582A17709999EA000BEEB6D /* DeprecatedStringMac.mm */; };
                BC73E3190978AFFC00EDFF8A /* IntPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = BC73E3180978AFFB00EDFF8A /* IntPoint.h */; };
                BC73E3920978CED700EDFF8A /* FloatPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC73E3900978CED700EDFF8A /* FloatPoint.cpp */; };
                BC73E3930978CED700EDFF8A /* FloatPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = BC73E3910978CED700EDFF8A /* FloatPoint.h */; };
+               BC837C720A9D0D1A006B186A /* FloatPointCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC837C670A9D0D1A006B186A /* FloatPointCG.cpp */; };
+               BC837C730A9D0D1A006B186A /* FloatRectCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC837C680A9D0D1A006B186A /* FloatRectCG.cpp */; };
+               BC837C740A9D0D1A006B186A /* FloatSizeCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC837C690A9D0D1A006B186A /* FloatSizeCG.cpp */; };
+               BC837C750A9D0D1A006B186A /* ImageCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC837C6A0A9D0D1A006B186A /* ImageCG.cpp */; };
+               BC837C760A9D0D1A006B186A /* ImageCG.cpp.orig in Resources */ = {isa = PBXBuildFile; fileRef = BC837C6B0A9D0D1A006B186A /* ImageCG.cpp.orig */; };
+               BC837C770A9D0D1A006B186A /* ImageSourceCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC837C6C0A9D0D1A006B186A /* ImageSourceCG.cpp */; };
+               BC837C780A9D0D1A006B186A /* IntPointCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC837C6D0A9D0D1A006B186A /* IntPointCG.cpp */; };
+               BC837C790A9D0D1A006B186A /* IntRectCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC837C6E0A9D0D1A006B186A /* IntRectCG.cpp */; };
+               BC837C7A0A9D0D1A006B186A /* IntSizeCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC837C6F0A9D0D1A006B186A /* IntSizeCG.cpp */; };
+               BC837C7B0A9D0D1A006B186A /* PDFDocumentImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC837C700A9D0D1A006B186A /* PDFDocumentImage.cpp */; };
+               BC837C7C0A9D0D1A006B186A /* PDFDocumentImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BC837C710A9D0D1A006B186A /* PDFDocumentImage.h */; };
+               BC837CB60A9D10FE006B186A /* GraphicsContextPlatformPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC837CB50A9D10FE006B186A /* GraphicsContextPlatformPrivate.h */; };
                BC92F1DD0A40AEA300AC0746 /* DeprecatedSlider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC92F1DB0A40AEA300AC0746 /* DeprecatedSlider.cpp */; };
                BC92F1DE0A40AEA300AC0746 /* DeprecatedSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = BC92F1DC0A40AEA300AC0746 /* DeprecatedSlider.h */; };
                BC9C328B09933A6E001D6924 /* ImageAnimationObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9C328A09933A6D001D6924 /* ImageAnimationObserver.h */; };
                FAE04190097596C9000540BE /* SVGImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = FAE0418E097596C9000540BE /* SVGImageLoader.h */; };
 /* End PBXBuildFile section */
 
+/* Begin PBXBuildStyle section */
+               BC837C570A9D0AA0006B186A /* Development */ = {
+                       isa = PBXBuildStyle;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                       };
+                       name = Development;
+               };
+               BC837C580A9D0AA0006B186A /* Deployment */ = {
+                       isa = PBXBuildStyle;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                       };
+                       name = Deployment;
+               };
+/* End PBXBuildStyle section */
+
 /* Begin PBXContainerItemProxy section */
                DD041FF009D9E3250010AF2A /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                6582A14B09999D6C00BEEB6D /* FloatRectMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = FloatRectMac.mm; sourceTree = "<group>"; };
                6582A14C09999D6C00BEEB6D /* FloatSizeMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = FloatSizeMac.mm; sourceTree = "<group>"; };
                6582A14D09999D6C00BEEB6D /* ImageMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ImageMac.mm; sourceTree = "<group>"; };
-               6582A14E09999D6D00BEEB6D /* ImageSourceMac.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ImageSourceMac.cpp; sourceTree = "<group>"; };
                6582A14F09999D6D00BEEB6D /* IntPointMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = IntPointMac.mm; sourceTree = "<group>"; };
                6582A15009999D6D00BEEB6D /* IntRectMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = IntRectMac.mm; sourceTree = "<group>"; };
                6582A15109999D6D00BEEB6D /* IntSizeMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = IntSizeMac.mm; sourceTree = "<group>"; };
-               6582A15209999D6D00BEEB6D /* PDFDocumentImage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PDFDocumentImage.h; sourceTree = "<group>"; };
-               6582A15309999D6D00BEEB6D /* PDFDocumentImage.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = PDFDocumentImage.mm; sourceTree = "<group>"; };
                6582A15409999D6D00BEEB6D /* ScreenMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ScreenMac.mm; sourceTree = "<group>"; };
                6582A15509999D6D00BEEB6D /* SystemTimeMac.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SystemTimeMac.cpp; sourceTree = "<group>"; };
                6582A17709999EA000BEEB6D /* DeprecatedStringMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DeprecatedStringMac.mm; sourceTree = "<group>"; };
                BC73E3910978CED700EDFF8A /* FloatPoint.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FloatPoint.h; sourceTree = "<group>"; };
                BC7B2AF80450824100A8000F /* ScrollBar.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = ScrollBar.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BC7B2AF90450824100A8000F /* PlatformScrollBarMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformScrollBarMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               BC837C670A9D0D1A006B186A /* FloatPointCG.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FloatPointCG.cpp; sourceTree = "<group>"; };
+               BC837C680A9D0D1A006B186A /* FloatRectCG.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FloatRectCG.cpp; sourceTree = "<group>"; };
+               BC837C690A9D0D1A006B186A /* FloatSizeCG.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FloatSizeCG.cpp; sourceTree = "<group>"; };
+               BC837C6A0A9D0D1A006B186A /* ImageCG.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ImageCG.cpp; sourceTree = "<group>"; };
+               BC837C6B0A9D0D1A006B186A /* ImageCG.cpp.orig */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ImageCG.cpp.orig; sourceTree = "<group>"; };
+               BC837C6C0A9D0D1A006B186A /* ImageSourceCG.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ImageSourceCG.cpp; sourceTree = "<group>"; };
+               BC837C6D0A9D0D1A006B186A /* IntPointCG.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IntPointCG.cpp; sourceTree = "<group>"; };
+               BC837C6E0A9D0D1A006B186A /* IntRectCG.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IntRectCG.cpp; sourceTree = "<group>"; };
+               BC837C6F0A9D0D1A006B186A /* IntSizeCG.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IntSizeCG.cpp; sourceTree = "<group>"; };
+               BC837C700A9D0D1A006B186A /* PDFDocumentImage.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PDFDocumentImage.cpp; sourceTree = "<group>"; };
+               BC837C710A9D0D1A006B186A /* PDFDocumentImage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PDFDocumentImage.h; sourceTree = "<group>"; };
+               BC837CB50A9D10FE006B186A /* GraphicsContextPlatformPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GraphicsContextPlatformPrivate.h; sourceTree = "<group>"; };
                BC86FB8D061F5C23006BB822 /* Slider.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Slider.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BC86FB8E061F5C23006BB822 /* SliderMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SliderMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BC92F1DB0A40AEA300AC0746 /* DeprecatedSlider.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DeprecatedSlider.cpp; sourceTree = "<group>"; };
                                BC6DB4D30A1AFEEF00E5CD14 /* GlyphMapMac.cpp */,
                                935367E809AF77EF00D35CD6 /* GraphicsContextMac.mm */,
                                6582A14D09999D6C00BEEB6D /* ImageMac.mm */,
-                               6582A14E09999D6D00BEEB6D /* ImageSourceMac.cpp */,
                                6582A14F09999D6D00BEEB6D /* IntPointMac.mm */,
                                6582A15009999D6D00BEEB6D /* IntRectMac.mm */,
                                6582A15109999D6D00BEEB6D /* IntSizeMac.mm */,
                                F587851402DE375901EA4122 /* ListBoxMac.mm */,
                                935207BF09BD412000F2038D /* LocalizedStringsMac.mm */,
                                65F5382409B2B57500F3DC4A /* mac-encodings.txt */,
-                               6582A15209999D6D00BEEB6D /* PDFDocumentImage.h */,
-                               6582A15309999D6D00BEEB6D /* PDFDocumentImage.mm */,
                                935C476F09AC4D7300A6AAB4 /* PlatformMouseEventMac.mm */,
                                A82398A709B3ACF500B60641 /* PlugInInfoStoreMac.mm */,
                                F58784D202DE375901EA4122 /* PopUpButtonMac.mm */,
                        isa = PBXGroup;
                        children = (
                                93CF35A90A6169F700543E52 /* AffineTransformCG.cpp */,
+                               BC837C670A9D0D1A006B186A /* FloatPointCG.cpp */,
+                               BC837C680A9D0D1A006B186A /* FloatRectCG.cpp */,
+                               BC837C690A9D0D1A006B186A /* FloatSizeCG.cpp */,
                                936BDD1C0A031AEB004DF4AB /* GraphicsContextCG.cpp */,
+                               BC837C6A0A9D0D1A006B186A /* ImageCG.cpp */,
+                               BC837C6B0A9D0D1A006B186A /* ImageCG.cpp.orig */,
+                               BC837C6C0A9D0D1A006B186A /* ImageSourceCG.cpp */,
+                               BC837C6D0A9D0D1A006B186A /* IntPointCG.cpp */,
+                               BC837C6E0A9D0D1A006B186A /* IntRectCG.cpp */,
+                               BC837C6F0A9D0D1A006B186A /* IntSizeCG.cpp */,
                                93032CC709AEC34300F82A18 /* PathCG.cpp */,
+                               BC837CB50A9D10FE006B186A /* GraphicsContextPlatformPrivate.h */,
+                               BC837C700A9D0D1A006B186A /* PDFDocumentImage.cpp */,
+                               BC837C710A9D0D1A006B186A /* PDFDocumentImage.h */,
                        );
                        path = cg;
                        sourceTree = "<group>";
                                93CD4FEC0995FD2A007ECC97 /* PlatformString.h in Headers */,
                                BC6B7ECF0998AC7F0052867B /* ImageSource.h in Headers */,
                                6582A14009999CD600BEEB6D /* DeprecatedString.h in Headers */,
-                               6582A16009999D6D00BEEB6D /* PDFDocumentImage.h in Headers */,
                                A7638A8B09958EA50007E14F /* WKDisplacementMapFilter.h in Headers */,
                                A7638A970995965D0007E14F /* SVGFEDisplacementMapElement.h in Headers */,
                                93309DD7099E64920056E581 /* AppendNodeCommand.h in Headers */,
                                657429170A9C2D0B00C52C97 /* IconDataCache.h in Headers */,
                                657429180A9C2D0B00C52C97 /* SQLStatement.h in Headers */,
                                657429190A9C2D0B00C52C97 /* SQLTransaction.h in Headers */,
+                               BC837C7C0A9D0D1A006B186A /* PDFDocumentImage.h in Headers */,
+                               BC837CB60A9D10FE006B186A /* GraphicsContextPlatformPrivate.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
+                       buildSettings = {
+                       };
+                       buildStyles = (
+                               BC837C570A9D0AA0006B186A /* Development */,
+                               BC837C580A9D0AA0006B186A /* Deployment */,
+                       );
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                                1CD441900A4CE76F00A007AB /* northWestSouthEastResizeCursor.tiff in Resources */,
                                1A750D880A90E394000FF215 /* NodeIterator.idl in Resources */,
                                5115095C0A9CE04700901013 /* urlIcon.tiff in Resources */,
+                               BC837C760A9D0D1A006B186A /* ImageCG.cpp.orig in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                6582A15909999D6D00BEEB6D /* FloatRectMac.mm in Sources */,
                                6582A15A09999D6D00BEEB6D /* FloatSizeMac.mm in Sources */,
                                6582A15B09999D6D00BEEB6D /* ImageMac.mm in Sources */,
-                               6582A15C09999D6D00BEEB6D /* ImageSourceMac.cpp in Sources */,
                                6582A15D09999D6D00BEEB6D /* IntPointMac.mm in Sources */,
                                6582A15E09999D6D00BEEB6D /* IntRectMac.mm in Sources */,
                                6582A15F09999D6D00BEEB6D /* IntSizeMac.mm in Sources */,
-                               6582A16109999D6D00BEEB6D /* PDFDocumentImage.mm in Sources */,
                                6582A16209999D6D00BEEB6D /* ScreenMac.mm in Sources */,
                                6582A16309999D6D00BEEB6D /* SystemTimeMac.cpp in Sources */,
                                6582A17809999EA000BEEB6D /* DeprecatedStringMac.mm in Sources */,
                                1A750DD40A90E729000FF215 /* JSNodeIteratorCustom.cpp in Sources */,
                                1A750E340A90F89F000FF215 /* JSTreeWalkerCustom.cpp in Sources */,
                                5186C0560A9C21470034FE94 /* IconDataCache.cpp in Sources */,
+                               BC837C720A9D0D1A006B186A /* FloatPointCG.cpp in Sources */,
+                               BC837C730A9D0D1A006B186A /* FloatRectCG.cpp in Sources */,
+                               BC837C740A9D0D1A006B186A /* FloatSizeCG.cpp in Sources */,
+                               BC837C750A9D0D1A006B186A /* ImageCG.cpp in Sources */,
+                               BC837C770A9D0D1A006B186A /* ImageSourceCG.cpp in Sources */,
+                               BC837C780A9D0D1A006B186A /* IntPointCG.cpp in Sources */,
+                               BC837C790A9D0D1A006B186A /* IntRectCG.cpp in Sources */,
+                               BC837C7A0A9D0D1A006B186A /* IntSizeCG.cpp in Sources */,
+                               BC837C7B0A9D0D1A006B186A /* PDFDocumentImage.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index ecf4e3a3428f0e4fb5b6e94db0c86d41a86a04b1..ec68cd53c8dd85ee638541b5bec6967c97ec2a1d 100644 (file)
@@ -26,7 +26,9 @@
 #ifndef AffineTransform_h
 #define AffineTransform_h
 
-#if __APPLE__
+#include "config.h"
+
+#if PLATFORM(CG)
 #include <ApplicationServices/ApplicationServices.h>
 #elif PLATFORM(QT)
 #include <QMatrix>
@@ -41,7 +43,7 @@ class AffineTransform {
 public:
     AffineTransform();
     AffineTransform(double a, double b, double c, double d, double tx, double ty);
-#if __APPLE__
+#if PLATFORM(CG)
     AffineTransform(CGAffineTransform transform);
 #elif PLATFORM(QT)
     AffineTransform(const QMatrix &matrix);
@@ -72,7 +74,7 @@ public:
     bool isInvertible() const;
     AffineTransform invert() const;
 
-#if __APPLE__
+#if PLATFORM(CG)
     operator CGAffineTransform() const;
 #elif PLATFORM(QT)
     operator QMatrix() const;
@@ -83,7 +85,7 @@ public:
     AffineTransform operator*(const AffineTransform&);
     
 private:
-#if __APPLE__
+#if PLATFORM(CG)
     CGAffineTransform m_transform;
 #elif PLATFORM(QT)
     QMatrix m_transform;
index 4918b604f7c66e281e6cd8d64f349448340be781..40d0c8502b9d2308a4d30d618fc798f197eb26f3 100644 (file)
 
 #include <wtf/Platform.h>
 
-#if __APPLE__
-
+#if PLATFORM(MAC)
 #ifdef __OBJC__
 @class NSColor;
 #else
 class NSColor;
 #endif
+#endif
 
+#if PLATFORM(CG)
 typedef struct CGColor* CGColorRef;
-
-#endif // __APPLE__
+#endif
 
 #if PLATFORM(QT)
 class QColor;
@@ -119,8 +119,11 @@ inline bool operator!=(const Color& a, const Color& b)
 Color focusRingColor();
 void setFocusRingColorChangeFunction(void (*)());
 
-#if __APPLE__
+#if PLATFORM(MAC)
 NSColor* nsColor(const Color&);
+#endif
+
+#if PLATFORM(CG)
 CGColorRef cgColor(const Color&);
 #endif
 
index b494cc33e645b7d95641fd646f4bde1103bc31be..e2053c9aa3908a1149172c2ac8a98ecf7b683f37 100644 (file)
@@ -36,7 +36,7 @@
 #include <QCursor>
 #endif
 
-#ifdef __APPLE__
+#if PLATFORM(MAC)
 #ifdef __OBJC__
 @class NSCursor;
 #else
@@ -50,7 +50,7 @@ namespace WebCore {
 
 #if PLATFORM(WIN)
     typedef HCURSOR PlatformCursor;
-#elif defined(__APPLE__)
+#elif PLATFORM(MAC)
     typedef NSCursor* PlatformCursor;
 #elif PLATFORM(GDK)
     typedef GdkCursor* PlatformCursor;
index 4f2856f66b824326864506ffbb6ab235f5a822df..35d91847dd5ab2ad54f197c4152c83ed1719a5f3 100644 (file)
 #include "FloatSize.h"
 #include <wtf/Platform.h>
 
-#if __APPLE__
-
+#if PLATFORM(CG)
 typedef struct CGPoint CGPoint;
+#endif
 
+#if PLATFORM(MAC)
 #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
 typedef struct CGPoint NSPoint;
 #else
 typedef struct _NSPoint NSPoint;
 #endif
-
 #endif
 
 #if PLATFORM(QT)
@@ -63,18 +63,16 @@ public:
     void setY(float y) { m_y = y; }
     void move(float dx, float dy) { m_x += dx; m_y += dy; }
 
-#if __APPLE__
-
+#if PLATFORM(CG)
     FloatPoint(const CGPoint&);
     operator CGPoint() const;
+#endif
 
-#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
+#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
     FloatPoint(const NSPoint&);
     operator NSPoint() const;
 #endif
 
-#endif
-
 #if PLATFORM(QT)
     FloatPoint(const QPointF&);
     operator QPointF() const;
index a6952c8a74d0ab80e7d8f05f8f2465fafc6678f6..fce7b58e613439f823308f2bdf8d3851908fe608 100644 (file)
 
 #include "FloatPoint.h"
 
-#if __APPLE__
-
+#if PLATFORM(CG)
 typedef struct CGRect CGRect;
+#endif
 
+#if PLATFORM(MAC)
 #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
 typedef struct CGRect NSRect;
 #else
 typedef struct _NSRect NSRect;
 #endif
-
-#endif // __APPLE__
+#endif
 
 #if PLATFORM(QT)
 class QRectF;
@@ -99,17 +99,17 @@ public:
     void inflate(float d) { inflateX(d); inflateY(d); }
     void scale(float s);
 
-#if __APPLE__
-
+#if PLATFORM(CG)
     FloatRect(const CGRect&);
     operator CGRect() const;
+#endif
 
-#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
+#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
     FloatRect(const NSRect&);
     operator NSRect() const;
 #endif
 
-#elif PLATFORM(QT)
+#if PLATFORM(QT)
     FloatRect(const QRectF&);
     operator QRectF() const;
 #endif
index 618815abe287f66b7225e17bdc5d52125f86860a..74ab6a6307d15989187ea90d8a2172ed26b81101 100644 (file)
 #ifndef FloatSize_h
 #define FloatSize_h
 
-#if __APPLE__
-
+#if PLATFORM(CG)
 typedef struct CGSize CGSize;
+#endif
 
+#if PLATFORM(MAC)
 #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
 typedef struct CGSize NSSize;
 #else
 typedef struct _NSSize NSSize;
 #endif
-
 #endif
 
 namespace WebCore {
@@ -63,18 +63,16 @@ public:
             m_height > other.m_height ? m_height : other.m_height);
     }
 
-#if __APPLE__
-
+#if PLATFORM(CG)
     explicit FloatSize(const CGSize&); // don't do this implicitly since it's lossy
     operator CGSize() const;
+#endif
 
-#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
+#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
     explicit FloatSize(const NSSize &); // don't do this implicitly since it's lossy
     operator NSSize() const;
 #endif
 
-#endif
-
 private:
     float m_width, m_height;
 };
index 08137d978cfbd4aa2b90bd5677a472050fcc4987..e55d5dc114400828432fa31f076a038c6513cc79 100644 (file)
@@ -116,7 +116,7 @@ class Font {
 public:
     Font();
     Font(const FontDescription&, short letterSpacing, short wordSpacing);
-#if __APPLE__
+#if PLATFORM(MAC)
     Font(const FontPlatformData& fontPlatformData); // This constructor is only used by Mac-specific code that already has a native font.
 #endif
     ~Font();
@@ -168,7 +168,7 @@ public:
     unsigned weight() const { return m_fontDescription.weight(); }
     bool bold() const { return m_fontDescription.bold(); }
 
-#if __APPLE__
+#if PLATFORM(MAC)
     NSFont* getNSFont() const { return primaryFont()->getNSFont(); }
 #endif
 
index 168130c89a742b6f81cf99fe84200770fa631a80..7b50d79c6928d989acaf82e7335d42f1dfa20118 100644 (file)
@@ -68,7 +68,7 @@ public:
     GlyphData glyphDataForCharacter(UChar32 c) const { return m_characterToGlyphMap.glyphDataForCharacter(c, this); }
     void setGlyphDataForCharacter(UChar32 c, Glyph glyph, const FontData* fontData) const { m_characterToGlyphMap.setGlyphDataForCharacter(c, glyph, fontData); }
 
-#if __APPLE__
+#if PLATFORM(MAC)
     NSFont* getNSFont() const { return m_font.font; }
 #endif
 
@@ -103,7 +103,7 @@ public:
 
     mutable FontData* m_smallCapsFontData;
 
-#if __APPLE__
+#if PLATFORM(MAC)
     void* m_styleGroup;
     float m_syntheticBoldOffset;
     mutable ATSUStyle m_ATSUStyle;
index f1ac8097f05fc39d3d89dcf4472a758b4fff8889..e4e98a9f72843915d6efc6396255ad0f6a8d677b 100644 (file)
@@ -34,9 +34,9 @@
 #define MAX_GLYPH_EXPANSION 4
 #define GLYPH_BUFFER_SIZE 2048
 
-#if __APPLE__
+#if PLATFORM(CG)
 #include <ApplicationServices/ApplicationServices.h>
-#elif PLATFORM(WIN) || PLATFORM(GDK)
+#elif PLATFORM(CAIRO)
 #include <cairo.h>
 #include "FloatSize.h"
 #elif PLATFORM(QT)
@@ -50,10 +50,10 @@ namespace WebCore
 typedef unsigned short Glyph;
 class FontData;
 
-#if __APPLE__
+#if PLATFORM(CG)
 typedef Glyph GlyphBufferGlyph;
 typedef CGSize GlyphBufferAdvance;
-#elif PLATFORM(WIN) || PLATFORM(GDK)
+#elif PLATFORM(CAIRO)
 typedef cairo_glyph_t GlyphBufferGlyph;
 typedef FloatSize GlyphBufferAdvance;
 #elif PLATFORM(QT)
@@ -98,18 +98,18 @@ public:
 
     Glyph glyphAt(int index) const
     {
-#if __APPLE__ || PLATFORM(QT)
+#if PLATFORM(CG) || PLATFORM(QT)
         return m_glyphs[index];
-#elif PLATFORM(WIN) || PLATFORM(GDK)
+#elif PLATFORM(CAIRO)
         return m_glyphs[index].index;
 #endif
     }
 
     float advanceAt(int index) const
     {
-#if __APPLE__
+#if PLATFORM(CG)
         return m_advances[index].width;
-#elif PLATFORM(WIN) || PLATFORM(GDK) || PLATFORM(QT)
+#elif PLATFORM(CAIRO) || PLATFORM(QT)
         return m_advances[index].width();
 #endif
     }
@@ -117,13 +117,13 @@ public:
     void add(Glyph glyph, const FontData* font, float width)
     {
         m_fontData.append(font);
-#if __APPLE__
+#if PLATFORM(CG)
         m_glyphs.append(glyph);
         CGSize advance;
         advance.width = width;
         advance.height = 0;
         m_advances.append(advance);
-#elif PLATFORM(WIN) || PLATFORM(GDK)
+#elif PLATFORM(CAIRO)
         cairo_glyph_t cairoGlyph;
         cairoGlyph.index = glyph;
         cairoGlyph.y = 0;
index 432fa8c100b50388d9184b07a40f5871ea9e3dd0..03f2e38d710a09a906b674628e6c1e2490f27c1b 100644 (file)
 #include <wtf/Noncopyable.h>
 #include <wtf/Platform.h>
 
-// FIXME: how should Cairo figure into the platform macros?
-#if __APPLE__
+#if PLATFORM(CG)
 typedef struct CGContext PlatformGraphicsContext;
-#elif PLATFORM(WIN)
-typedef struct HDC__* HDC;
-typedef struct _cairo PlatformGraphicsContext;
-#elif PLATFORM(GDK)
+#elif PLATFORM(CAIRO)
 typedef struct _cairo PlatformGraphicsContext;
 #elif PLATFORM(QT)
 class QPainter;
@@ -51,6 +47,10 @@ typedef QPainter PlatformGraphicsContext;
 typedef void PlatformGraphicsContext;
 #endif
 
+#if PLATFORM(WIN)
+typedef struct HDC__* HDC;
+#endif
+
 namespace WebCore {
 
     const int cMisspellingLineThickness = 3;
index 8d1c8a1707e17869828bb5da8f37ded0738e9ff5..d2d4a0d014bffa9847176eba6cb5323ca2561d20 100644 (file)
@@ -33,7 +33,7 @@
 #include "IntSize.h"
 #include "FloatSize.h"
 
-#if __APPLE__
+#if PLATFORM(MAC)
 #ifdef __OBJC__
 @class NSImage;
 #else
@@ -132,7 +132,7 @@ public:
 
     enum TileRule { StretchTile, RoundTile, RepeatTile };
     
-#if __APPLE__
+#if PLATFORM(MAC)
     // Accessors for native image formats.
     CGImageRef getCGImageRef();
     NSImage* getNSImage();
@@ -189,7 +189,7 @@ private:
     int m_repetitionCount; // How many total animation loops we should do.
     int m_repetitionsComplete;  // How many repetitions we've finished.
 
-#if __APPLE__
+#if PLATFORM(MAC)
     mutable NSImage* m_nsImage; // A cached NSImage of frame 0. Only built lazily if someone actually queries for one.
     mutable CFDataRef m_tiffRep; // Cached TIFF rep for frame 0.  Only built lazily if someone queries for one.
     PDFDocumentImage* m_PDFDoc;
index 2d952371e2df6ff847ff9003035b9cd389970673..ab8784c1b2178275faf5bb9d1fa08d19ddf31d3e 100644 (file)
 #include <wtf/Noncopyable.h>
 #include <wtf/Vector.h>
 
-#if __APPLE__
+#if PLATFORM(CG)
 #include <ApplicationServices/ApplicationServices.h>
 #elif PLATFORM(QT)
 class QImage;
-#else
+#elif PLATFORM(CAIRO)
 struct _cairo_surface;
 typedef struct _cairo_surface cairo_surface_t;
 #endif
@@ -42,7 +42,7 @@ namespace WebCore {
 
 class IntSize;
 
-#if __APPLE__
+#if PLATFORM(CG)
 typedef CGImageSourceRef NativeImageSourcePtr;
 typedef CGImageRef NativeImagePtr;
 typedef CFDataRef NativeBytePtr;
index 281946470c8008157586ba259e8f18099a08e57d..d41e24a2d43759e4716209a91667ade9f960b00f 100644 (file)
 #include "IntSize.h"
 #include <wtf/Platform.h>
 
-#if __APPLE__
-
+#if PLATFORM(CG)
 typedef struct CGPoint CGPoint;
+#endif
 
+#if PLATFORM(MAC)
 #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
 typedef struct CGPoint NSPoint;
 #else
 typedef struct _NSPoint NSPoint;
 #endif
-
-#endif // __APPLE__
+#endif
 
 #if PLATFORM(WIN)
 typedef struct tagPOINT POINT;
@@ -62,18 +62,16 @@ public:
 
     void move(int dx, int dy) { m_x += dx; m_y += dy; }
     
-#if __APPLE__
-
+#if PLATFORM(CG)
     explicit IntPoint(const CGPoint&); // don't do this implicitly since it's lossy
     operator CGPoint() const;
+#endif
 
-#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
+#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
     explicit IntPoint(const NSPoint&); // don't do this implicitly since it's lossy
     operator NSPoint() const;
 #endif
 
-#endif
-
 #if PLATFORM(WIN)
     IntPoint(const POINT&);
     operator POINT() const;
index cf5dd94a05626f272261e4256b18b315fef1b54f..e7a83416d38d20ea29998c8fae23b6bd1c3cca2d 100644 (file)
 #include "IntPoint.h"
 #include <wtf/Platform.h>
 
-#if __APPLE__
-
+#if PLATFORM(CG)
 typedef struct CGRect CGRect;
+#endif
 
+#if PLATFORM(MAC)
 #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
 typedef struct CGRect NSRect;
 #else
 typedef struct _NSRect NSRect;
 #endif
-
-#endif // __APPLE__
+#endif
 
 #if PLATFORM(WIN)
 typedef struct tagRECT RECT;
@@ -114,14 +114,12 @@ public:
     operator QRect() const;
 #endif
 
-#if __APPLE__
-
+#if PLATFORM(CG)
     operator CGRect() const;
-
-#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
-    operator NSRect() const;
 #endif
 
+#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
+    operator NSRect() const;
 #endif
 
 private:
@@ -153,16 +151,12 @@ inline bool operator!=(const IntRect& a, const IntRect& b)
     return a.location() != b.location() || a.size() != b.size();
 }
 
-#if __APPLE__
-
+#if PLATFORM(CG)
 IntRect enclosingIntRect(const CGRect&);
-
-#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
-
-IntRect enclosingIntRect(const NSRect&);
-
 #endif
 
+#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
+IntRect enclosingIntRect(const NSRect&);
 #endif
 
 } // namespace WebCore
index a62bf5be83de537d40aa92101a2ac6e0acb18a52..f0122ade644d8f6009de1621251c9818dba79c52 100644 (file)
 
 #include <wtf/Platform.h>
 
-#if __APPLE__
-
+#if PLATFORM(CG)
 typedef struct CGSize CGSize;
+#endif
 
+#if PLATFORM(MAC)
 #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
 typedef struct CGSize NSSize;
 #else
 typedef struct _NSSize NSSize;
 #endif
-
-#endif // __APPLE__
+#endif
 
 #if PLATFORM(WIN)
 typedef struct tagSIZE SIZE;
@@ -78,18 +78,16 @@ public:
         *this = expandedTo(IntSize());
     }
 
-#if __APPLE__
-
+#if PLATFORM(CG)
     explicit IntSize(const CGSize&); // don't do this implicitly since it's lossy
     operator CGSize() const;
+#endif
 
-#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
+#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
     explicit IntSize(const NSSize &); // don't do this implicitly since it's lossy
     operator NSSize() const;
 #endif
 
-#endif
-
 #if PLATFORM(WIN)
     IntSize(const SIZE&);
     operator SIZE() const;
index ccec88d1d7bfe1cffc60d046b6ef19f1eec61440..0d6ecc9b421e7b75a2691e514193a33bf7de2eb6 100644 (file)
@@ -44,7 +44,7 @@ typedef _W64 long LONG_PTR;
 typedef LONG_PTR LRESULT;
 #endif
 
-#if __APPLE__
+#if PLATFORM(MAC)
 #ifdef __OBJC__
 @class WebCoreResourceLoaderImp;
 #else
@@ -80,7 +80,7 @@ public:
     String method() const;
     FormData postData() const;
 
-#if __APPLE__
+#if PLATFORM(MAC)
     void setLoader(WebCoreResourceLoaderImp*);
 #endif
 #if PLATFORM(WIN)
index ca64a8c81317c8cad825bbbcdbe6330307baaea8..92c1d1d9671a7ca406faef9daf3d3b1eb664ebe0 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef ResourceLoaderClient_h
 #define ResourceLoaderClient_h
 
-#ifdef __APPLE__
+#if PLATFORM(MAC)
 #ifdef __OBJC__
 @class NSData;
 @class NSURLResponse;
@@ -38,7 +38,7 @@ class NSURLResponse;
 
 namespace WebCore {
 
-#ifdef __APPLE__
+#if PLATFORM(MAC)
     typedef NSData* PlatformData;
     typedef NSURLResponse* PlatformResponse;
 #elif PLATFORM(QT)
index a2bcce205d5447abf0797310a3e708e2d251a025..1685292896752b77cc21d98d8dea20bb5678b5e5 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <wtf/Platform.h>
 
-#if __APPLE__
+#if PLATFORM(MAC)
 #ifdef __OBJC__
 @class NSView;
 #else
@@ -155,7 +155,7 @@ namespace WebCore {
 #endif
 
 
-#if __APPLE__
+#if PLATFORM(MAC)
         Widget(NSView* view);
 
         NSView* getView() const;
index 345dbb0640d079f326b22d0a687062c27246713a..a2e67d11f8b6724dec0369e5985f5cdaedafa3e5 100644 (file)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "GraphicsContext.h"
 
+#if PLATFORM(CAIRO)
+
 #include "FloatRect.h"
 #include "Font.h"
 #include "IntRect.h"
@@ -445,3 +447,5 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect)
 }
 
 }
+
+#endif // PLATFORM(CAIRO)
index 2d0aaed0981fdf2128ceab8fdad817902b5e7365..3c2f9581c2a26ddf1e74be77f74b362a51579c53 100644 (file)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "Image.h"
 
+#if PLATFORM(CAIRO)
+
 #include "FloatRect.h"
 #include "GraphicsContext.h"
 #include <cairo.h>
@@ -212,3 +214,5 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const Flo
 }
 
 }
+
+#endif // PLATFORM(CAIRO)
index 0b978ff57b848c9f2eafd2b79f27812004ed532d..01b2f225dc0962d7deb99ffc82afbcd0f8840f81 100644 (file)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "ImageSource.h"
 
+#if PLATFORM(CAIRO)
+
 #include "GIFImageDecoder.h"
 #include "JPEGImageDecoder.h"
 #include "PNGImageDecoder.h"
@@ -178,3 +180,5 @@ bool ImageSource::frameHasAlphaAtIndex(size_t index)
 }
 
 }
+
+#endif // PLATFORM(CAIRO)
index f5a5a50675c597d29d35f42861204ff18b7c4bb8..aa4b72970c9a1b0a7f7fc7d87e7d1036e1e91e31 100644 (file)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "AffineTransform.h"
 
+#if PLATFORM(CG)
+
 #include "FloatRect.h"
 #include "IntRect.h"
 
@@ -169,3 +171,5 @@ AffineTransform AffineTransform::operator* (const AffineTransform &m2)
 }
 
 }
+
+#endif // PLATFORM(CG)
diff --git a/WebCore/platform/cg/FloatPointCG.cpp b/WebCore/platform/cg/FloatPointCG.cpp
new file mode 100644 (file)
index 0000000..f9c3353
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005 Nokia.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "FloatPoint.h"
+
+#if PLATFORM(CG)
+
+#include <ApplicationServices/ApplicationServices.h>
+
+namespace WebCore {
+
+FloatPoint::FloatPoint(const CGPoint& p) : m_x(p.x), m_y(p.y)
+{
+}
+
+FloatPoint::operator CGPoint() const
+{
+    return CGPointMake(m_x, m_y);
+}
+
+}
+
+#endif // PLATFORM(CG)
diff --git a/WebCore/platform/cg/FloatRectCG.cpp b/WebCore/platform/cg/FloatRectCG.cpp
new file mode 100644 (file)
index 0000000..a1ce367
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005 Nokia.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "FloatRect.h"
+
+#if PLATFORM(CG)
+
+#include <ApplicationServices/ApplicationServices.h>
+
+namespace WebCore {
+
+FloatRect::FloatRect(const CGRect& r) : m_location(r.origin), m_size(r.size)
+{
+}
+
+FloatRect::operator CGRect() const
+{
+    return CGRectMake(x(), y(), width(), height());
+}
+
+}
+
+#endif // PLATFORM(CG)
diff --git a/WebCore/platform/cg/FloatSizeCG.cpp b/WebCore/platform/cg/FloatSizeCG.cpp
new file mode 100644 (file)
index 0000000..383af21
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005 Nokia.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+#include "config.h"
+#include "FloatSize.h"
+
+#if PLATFORM(CG)
+
+#include <ApplicationServices/ApplicationServices.h>
+
+namespace WebCore {
+
+FloatSize::FloatSize(const CGSize& s) : m_width(s.width), m_height(s.height)
+{
+}
+
+FloatSize::operator CGSize() const
+{
+    return CGSizeMake(m_width, m_height);
+}
+
+}
+
+#endif // PLATFORM(CG)
index 5aa9c265304994d329e03f17537392f34138a3bb..150917aaa1ee9436bbb2869b39d40ce1ead82396 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
+#define _USE_MATH_DEFINES 1
 #include "config.h"
 #include "GraphicsContext.h"
 
+#if PLATFORM(CG)
+
 #include "AffineTransform.h"
-#include "KRenderingDeviceQuartz.h"
 #include "Path.h"
+#include "wtf/mathextras.h"
+
+#ifdef SVG_SUPPORT
+#include "KRenderingDeviceQuartz.h"
+#endif
+
+#include "GraphicsContextPlatformPrivate.h"
 
 using namespace std;
 
 namespace WebCore {
 
-// NSColor, NSBezierPath, and NSGraphicsContext
-// calls in this file are all exception-safe, so we don't block
-// exceptions for those.
+GraphicsContext::GraphicsContext(CGContextRef cgContext)
+    : m_common(createGraphicsContextPrivate())
+    , m_data(new GraphicsContextPlatformPrivate(cgContext))
+{
+    setPaintingDisabled(!cgContext);
+}
+
+GraphicsContext::~GraphicsContext()
+{
+    destroyGraphicsContextPrivate(m_common);
+    delete m_data;
+}
+
+void GraphicsContext::setFocusRingClip(const IntRect& r)
+{
+    // This method only exists to work around bugs in Mac focus ring clipping.
+    m_data->m_focusRingClip = r;
+}
+
+void GraphicsContext::clearFocusRingClip()
+{
+    // This method only exists to work around bugs in Mac focus ring clipping.
+    m_data->m_focusRingClip = IntRect();
+}
+
+CGContextRef GraphicsContext::platformContext() const
+{
+    ASSERT(!paintingDisabled());
+    ASSERT(m_data->m_cgContext);
+    return m_data->m_cgContext;
+}
 
 static void setCGFillColor(CGContextRef context, const Color& color)
 {
@@ -75,7 +112,7 @@ void GraphicsContext::drawRect(const IntRect& rect)
         CGContextFillRect(context, rect);
     }
 
-    if (pen().style() != Pen::Pen::NoPen) {
+    if (pen().style() != Pen::NoPen) {
         setCGFillColor(context, pen().color());
         CGRect rects[4] = {
             FloatRect(rect.x(), rect.y(), rect.width(), 1),
@@ -94,7 +131,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
         return;
 
     Pen::PenStyle penStyle = pen().style();
-    if (penStyle == Pen::Pen::NoPen)
+    if (penStyle == Pen::NoPen)
         return;
     float width = pen().width();
     if (width < 1)
@@ -727,3 +764,5 @@ void GraphicsContext::drawLineForText(const IntPoint& point, int yOffset, int wi
 }
 
 }
+
+#endif // PLATFORM(CG)
diff --git a/WebCore/platform/cg/GraphicsContextPlatformPrivate.h b/WebCore/platform/cg/GraphicsContextPlatformPrivate.h
new file mode 100644 (file)
index 0000000..e1f5fff
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+namespace WebCore
+{
+
+class GraphicsContextPlatformPrivate {
+public:
+    GraphicsContextPlatformPrivate(CGContextRef cgContext)
+    :m_cgContext(cgContext)
+    {
+        CGContextRetain(m_cgContext);
+    }
+    
+    ~GraphicsContextPlatformPrivate()
+    {
+        CGContextRelease(m_cgContext);
+    }
+
+    CGContextRef m_cgContext;
+    IntRect m_focusRingClip; // Work around CG bug in focus ring clipping.
+};
+
+}
diff --git a/WebCore/platform/cg/ImageCG.cpp b/WebCore/platform/cg/ImageCG.cpp
new file mode 100644 (file)
index 0000000..ba61a64
--- /dev/null
@@ -0,0 +1,428 @@
+/*
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "Image.h"
+
+#if PLATFORM(CG)
+
+#include <ApplicationServices/ApplicationServices.h>
+#include "FloatRect.h"
+#include "GraphicsContext.h"
+#include "PDFDocumentImage.h"
+#include "PlatformString.h"
+#include "WebCoreSystemInterface.h"
+
+namespace WebCore {
+
+void FrameData::clear()
+{
+    if (m_frame) {
+        CFRelease(m_frame);
+        m_frame = 0;
+        m_duration = 0.;
+        m_hasAlpha = true;
+    }
+}
+
+// ================================================
+// Image Class
+// ================================================
+
+void Image::initNativeData()
+{
+    m_nsImage = 0;
+    m_tiffRep = 0;
+    m_isPDF = false;
+    m_PDFDoc = 0;
+}
+
+void Image::destroyNativeData()
+{
+    delete m_PDFDoc;
+}
+
+void Image::invalidateNativeData()
+{
+    if (m_frames.size() != 1)
+        return;
+
+    if (m_nsImage) {
+        CFRelease(m_nsImage);
+        m_nsImage = 0;
+    }
+
+    if (m_tiffRep) {
+        CFRelease(m_tiffRep);
+        m_tiffRep = 0;
+    }
+}
+
+// Drawing Routines
+
+void Image::checkForSolidColor()
+{
+    if (frameCount() > 1)
+        m_isSolidColor = false;
+    else {
+        CGImageRef image = frameAtIndex(0);
+        
+        // Currently we only check for solid color in the important special case of a 1x1 image.
+        if (image && CGImageGetWidth(image) == 1 && CGImageGetHeight(image) == 1) {
+            CGFloat pixel[4]; // RGBA
+            CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
+            CGContextRef bmap = CGBitmapContextCreate(&pixel, 1, 1, 8*sizeof(float), sizeof(pixel), space,
+                kCGImageAlphaPremultipliedLast | kCGBitmapFloatComponents | kCGBitmapByteOrder32Host);
+            if (bmap) {
+                GraphicsContext(bmap).setCompositeOperation(CompositeCopy);
+                CGRect dst = { {0, 0}, {1, 1} };
+                CGContextDrawImage(bmap, dst, image);
+                if (pixel[3] == 0)
+                    m_solidColor = Color(0, 0, 0, 0);
+                else
+                    m_solidColor = Color(int(pixel[0] / pixel[3] * 255), int(pixel[1] / pixel[3] * 255), int(pixel[2] / pixel[3] * 255), int(pixel[3] * 255));
+                m_isSolidColor = true;
+                CFRelease(bmap);
+            } 
+            CFRelease(space);
+        }
+    }
+}
+
+CFDataRef Image::getTIFFRepresentation()
+{
+    if (m_tiffRep)
+        return m_tiffRep;
+    
+    unsigned numFrames = frameCount();
+    
+    // If numFrames is zero, we know for certain this image doesn't have valid data
+    // Even though the call to CGImageDestinationCreateWithData will fail and we'll handle it gracefully,
+    // in certain circumstances that call will spam the console with an error message
+    if (!numFrames)
+        return 0;
+    CFMutableDataRef data = CFDataCreateMutable(0, 0);
+    // FIXME:  Use type kCGImageTypeIdentifierTIFF constant once is becomes available in the API
+    CGImageDestinationRef destination = CGImageDestinationCreateWithData(data, CFSTR("public.tiff"), numFrames, 0);
+    if (!destination)
+        return 0;
+
+    for (unsigned i = 0; i < numFrames; ++i ) {
+        CGImageRef cgImage = frameAtIndex(i);
+        if (!cgImage) {
+            CFRelease(destination);
+            return 0;    
+        }
+        CGImageDestinationAddImage(destination, cgImage, 0);
+    }
+    CGImageDestinationFinalize(destination);
+    CFRelease(destination);
+
+    m_tiffRep = data;
+    return m_tiffRep;
+}
+
+CGImageRef Image::getCGImageRef()
+{
+    return frameAtIndex(0);
+}
+
+void Image::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp)
+{
+    if (m_isPDF) {
+        if (m_PDFDoc)
+            m_PDFDoc->draw(ctxt, srcRect, dstRect, compositeOp);
+        return;
+    } 
+    
+    if (!m_source.initialized())
+        return;
+    
+    CGRect fr = ctxt->roundToDevicePixels(srcRect);
+    CGRect ir = ctxt->roundToDevicePixels(dstRect);
+
+    CGImageRef image = frameAtIndex(m_currentFrame);
+    if (!image) // If it's too early we won't have an image yet.
+        return;
+
+    if (m_isSolidColor && m_currentFrame == 0) {
+        if (m_solidColor.alpha() > 0) {
+            ctxt->save();
+            ctxt->setCompositeOperation(!m_solidColor.hasAlpha() && compositeOp == CompositeSourceOver ? CompositeCopy : compositeOp);
+            ctxt->fillRect(ir, m_solidColor);
+            ctxt->restore();
+        }
+        return;
+    }
+
+    CGContextRef context = ctxt->platformContext();
+    ctxt->save();
+
+    // Get the height (in adjusted, i.e. scaled, coords) of the portion of the image
+    // that is currently decoded.  This could be less that the actual height.
+    CGSize selfSize = size();                          // full image size, in pixels
+    float curHeight = CGImageGetHeight(image);         // height of loaded portion, in pixels
+    
+    CGSize adjustedSize = selfSize;
+    if (curHeight < selfSize.height) {
+        adjustedSize.height *= curHeight / selfSize.height;
+
+        // Is the amount of available bands less than what we need to draw?  If so,
+        // we may have to clip 'fr' if it goes outside the available bounds.
+        if (CGRectGetMaxY(fr) > adjustedSize.height) {
+            float frHeight = adjustedSize.height - fr.origin.y; // clip fr to available bounds
+            if (frHeight <= 0)
+                return;                                             // clipped out entirely
+            ir.size.height *= (frHeight / fr.size.height);    // scale ir proportionally to fr
+            fr.size.height = frHeight;
+        }
+    }
+
+    // Flip the coords.
+    ctxt->setCompositeOperation(compositeOp);
+    CGContextTranslateCTM(context, ir.origin.x, ir.origin.y);
+    CGContextScaleCTM(context, 1, -1);
+    CGContextTranslateCTM(context, 0, -ir.size.height);
+    
+    // Translated to origin, now draw at 0,0.
+    ir.origin.x = ir.origin.y = 0;
+    
+    // If we're drawing a sub portion of the image then create
+    // a image for the sub portion and draw that.
+    // Test using example site at http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html
+    if (fr.size.width != adjustedSize.width || fr.size.height != adjustedSize.height) {
+        // Convert ft to image pixel coords:
+        float xscale = adjustedSize.width / selfSize.width;
+        float yscale = adjustedSize.height / curHeight;     // yes, curHeight, not selfSize.height!
+        fr.origin.x /= xscale;
+        fr.origin.y /= yscale;
+        fr.size.width /= xscale;
+        fr.size.height /= yscale;
+        
+        image = CGImageCreateWithImageInRect(image, fr);
+        if (image) {
+            CGContextDrawImage(context, ir, image);
+            CFRelease(image);
+        }
+    } else // Draw the whole image.
+        CGContextDrawImage(context, ir, image);
+
+    ctxt->restore();
+    
+    startAnimation();
+
+}
+
+static void drawPattern(void* info, CGContextRef context)
+{
+    Image* data = (Image*)info;
+    CGImageRef image = data->frameAtIndex(data->currentFrame());
+    float w = CGImageGetWidth(image);
+    float h = CGImageGetHeight(image);
+    CGContextDrawImage(context, GraphicsContext(context).roundToDevicePixels(FloatRect
+        (0, data->size().height() - h, w, h)), image);    
+}
+
+static const CGPatternCallbacks patternCallbacks = { 0, drawPattern, NULL };
+
+void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const FloatPoint& srcPoint,
+                      const FloatSize& tileSize, CompositeOperator op)
+{    
+    CGImageRef image = frameAtIndex(m_currentFrame);
+    if (!image)
+        return;
+
+    if (m_isSolidColor && m_currentFrame == 0) {
+        if (m_solidColor.alpha() > 0) {
+            ctxt->save();
+            ctxt->setCompositeOperation(!m_solidColor.hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
+            ctxt->fillRect(destRect, m_solidColor);
+            ctxt->restore();
+        }
+        return;
+    }
+
+    CGPoint scaledPoint = srcPoint;
+    CGSize intrinsicTileSize = size();
+    CGSize scaledTileSize = intrinsicTileSize;
+
+    // If tileSize is not equal to the intrinsic size of the image, set patternTransform
+    // to the appropriate scalar matrix, scale the source point, and set the size of the
+    // scaled tile. 
+    float scaleX = 1.0;
+    float scaleY = 1.0;
+    CGAffineTransform patternTransform = CGAffineTransformIdentity;
+    if (tileSize.width() != intrinsicTileSize.width || tileSize.height() != intrinsicTileSize.height) {
+        scaleX = tileSize.width() / intrinsicTileSize.width;
+        scaleY = tileSize.height() / intrinsicTileSize.height;
+        patternTransform = CGAffineTransformMakeScale(scaleX, scaleY);
+        scaledTileSize = tileSize;
+    }
+
+    // Check and see if a single draw of the image can cover the entire area we are supposed to tile.
+    CGRect oneTileRect;
+    oneTileRect.origin.x = destRect.x() + fmodf(fmodf(-scaledPoint.x, scaledTileSize.width) - 
+                            scaledTileSize.width, scaledTileSize.width);
+    oneTileRect.origin.y = destRect.y() + fmodf(fmodf(-scaledPoint.y, scaledTileSize.height) - 
+                            scaledTileSize.height, scaledTileSize.height);
+    oneTileRect.size.width = scaledTileSize.width;
+    oneTileRect.size.height = scaledTileSize.height;
+
+    // If the single image draw covers the whole area, then just draw once.
+    if (CGRectContainsRect(oneTileRect, destRect)) {
+        CGRect fromRect;
+        fromRect.origin.x = (destRect.x() - oneTileRect.origin.x) / scaleX;
+        fromRect.origin.y = (destRect.y() - oneTileRect.origin.y) / scaleY;
+        fromRect.size.width = destRect.width() / scaleX;
+        fromRect.size.height = destRect.height() / scaleY;
+
+        draw(ctxt, destRect, fromRect, op);
+        return;
+    }
+
+    CGPatternRef pattern = CGPatternCreate(this, CGRectMake(0, 0, intrinsicTileSize.width, intrinsicTileSize.height),
+                                           patternTransform, intrinsicTileSize.width, intrinsicTileSize.height, 
+                                           kCGPatternTilingConstantSpacing, true, &patternCallbacks);
+    
+    if (pattern) {
+        CGContextRef context = ctxt->platformContext();
+
+        ctxt->save();
+
+        wkSetPatternPhaseInUserSpace(context, CGPointMake(oneTileRect.origin.x, oneTileRect.origin.y));
+
+        CGColorSpaceRef patternSpace = CGColorSpaceCreatePattern(NULL);
+        CGContextSetFillColorSpace(context, patternSpace);
+        CGColorSpaceRelease(patternSpace);
+
+        CGFloat patternAlpha = 1;
+        CGContextSetFillPattern(context, pattern, &patternAlpha);
+
+        ctxt->setCompositeOperation(op);
+
+        CGContextFillRect(context, destRect);
+
+        ctxt->restore();
+
+        CGPatternRelease(pattern);
+    }
+    
+    startAnimation();
+}
+
+// FIXME: Merge with the other drawTiled eventually, since we need a combination of both for some things.
+void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, TileRule hRule,
+                      TileRule vRule, CompositeOperator op)
+{    
+    CGImageRef image = frameAtIndex(m_currentFrame);
+    if (!image)
+        return;
+
+    if (m_isSolidColor && m_currentFrame == 0) {
+        if (m_solidColor.alpha() > 0) {
+            ctxt->save();
+            ctxt->setCompositeOperation(!m_solidColor.hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
+            ctxt->fillRect(dstRect, m_solidColor);
+            ctxt->restore();
+        }
+        return;
+    }
+
+    ctxt->save();
+
+    CGSize tileSize = srcRect.size();
+    CGRect ir = dstRect;
+    CGRect fr = srcRect;
+
+    // Now scale the slice in the appropriate direction using an affine transform that we will pass into
+    // the pattern.
+    float scaleX = 1.0f, scaleY = 1.0f;
+
+    if (hRule == Image::StretchTile)
+        scaleX = ir.size.width / fr.size.width;
+    if (vRule == Image::StretchTile)
+        scaleY = ir.size.height / fr.size.height;
+    
+    if (hRule == Image::RepeatTile)
+        scaleX = scaleY;
+    if (vRule == Image::RepeatTile)
+        scaleY = scaleX;
+        
+    if (hRule == Image::RoundTile) {
+        // Complicated math ensues.
+        float imageWidth = fr.size.width * scaleY;
+        float newWidth = ir.size.width / ceilf(ir.size.width / imageWidth);
+        scaleX = newWidth / fr.size.width;
+    }
+    
+    if (vRule == Image::RoundTile) {
+        // More complicated math ensues.
+        float imageHeight = fr.size.height * scaleX;
+        float newHeight = ir.size.height / ceilf(ir.size.height / imageHeight);
+        scaleY = newHeight / fr.size.height;
+    }
+    
+    CGAffineTransform patternTransform = CGAffineTransformMakeScale(scaleX, scaleY);
+
+    // Possible optimization:  We may want to cache the CGPatternRef    
+    CGPatternRef pattern = CGPatternCreate(this, CGRectMake(fr.origin.x, fr.origin.y, tileSize.width, tileSize.height),
+                                           patternTransform, tileSize.width, tileSize.height, 
+                                           kCGPatternTilingConstantSpacing, true, &patternCallbacks);
+    if (pattern) {
+        CGContextRef context = ctxt->platformContext();
+    
+        // We want to construct the phase such that the pattern is centered (when stretch is not
+        // set for a particular rule).
+        float hPhase = scaleX * fr.origin.x;
+        float vPhase = scaleY * (tileSize.height - fr.origin.y);
+        if (hRule == Image::RepeatTile)
+            hPhase -= fmodf(ir.size.width, scaleX * tileSize.width) / 2.0f;
+        if (vRule == Image::RepeatTile)
+            vPhase -= fmodf(ir.size.height, scaleY * tileSize.height) / 2.0f;
+        
+        wkSetPatternPhaseInUserSpace(context, CGPointMake(ir.origin.x - hPhase, ir.origin.y - vPhase));
+
+        CGColorSpaceRef patternSpace = CGColorSpaceCreatePattern(NULL);
+        CGContextSetFillColorSpace(context, patternSpace);
+        CGColorSpaceRelease(patternSpace);
+
+        CGFloat patternAlpha = 1;
+        CGContextSetFillPattern(context, pattern, &patternAlpha);
+
+        ctxt->setCompositeOperation(op);
+        
+        CGContextFillRect(context, ir);
+
+        CGPatternRelease(pattern);
+    }
+
+    ctxt->restore();
+
+    startAnimation();
+}
+
+}
+
+#endif // PLATFORM(CG)
similarity index 98%
rename from WebCore/platform/mac/ImageSourceMac.cpp
rename to WebCore/platform/cg/ImageSourceCG.cpp
index 36e4b31a8b42a9ff6745dd8ae41051d012142bbc..2326d77ca6b4b065f4eea00c3c0979946eeed539 100644 (file)
 #include "config.h"
 #include "ImageSource.h"
 
+#if PLATFORM(CG)
+
 #include "IntSize.h"
+#include <ApplicationServices/ApplicationServices.h>
 
 namespace WebCore {
 
@@ -168,5 +171,6 @@ bool ImageSource::frameHasAlphaAtIndex(size_t index)
     return true;
 }
 
-
 }
+
+#endif // PLATFORM(CG)
diff --git a/WebCore/platform/cg/IntPointCG.cpp b/WebCore/platform/cg/IntPointCG.cpp
new file mode 100644 (file)
index 0000000..95dbe5f
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "IntPoint.h"
+
+#if PLATFORM(CG)
+
+#include <ApplicationServices/ApplicationServices.h>
+
+namespace WebCore {
+
+IntPoint::IntPoint(const CGPoint& p) : m_x(static_cast<int>(p.x)), m_y(static_cast<int>(p.y))
+{
+}
+
+IntPoint::operator CGPoint() const
+{
+    return CGPointMake(m_x, m_y);
+}
+
+}
+
+#endif // PLATFORM(CG)
diff --git a/WebCore/platform/cg/IntRectCG.cpp b/WebCore/platform/cg/IntRectCG.cpp
new file mode 100644 (file)
index 0000000..73fd63f
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "IntRect.h"
+
+#if PLATFORM(CG)
+
+#include <ApplicationServices/ApplicationServices.h>
+
+namespace WebCore {
+
+IntRect::operator CGRect() const
+{
+    return CGRectMake(x(), y(), width(), height());
+}
+
+IntRect enclosingIntRect(const CGRect& rect)
+{
+    int l = static_cast<int>(floorf(rect.origin.x));
+    int t = static_cast<int>(floorf(rect.origin.y));
+    int r = static_cast<int>(ceilf(CGRectGetMaxX(rect)));
+    int b = static_cast<int>(ceilf(CGRectGetMaxY(rect)));
+    return IntRect(l, t, r - l, b - t);
+}
+
+}
+
+#endif // PLATFORM(CG)
diff --git a/WebCore/platform/cg/IntSizeCG.cpp b/WebCore/platform/cg/IntSizeCG.cpp
new file mode 100644 (file)
index 0000000..d8e8c83
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "IntSize.h"
+
+#if PLATFORM(CG)
+
+#include <ApplicationServices/ApplicationServices.h>
+
+namespace WebCore {
+
+IntSize::IntSize(const CGSize& s) : m_width(static_cast<int>(s.width)), m_height(static_cast<int>(s.height))
+{
+}
+
+IntSize::operator CGSize() const
+{
+    return CGSizeMake(m_width, m_height);
+}
+
+}
+
+#endif // PLATFORM(CG)
similarity index 95%
rename from WebCore/platform/mac/PDFDocumentImage.mm
rename to WebCore/platform/cg/PDFDocumentImage.cpp
index 537695c2f4ed35817ef00c8d2f386c543e5a331e..d31f2a7deec280bf516811bfc4b43430ee4e5f01 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#import "config.h"
-#import "PDFDocumentImage.h"
+#define _USE_MATH_DEFINES 1
+#include "config.h"
+#include "PDFDocumentImage.h"
+
+#if PLATFORM(CG)
 
 #import "GraphicsContext.h"
 
@@ -58,8 +61,8 @@ void PDFDocumentImage::adjustCTM(GraphicsContext* context) const
 
     // calculate rotated x and y edges of the corp box. if they're negative, it means part of the image has
     // been rotated outside of the bounds and we need to shift over the image so it lies inside the bounds again
-    NSPoint rx = NSMakePoint(width * cosa, width * sina);
-    NSPoint ry = NSMakePoint(-height * sina, height * cosa);
+    CGPoint rx = CGPointMake(width * cosa, width * sina);
+    CGPoint ry = CGPointMake(-height * sina, height * cosa);
 
     // adjust so we are at the crop box origin
     const CGFloat zero = 0;
@@ -136,3 +139,5 @@ void PDFDocumentImage::draw(GraphicsContext* context, const FloatRect& srcRect,
 }
 
 }
+
+#endif // PLATFORM(CG)
similarity index 98%
rename from WebCore/platform/mac/PDFDocumentImage.h
rename to WebCore/platform/cg/PDFDocumentImage.h
index b6b838a1fc6cbaed347bfd81ff68e27f9fd81ca8..20c0ebfb10766d6675a14400bdf4813f9e2c9543 100644 (file)
@@ -26,6 +26,8 @@
 #include "FloatRect.h"
 #include "GraphicsTypes.h"
 
+#if PLATFORM(CG)
+
 #include <ApplicationServices/ApplicationServices.h>
 
 namespace WebCore {
@@ -53,3 +55,5 @@ namespace WebCore {
     };
 
 }
+
+#endif // PLATFORM(CG)
index 05033f9e2f711fd4bb829d5b7168abc9fddd9544..1d97371e04893a6fb4958021656051050b3ea951 100644 (file)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "Path.h"
 
+#if PLATFORM(CG)
+
 #include "FloatRect.h"
 #include <ApplicationServices/ApplicationServices.h>
 
@@ -125,3 +127,5 @@ void Path::clear()
 }
 
 }
+
+#endif // PLATFORM(CG)
index 4d6d2879d183ca0636aeb9a8882b76f45df11972..8016e81fe56414321d94b18d323f4881bb3da533 100644 (file)
@@ -25,7 +25,9 @@
  
 #include "config.h"
 #include "BMPImageDecoder.h"
+
+#if PLATFORM(CAIRO)
+
 namespace WebCore
 {
 
@@ -40,4 +42,5 @@ RGBA32Buffer* BMPImageDecoder::frameBufferAtIndex(size_t index)
 }
 
 }
\ No newline at end of file
+
+#endif // PLATFORM(CAIRO)
index f54304465ab60870a7b129cb18364f3e53ac3cba..b1049b8b7db479cba943c247c6205e19b47463a5 100644 (file)
@@ -26,6 +26,8 @@
 #include "GIFImageDecoder.h"
 #include "GIFImageReader.h"
 
+#if PLATFORM(CAIRO)
+
 namespace WebCore {
 
 class GIFImageDecoderPrivate
@@ -359,3 +361,5 @@ void GIFImageDecoder::gifComplete()
 }
 
 }
+
+#endif // PLATFORM(CAIRO)
index 94ab7f08709432417f7de698124bc72b1cfcc853..0475b1ff943f54e57733efe0e590c473a5328ad6 100644 (file)
@@ -78,6 +78,8 @@ mailing address.
 #include <string.h>
 #include "GIFImageDecoder.h"
 
+#if PLATFORM(CAIRO)
+
 using WebCore::GIFImageDecoder;
 
 // Define the Mozilla macro setup so that we can leave the macros alone.
@@ -949,3 +951,4 @@ bool GIFImageReader::read(const unsigned char *buf, unsigned len,
   return true;
 }
 
+#endif // PLATFORM(CAIRO)
index 319054e27267746d49af14bdf65a84fca4b4927a..59e3ebb7b16a9e313bd5193c2ff129333cd45c45 100644 (file)
@@ -25,7 +25,9 @@
  
 #include "config.h"
 #include "ICOImageDecoder.h"
+
+#if PLATFORM(CAIRO)
+
 namespace WebCore
 {
 
@@ -40,4 +42,5 @@ RGBA32Buffer* ICOImageDecoder::frameBufferAtIndex(size_t index)
 }
 
 }
\ No newline at end of file
+
+#endif // PLATFORM(CAIRO)
index 901f7cb4a9215d56941597ba51efe88db7285e1f..d6474d04d3b7c2020d741a3073b98a0490722a60 100644 (file)
@@ -39,6 +39,8 @@
 #include "JPEGImageDecoder.h"
 #include <assert.h>
 
+#if PLATFORM(CAIRO)
+
 extern "C" {
 #include "jpeglib.h"
 }
@@ -504,3 +506,5 @@ void JPEGImageDecoder::jpegComplete()
 }
 
 }
+
+#endif // PLATFORM(CAIRO)
index 8a90f6fbe8af607cb1dada215abde5e9a1725e22..e8a69bcd9066b4997be46598f911edec7a15c0a4 100644 (file)
@@ -39,6 +39,8 @@
 #include "png.h"
 #include "assert.h"
 
+#if PLATFORM(CAIRO)
+
 namespace WebCore {
 
 // Gamma constants.
@@ -398,3 +400,5 @@ void PNGImageDecoder::pngComplete()
 }
 
 }
+
+#endif // PLATFORM(CAIRO)
index 57617c246f8f4470585cb710a755a939a2cccc86..207d964441f2abccfa88181f53e16a193fa23701 100644 (file)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "XBMImageDecoder.h"
  
+#if PLATFORM(CAIRO)
+
 namespace WebCore
 {
 
@@ -40,4 +42,5 @@ RGBA32Buffer* XBMImageDecoder::frameBufferAtIndex(size_t index)
 }
 
 }
\ No newline at end of file
+
+#endif // PLATFORM(CAIRO)
index ae019a65f200d61f03c60d5ef6d4f75c23652c6b..2f73314fa0b9dc4adc3d25d439adda18aa91b779 100644 (file)
 
 namespace WebCore {
 
-FloatPoint::FloatPoint(const CGPoint& p) : m_x(p.x), m_y(p.y)
-{
-}
-
-FloatPoint::operator CGPoint() const
-{
-    return CGPointMake(m_x, m_y);
-}
-
 #ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
 
 FloatPoint::FloatPoint(const NSPoint& p) : m_x(p.x), m_y(p.y)
index 1e008dc2aee88ff25d1d770e501fffdceabb2b5a..1d6b0457887d21b8923486a262f137359afe8b6f 100644 (file)
 
 namespace WebCore {
 
-FloatRect::FloatRect(const CGRect& r) : m_location(r.origin), m_size(r.size)
-{
-}
-
-FloatRect::operator CGRect() const
-{
-    return CGRectMake(x(), y(), width(), height());
-}
-
 #ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
 
 FloatRect::FloatRect(const NSRect& r) : m_location(r.origin), m_size(r.size)
index e43ae39cff73ced8cd54b8bff926cedc38b7a6d4..01efbe91dc485930e192939822dea9a3174ddf1b 100644 (file)
 
 namespace WebCore {
 
-FloatSize::FloatSize(const CGSize& s) : m_width(s.width), m_height(s.height)
-{
-}
-
-FloatSize::operator CGSize() const
-{
-    return CGSizeMake(m_width, m_height);
-}
-
 #ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
 
 FloatSize::FloatSize(const NSSize& s) : m_width(s.width), m_height(s.height)
index b7c85a131ef48ad861b78705e3e1ba0394554289..454d2dfe2210fdf95ecd8a3f5b6277f962e72fe0 100644 (file)
@@ -26,6 +26,8 @@
 #import "config.h"
 #import "GraphicsContext.h"
 
+#import "../cg/GraphicsContextPlatformPrivate.h"
+
 #import "WebCoreSystemInterface.h"
 
 // FIXME: More of this should use CoreGraphics instead of AppKit.
@@ -37,51 +39,6 @@ namespace WebCore {
 // calls in this file are all exception-safe, so we don't block
 // exceptions for those.
 
-class GraphicsContextPlatformPrivate {
-public:
-    GraphicsContextPlatformPrivate(CGContextRef);
-    ~GraphicsContextPlatformPrivate();
-
-    CGContextRef m_cgContext;
-    IntRect m_focusRingClip; // Work around CG bug in focus ring clipping.
-};
-
-GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(CGContextRef cgContext)
-{
-    m_cgContext = cgContext;
-    CGContextRetain(m_cgContext);
-}
-
-GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate()
-{
-    CGContextRelease(m_cgContext);
-}
-
-GraphicsContext::GraphicsContext(CGContextRef cgContext)
-    : m_common(createGraphicsContextPrivate())
-    , m_data(new GraphicsContextPlatformPrivate(cgContext))
-{
-    setPaintingDisabled(!cgContext);
-}
-
-GraphicsContext::~GraphicsContext()
-{
-    destroyGraphicsContextPrivate(m_common);
-    delete m_data;
-}
-
-void GraphicsContext::setFocusRingClip(const IntRect& r)
-{
-    // This method only exists to work around bugs in Mac focus ring clipping.
-    m_data->m_focusRingClip = r;
-}
-
-void GraphicsContext::clearFocusRingClip()
-{
-    // This method only exists to work around bugs in Mac focus ring clipping.
-    m_data->m_focusRingClip = IntRect();
-}
-
 void GraphicsContext::drawFocusRing(const Color& color)
 {
     if (paintingDisabled())
@@ -132,13 +89,6 @@ void GraphicsContext::drawFocusRing(const Color& color)
     CGPathRelease(focusRingPath);
 }
 
-CGContextRef GraphicsContext::platformContext() const
-{
-    ASSERT(!paintingDisabled());
-    ASSERT(m_data->m_cgContext);
-    return m_data->m_cgContext;
-}
-
 void GraphicsContext::setCompositeOperation(CompositeOperator op)
 {
     if (paintingDisabled())
index 12e4c6e397103f56628ca57e44a6404770e8d277..7e861f2e46223df5bb8882d1237b3a08f2c349c6 100644 (file)
 
 namespace WebCore {
 
-void FrameData::clear()
-{
-    if (m_frame) {
-        CFRelease(m_frame);
-        m_frame = 0;
-        m_duration = 0.;
-        m_hasAlpha = true;
-    }
-}
-
 // ================================================
 // Image Class
 // ================================================
 
-void Image::initNativeData()
-{
-    m_nsImage = 0;
-    m_tiffRep = 0;
-    m_isPDF = false;
-    m_PDFDoc = 0;
-}
-
-void Image::destroyNativeData()
-{
-    delete m_PDFDoc;
-}
-
-void Image::invalidateNativeData()
-{
-    if (m_frames.size() != 1)
-        return;
-
-    if (m_nsImage) {
-        CFRelease(m_nsImage);
-        m_nsImage = 0;
-    }
-
-    if (m_tiffRep) {
-        CFRelease(m_tiffRep);
-        m_tiffRep = 0;
-    }
-}
-
 Image* Image::loadResource(const char *name)
 {
     NSBundle *bundle = [NSBundle bundleForClass:[WebCoreFrameBridge class]];
@@ -99,70 +60,6 @@ bool Image::supportsType(const String& type)
     return [[WebCoreFrameBridge supportedImageResourceMIMETypes] containsObject:type];
 }
 
-// Drawing Routines
-
-void Image::checkForSolidColor()
-{
-    if (frameCount() > 1)
-        m_isSolidColor = false;
-    else {
-        CGImageRef image = frameAtIndex(0);
-        
-        // Currently we only check for solid color in the important special case of a 1x1 image.
-        if (image && CGImageGetWidth(image) == 1 && CGImageGetHeight(image) == 1) {
-            CGFloat pixel[4]; // RGBA
-            CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
-            CGContextRef bmap = CGBitmapContextCreate(&pixel, 1, 1, 8*sizeof(float), sizeof(pixel), space,
-                kCGImageAlphaPremultipliedLast | kCGBitmapFloatComponents | kCGBitmapByteOrder32Host);
-            if (bmap) {
-                GraphicsContext(bmap).setCompositeOperation(CompositeCopy);
-                CGRect dst = { {0, 0}, {1, 1} };
-                CGContextDrawImage(bmap, dst, image);
-                if (pixel[3] == 0)
-                    m_solidColor = Color(0, 0, 0, 0);
-                else
-                    m_solidColor = Color(int(pixel[0] / pixel[3] * 255), int(pixel[1] / pixel[3] * 255), int(pixel[2] / pixel[3] * 255), int(pixel[3] * 255));
-                m_isSolidColor = true;
-                CFRelease(bmap);
-            } 
-            CFRelease(space);
-        }
-    }
-}
-
-CFDataRef Image::getTIFFRepresentation()
-{
-    if (m_tiffRep)
-        return m_tiffRep;
-    
-    unsigned numFrames = frameCount();
-    
-    // If numFrames is zero, we know for certain this image doesn't have valid data
-    // Even though the call to CGImageDestinationCreateWithData will fail and we'll handle it gracefully,
-    // in certain circumstances that call will spam the console with an error message
-    if (!numFrames)
-        return 0;
-    CFMutableDataRef data = CFDataCreateMutable(0, 0);
-    // FIXME:  Use type kCGImageTypeIdentifierTIFF constant once is becomes available in the API
-    CGImageDestinationRef destination = CGImageDestinationCreateWithData(data, CFSTR("public.tiff"), numFrames, 0);
-    if (!destination)
-        return 0;
-
-    for (unsigned i = 0; i < numFrames; ++i ) {
-        CGImageRef cgImage = frameAtIndex(i);
-        if (!cgImage) {
-            CFRelease(destination);
-            return 0;    
-        }
-        CGImageDestinationAddImage(destination, cgImage, 0);
-    }
-    CGImageDestinationFinalize(destination);
-    CFRelease(destination);
-
-    m_tiffRep = data;
-    return m_tiffRep;
-}
-
 NSImage* Image::getNSImage()
 {
     if (m_nsImage)
@@ -176,283 +73,4 @@ NSImage* Image::getNSImage()
     return m_nsImage;
 }
 
-CGImageRef Image::getCGImageRef()
-{
-    return frameAtIndex(0);
-}
-
-void Image::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp)
-{
-    if (m_isPDF) {
-        if (m_PDFDoc)
-            m_PDFDoc->draw(ctxt, srcRect, dstRect, compositeOp);
-        return;
-    } 
-    
-    if (!m_source.initialized())
-        return;
-    
-    CGRect fr = ctxt->roundToDevicePixels(srcRect);
-    CGRect ir = ctxt->roundToDevicePixels(dstRect);
-
-    CGImageRef image = frameAtIndex(m_currentFrame);
-    if (!image) // If it's too early we won't have an image yet.
-        return;
-
-    if (m_isSolidColor && m_currentFrame == 0) {
-        if (m_solidColor.alpha() > 0) {
-            ctxt->save();
-            ctxt->setCompositeOperation(!m_solidColor.hasAlpha() && compositeOp == CompositeSourceOver ? CompositeCopy : compositeOp);
-            ctxt->fillRect(ir, m_solidColor);
-            ctxt->restore();
-        }
-        return;
-    }
-
-    CGContextRef context = ctxt->platformContext();
-    ctxt->save();
-
-    // Get the height (in adjusted, i.e. scaled, coords) of the portion of the image
-    // that is currently decoded.  This could be less that the actual height.
-    CGSize selfSize = size();                          // full image size, in pixels
-    float curHeight = CGImageGetHeight(image);         // height of loaded portion, in pixels
-    
-    CGSize adjustedSize = selfSize;
-    if (curHeight < selfSize.height) {
-        adjustedSize.height *= curHeight / selfSize.height;
-
-        // Is the amount of available bands less than what we need to draw?  If so,
-        // we may have to clip 'fr' if it goes outside the available bounds.
-        if (CGRectGetMaxY(fr) > adjustedSize.height) {
-            float frHeight = adjustedSize.height - fr.origin.y; // clip fr to available bounds
-            if (frHeight <= 0)
-                return;                                             // clipped out entirely
-            ir.size.height *= (frHeight / fr.size.height);    // scale ir proportionally to fr
-            fr.size.height = frHeight;
-        }
-    }
-
-    // Flip the coords.
-    ctxt->setCompositeOperation(compositeOp);
-    CGContextTranslateCTM(context, ir.origin.x, ir.origin.y);
-    CGContextScaleCTM(context, 1, -1);
-    CGContextTranslateCTM(context, 0, -ir.size.height);
-    
-    // Translated to origin, now draw at 0,0.
-    ir.origin.x = ir.origin.y = 0;
-    
-    // If we're drawing a sub portion of the image then create
-    // a image for the sub portion and draw that.
-    // Test using example site at http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html
-    if (fr.size.width != adjustedSize.width || fr.size.height != adjustedSize.height) {
-        // Convert ft to image pixel coords:
-        float xscale = adjustedSize.width / selfSize.width;
-        float yscale = adjustedSize.height / curHeight;     // yes, curHeight, not selfSize.height!
-        fr.origin.x /= xscale;
-        fr.origin.y /= yscale;
-        fr.size.width /= xscale;
-        fr.size.height /= yscale;
-        
-        image = CGImageCreateWithImageInRect(image, fr);
-        if (image) {
-            CGContextDrawImage(context, ir, image);
-            CFRelease(image);
-        }
-    } else // Draw the whole image.
-        CGContextDrawImage(context, ir, image);
-
-    ctxt->restore();
-    
-    startAnimation();
-
-}
-
-static void drawPattern(void* info, CGContextRef context)
-{
-    Image* data = (Image*)info;
-    CGImageRef image = data->frameAtIndex(data->currentFrame());
-    float w = CGImageGetWidth(image);
-    float h = CGImageGetHeight(image);
-    CGContextDrawImage(context, GraphicsContext(context).roundToDevicePixels(FloatRect
-        (0, data->size().height() - h, w, h)), image);    
-}
-
-static const CGPatternCallbacks patternCallbacks = { 0, drawPattern, NULL };
-
-void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const FloatPoint& srcPoint,
-                      const FloatSize& tileSize, CompositeOperator op)
-{    
-    CGImageRef image = frameAtIndex(m_currentFrame);
-    if (!image)
-        return;
-
-    if (m_isSolidColor && m_currentFrame == 0) {
-        if (m_solidColor.alpha() > 0) {
-            ctxt->save();
-            ctxt->setCompositeOperation(!m_solidColor.hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
-            ctxt->fillRect(destRect, m_solidColor);
-            ctxt->restore();
-        }
-        return;
-    }
-
-    CGPoint scaledPoint = srcPoint;
-    CGSize intrinsicTileSize = size();
-    CGSize scaledTileSize = intrinsicTileSize;
-
-    // If tileSize is not equal to the intrinsic size of the image, set patternTransform
-    // to the appropriate scalar matrix, scale the source point, and set the size of the
-    // scaled tile. 
-    float scaleX = 1.0;
-    float scaleY = 1.0;
-    CGAffineTransform patternTransform = CGAffineTransformIdentity;
-    if (tileSize.width() != intrinsicTileSize.width || tileSize.height() != intrinsicTileSize.height) {
-        scaleX = tileSize.width() / intrinsicTileSize.width;
-        scaleY = tileSize.height() / intrinsicTileSize.height;
-        patternTransform = CGAffineTransformMakeScale(scaleX, scaleY);
-        scaledTileSize = tileSize;
-    }
-
-    // Check and see if a single draw of the image can cover the entire area we are supposed to tile.
-    NSRect oneTileRect;
-    oneTileRect.origin.x = destRect.x() + fmodf(fmodf(-scaledPoint.x, scaledTileSize.width) - 
-                            scaledTileSize.width, scaledTileSize.width);
-    oneTileRect.origin.y = destRect.y() + fmodf(fmodf(-scaledPoint.y, scaledTileSize.height) - 
-                            scaledTileSize.height, scaledTileSize.height);
-    oneTileRect.size.width = scaledTileSize.width;
-    oneTileRect.size.height = scaledTileSize.height;
-
-    // If the single image draw covers the whole area, then just draw once.
-    if (NSContainsRect(oneTileRect, destRect)) {
-        CGRect fromRect;
-        fromRect.origin.x = (destRect.x() - oneTileRect.origin.x) / scaleX;
-        fromRect.origin.y = (destRect.y() - oneTileRect.origin.y) / scaleY;
-        fromRect.size.width = destRect.width() / scaleX;
-        fromRect.size.height = destRect.height() / scaleY;
-
-        draw(ctxt, destRect, fromRect, op);
-        return;
-    }
-
-    CGPatternRef pattern = CGPatternCreate(this, CGRectMake(0, 0, intrinsicTileSize.width, intrinsicTileSize.height),
-                                           patternTransform, intrinsicTileSize.width, intrinsicTileSize.height, 
-                                           kCGPatternTilingConstantSpacing, true, &patternCallbacks);
-    
-    if (pattern) {
-        CGContextRef context = ctxt->platformContext();
-
-        ctxt->save();
-
-        wkSetPatternPhaseInUserSpace(context, CGPointMake(oneTileRect.origin.x, oneTileRect.origin.y));
-
-        CGColorSpaceRef patternSpace = CGColorSpaceCreatePattern(NULL);
-        CGContextSetFillColorSpace(context, patternSpace);
-        CGColorSpaceRelease(patternSpace);
-
-        CGFloat patternAlpha = 1;
-        CGContextSetFillPattern(context, pattern, &patternAlpha);
-
-        ctxt->setCompositeOperation(op);
-
-        CGContextFillRect(context, destRect);
-
-        ctxt->restore();
-
-        CGPatternRelease(pattern);
-    }
-    
-    startAnimation();
-}
-
-// FIXME: Merge with the other drawTiled eventually, since we need a combination of both for some things.
-void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, TileRule hRule,
-                      TileRule vRule, CompositeOperator op)
-{    
-    CGImageRef image = frameAtIndex(m_currentFrame);
-    if (!image)
-        return;
-
-    if (m_isSolidColor && m_currentFrame == 0) {
-        if (m_solidColor.alpha() > 0) {
-            ctxt->save();
-            ctxt->setCompositeOperation(!m_solidColor.hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
-            ctxt->fillRect(dstRect, m_solidColor);
-            ctxt->restore();
-        }
-        return;
-    }
-
-    ctxt->save();
-
-    CGSize tileSize = srcRect.size();
-    CGRect ir = dstRect;
-    CGRect fr = srcRect;
-
-    // Now scale the slice in the appropriate direction using an affine transform that we will pass into
-    // the pattern.
-    float scaleX = 1.0f, scaleY = 1.0f;
-
-    if (hRule == Image::StretchTile)
-        scaleX = ir.size.width / fr.size.width;
-    if (vRule == Image::StretchTile)
-        scaleY = ir.size.height / fr.size.height;
-    
-    if (hRule == Image::RepeatTile)
-        scaleX = scaleY;
-    if (vRule == Image::RepeatTile)
-        scaleY = scaleX;
-        
-    if (hRule == Image::RoundTile) {
-        // Complicated math ensues.
-        float imageWidth = fr.size.width * scaleY;
-        float newWidth = ir.size.width / ceilf(ir.size.width / imageWidth);
-        scaleX = newWidth / fr.size.width;
-    }
-    
-    if (vRule == Image::RoundTile) {
-        // More complicated math ensues.
-        float imageHeight = fr.size.height * scaleX;
-        float newHeight = ir.size.height / ceilf(ir.size.height / imageHeight);
-        scaleY = newHeight / fr.size.height;
-    }
-    
-    CGAffineTransform patternTransform = CGAffineTransformMakeScale(scaleX, scaleY);
-
-    // Possible optimization:  We may want to cache the CGPatternRef    
-    CGPatternRef pattern = CGPatternCreate(this, CGRectMake(fr.origin.x, fr.origin.y, tileSize.width, tileSize.height),
-                                           patternTransform, tileSize.width, tileSize.height, 
-                                           kCGPatternTilingConstantSpacing, true, &patternCallbacks);
-    if (pattern) {
-        CGContextRef context = ctxt->platformContext();
-    
-        // We want to construct the phase such that the pattern is centered (when stretch is not
-        // set for a particular rule).
-        float hPhase = scaleX * fr.origin.x;
-        float vPhase = scaleY * (tileSize.height - fr.origin.y);
-        if (hRule == Image::RepeatTile)
-            hPhase -= fmodf(ir.size.width, scaleX * tileSize.width) / 2.0f;
-        if (vRule == Image::RepeatTile)
-            vPhase -= fmodf(ir.size.height, scaleY * tileSize.height) / 2.0f;
-        
-        wkSetPatternPhaseInUserSpace(context, CGPointMake(ir.origin.x - hPhase, ir.origin.y - vPhase));
-
-        CGColorSpaceRef patternSpace = CGColorSpaceCreatePattern(NULL);
-        CGContextSetFillColorSpace(context, patternSpace);
-        CGColorSpaceRelease(patternSpace);
-
-        CGFloat patternAlpha = 1;
-        CGContextSetFillPattern(context, pattern, &patternAlpha);
-
-        ctxt->setCompositeOperation(op);
-        
-        CGContextFillRect(context, ir);
-
-        CGPatternRelease(pattern);
-    }
-
-    ctxt->restore();
-
-    startAnimation();
-}
-
 }
index 8eb012ef678563f7490173cb081501b440ac81a5..7a2e730ed8e6b749656f56cafde0e7114669df8c 100644 (file)
 
 namespace WebCore {
 
-IntPoint::IntPoint(const CGPoint& p) : m_x(static_cast<int>(p.x)), m_y(static_cast<int>(p.y))
-{
-}
-
-IntPoint::operator CGPoint() const
-{
-    return CGPointMake(m_x, m_y);
-}
-
 #ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
 
 IntPoint::IntPoint(const NSPoint& p) : m_x(static_cast<int>(p.x)), m_y(static_cast<int>(p.y))
index 7997919ec7fef538715281027169f5e651ce1133..738618a1983ac775c3598a56345b94dae4b26a14 100644 (file)
 
 namespace WebCore {
 
-IntRect::operator CGRect() const
-{
-    return CGRectMake(x(), y(), width(), height());
-}
-
-IntRect enclosingIntRect(const CGRect& rect)
-{
-    int l = static_cast<int>(floorf(rect.origin.x));
-    int t = static_cast<int>(floorf(rect.origin.y));
-    int r = static_cast<int>(ceilf(CGRectGetMaxX(rect)));
-    int b = static_cast<int>(ceilf(CGRectGetMaxY(rect)));
-    return IntRect(l, t, r - l, b - t);
-}
-
 #ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
 
 IntRect::operator NSRect() const
index a80eaca0f3de06834ba63b156d65e9a41ef9aa7b..c7dcd88c88e0714cae158631ae8f3319b3dcbd6b 100644 (file)
 
 namespace WebCore {
 
-IntSize::IntSize(const CGSize& s) : m_width(static_cast<int>(s.width)), m_height(static_cast<int>(s.height))
-{
-}
-
-IntSize::operator CGSize() const
-{
-    return CGSizeMake(m_width, m_height);
-}
-
 #ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
 
 IntSize::IntSize(const NSSize& s) : m_width(static_cast<int>(s.width)), m_height(static_cast<int>(s.height))