2006-10-09 Oliver Hunt <ohunt@apple.com>
authoroliver <oliver@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Oct 2006 01:09:52 +0000 (01:09 +0000)
committeroliver <oliver@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Oct 2006 01:09:52 +0000 (01:09 +0000)
        Reviewed by Anders.

        Correcting ifdef's

        * html/CanvasGradient.cpp:
        (WebCore::CanvasGradient::CanvasGradient):
        (WebCore::CanvasGradient::~CanvasGradient):
        (WebCore::CanvasGradient::addColorStop):
        * html/CanvasGradient.h:
        * html/CanvasPattern.cpp:
        (WebCore::CanvasPattern::CanvasPattern):
        (WebCore::CanvasPattern::~CanvasPattern):
        * html/CanvasPattern.h:
        * html/CanvasRenderingContext2D.cpp:
        (WebCore::CanvasRenderingContext2D::fill):
        (WebCore::CanvasRenderingContext2D::stroke):
        (WebCore::CanvasRenderingContext2D::fillRect):
        (WebCore::CanvasRenderingContext2D::setShadow):
        (WebCore::CanvasRenderingContext2D::applyShadow):
        (WebCore::CanvasRenderingContext2D::drawImage):
        (WebCore::CanvasRenderingContext2D::createPattern):
        (WebCore::CanvasRenderingContext2D::applyStrokePattern):
        (WebCore::CanvasRenderingContext2D::applyFillPattern):
        * html/CanvasRenderingContext2D.h:
        * html/CanvasStyle.cpp:
        (WebCore::CanvasStyle::applyStrokeColor):
        (WebCore::CanvasStyle::applyFillColor):
        * html/HTMLCanvasElement.cpp:
        (WebCore::HTMLCanvasElement::paint):
        (WebCore::HTMLCanvasElement::createDrawingContext):
        * html/HTMLCanvasElement.h:

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

WebCore/ChangeLog
WebCore/html/CanvasGradient.cpp
WebCore/html/CanvasGradient.h
WebCore/html/CanvasPattern.cpp
WebCore/html/CanvasPattern.h
WebCore/html/CanvasRenderingContext2D.cpp
WebCore/html/CanvasRenderingContext2D.h
WebCore/html/CanvasStyle.cpp
WebCore/html/HTMLCanvasElement.cpp
WebCore/html/HTMLCanvasElement.h

index d21280dec6f49ebeb3bae8198d7726011f49f11e..7782d5dcf22d72d3dde3337603a9a0cb2ef4713c 100644 (file)
@@ -1,3 +1,37 @@
+2006-10-09  Oliver Hunt <ohunt@apple.com>
+
+        Reviewed by Anders.
+
+        Correcting ifdef's
+
+        * html/CanvasGradient.cpp:
+        (WebCore::CanvasGradient::CanvasGradient):
+        (WebCore::CanvasGradient::~CanvasGradient):
+        (WebCore::CanvasGradient::addColorStop):
+        * html/CanvasGradient.h:
+        * html/CanvasPattern.cpp:
+        (WebCore::CanvasPattern::CanvasPattern):
+        (WebCore::CanvasPattern::~CanvasPattern):
+        * html/CanvasPattern.h:
+        * html/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::fill):
+        (WebCore::CanvasRenderingContext2D::stroke):
+        (WebCore::CanvasRenderingContext2D::fillRect):
+        (WebCore::CanvasRenderingContext2D::setShadow):
+        (WebCore::CanvasRenderingContext2D::applyShadow):
+        (WebCore::CanvasRenderingContext2D::drawImage):
+        (WebCore::CanvasRenderingContext2D::createPattern):
+        (WebCore::CanvasRenderingContext2D::applyStrokePattern):
+        (WebCore::CanvasRenderingContext2D::applyFillPattern):
+        * html/CanvasRenderingContext2D.h:
+        * html/CanvasStyle.cpp:
+        (WebCore::CanvasStyle::applyStrokeColor):
+        (WebCore::CanvasStyle::applyFillColor):
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::paint):
+        (WebCore::HTMLCanvasElement::createDrawingContext):
+        * html/HTMLCanvasElement.h:
+
 2006-10-09  Adam Roben  <aroben@apple.com>
 
         Reviewed by Maciej.
index 604dd0c2ad04873f778740c5bbcd9ed75b7e1a3f..73d749886a9d1b07c7bb3f60bc33202f93e96e5d 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "cssparser.h"
 
-#if __APPLE__
+#if PLATFORM(CG)
 #include <ApplicationServices/ApplicationServices.h>
 #endif
 
@@ -36,7 +36,7 @@ namespace WebCore {
 
 CanvasGradient::CanvasGradient(const FloatPoint& p0, const FloatPoint& p1)
     : m_radial(false), m_p0(p0), m_p1(p1), m_stopsSorted(false), m_lastStop(0)
-#if __APPLE__
+#if PLATFORM(CG)
     , m_shading(0)
 #endif
 {
@@ -44,7 +44,7 @@ CanvasGradient::CanvasGradient(const FloatPoint& p0, const FloatPoint& p1)
 
 CanvasGradient::CanvasGradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1)
     : m_radial(true), m_p0(p0), m_p1(p1), m_r0(r0), m_r1(r1), m_stopsSorted(false), m_lastStop(0)
-#if __APPLE__
+#if PLATFORM(CG)
     , m_shading(0)
 #endif
 {
@@ -52,7 +52,7 @@ CanvasGradient::CanvasGradient(const FloatPoint& p0, float r0, const FloatPoint&
 
 CanvasGradient::~CanvasGradient()
 {
-#if __APPLE__
+#if PLATFORM(CG)
     CGShadingRelease(m_shading);
 #endif
 }
@@ -68,13 +68,13 @@ void CanvasGradient::addColorStop(float value, const String& color)
 
     m_stopsSorted = false;
 
-#if __APPLE__
+#if PLATFORM(CG)
     CGShadingRelease(m_shading);
     m_shading = 0;
 #endif
 }
 
-#if __APPLE__
+#if PLATFORM(CG)
 
 static void gradientCallback(void* info, const CGFloat* in, CGFloat* out)
 {
index 3c960784a9ce06c6c68a265f8cfbf5afbea2754e..c2a5fd86cb3324aa2eda87c1fdf9e9083fdadc1a 100644 (file)
@@ -30,7 +30,7 @@
 #include "Shared.h"
 #include <wtf/Vector.h>
 
-#if __APPLE__
+#if PLATFORM(CG)
 typedef struct CGShading* CGShadingRef;
 #endif
 
@@ -48,7 +48,7 @@ namespace WebCore {
 
         void getColor(float value, float* r, float* g, float* b, float* a);
 
-#if __APPLE__
+#if PLATFORM(CG)
         CGShadingRef platformShading();
 #endif
 
@@ -73,7 +73,7 @@ namespace WebCore {
         mutable bool m_stopsSorted;
         mutable int m_lastStop;
 
-#if __APPLE__
+#if PLATFORM(CG)
         CGShadingRef m_shading;
 #endif
     };
index 058fd13801c079b86665fec40daa659d5337e68c..f0382f781aa6e9df57639439faf92c5c32f54dc7 100644 (file)
@@ -63,7 +63,7 @@ void CanvasPattern::parseRepetitionType(const String& type, bool& repeatX, bool&
     ec = SYNTAX_ERR;
 }
 
-#if __APPLE__
+#if PLATFORM(CG)
 
 CanvasPattern::CanvasPattern(CGImageRef image, bool repeatX, bool repeatY)
     : m_platformImage(image)
@@ -77,7 +77,7 @@ CanvasPattern::CanvasPattern(CGImageRef image, bool repeatX, bool repeatY)
 
 CanvasPattern::CanvasPattern(CachedImage* cachedImage, bool repeatX, bool repeatY)
     :
-#if __APPLE__
+#if PLATFORM(CG)
       m_platformImage(0)
     ,
 #endif
@@ -91,14 +91,14 @@ CanvasPattern::CanvasPattern(CachedImage* cachedImage, bool repeatX, bool repeat
 
 CanvasPattern::~CanvasPattern()
 {
-#if __APPLE__
+#if PLATFORM(CG)
     CGImageRelease(m_platformImage);
 #endif
     if (m_cachedImage)
         m_cachedImage->deref(this);
 }
 
-#if __APPLE__
+#if PLATFORM(CG)
 
 static void patternCallback(void* info, CGContextRef context)
 {
index 57b489b0f0e9ed681741ffb7509f66a260ba58c8..68bc9492854139133a5c787a0de35daa47ab276c 100644 (file)
@@ -29,7 +29,7 @@
 #include "CachedResourceClient.h"
 #include "Shared.h"
 
-#if __APPLE__
+#if PLATFORM(CG)
 #include <ApplicationServices/ApplicationServices.h>
 #endif
 
@@ -44,23 +44,23 @@ namespace WebCore {
     public:
         static void parseRepetitionType(const String&, bool& repeatX, bool& repeatY, ExceptionCode&);
 
-#if __APPLE__
+#if PLATFORM(CG)
         CanvasPattern(CGImageRef, bool repeatX, bool repeatY);
 #endif
         CanvasPattern(CachedImage*, bool repeatX, bool repeatY);
         ~CanvasPattern();
 
-#if __APPLE__
+#if PLATFORM(CG)
         CGImageRef platformImage() const { return m_platformImage; }
 #endif
         CachedImage* cachedImage() const { return m_cachedImage; }
 
-#if __APPLE__
+#if PLATFORM(CG)
         CGPatternRef createPattern(const CGAffineTransform&);
 #endif
 
     private:
-#if __APPLE__
+#if PLATFORM(CG)
         const CGImageRef m_platformImage;
 #endif
         CachedImage* const m_cachedImage;
index b913b3876ce0bae27820583a4b90fd89db679fa4..f86b4f5e41b7631b90862ee5b9f12562c5a8371b 100644 (file)
@@ -420,7 +420,7 @@ void CanvasRenderingContext2D::fill()
     if (!c)
         return;
     // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
     CGContextBeginPath(c->platformContext());
     CGContextAddPath(c->platformContext(), state().m_path.platformPath());
 
@@ -446,7 +446,7 @@ void CanvasRenderingContext2D::stroke()
     if (!c)
         return;
     // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
     CGContextBeginPath(c->platformContext());
     CGContextAddPath(c->platformContext(), state().m_path.platformPath());
 
@@ -507,7 +507,7 @@ void CanvasRenderingContext2D::fillRect(float x, float y, float width, float hei
     if (!c)
         return;
     // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
     CGRect rect = CGRectMake(x, y, width, height);
 
     willDraw(rect);
@@ -583,7 +583,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur,
     if (!c)
         return;
     // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
     const CGFloat components[2] = { grayLevel, 1 };
     CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();
     CGColorRef color = CGColorCreate(colorSpace, components);
@@ -603,7 +603,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur,
     if (!c)
         return;
     // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
     RGBA32 rgba = CSSParser::parseColor(color);
     const CGFloat components[4] = {
         ((rgba >> 16) & 0xFF) / 255.0,
@@ -629,7 +629,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur,
     if (!c)
         return;
     // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
     const CGFloat components[2] = { grayLevel, alpha };
     CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();
     CGColorRef color = CGColorCreate(colorSpace, components);
@@ -649,7 +649,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur,
     if (!c)
         return;
     // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
     const CGFloat components[4] = { r, g, b, a };
     CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
     CGColorRef shadowColor = CGColorCreate(colorSpace, components);
@@ -669,7 +669,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur,
     if (!dc)
         return;
     // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
     const CGFloat components[5] = { c, m, y, k, a };
     CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceCMYK();
     CGColorRef shadowColor = CGColorCreate(colorSpace, components);
@@ -693,7 +693,7 @@ void CanvasRenderingContext2D::applyShadow()
     if (!c)
         return;
     // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
     RGBA32 rgba = state().m_shadowColor.isEmpty() ? 0 : CSSParser::parseColor(state().m_shadowColor);
     const CGFloat components[4] = {
         ((rgba >> 16) & 0xFF) / 255.0,
@@ -797,7 +797,7 @@ void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, const FloatR
     FloatRect destRect = c->roundToDevicePixels(dstRect);
         
     // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
     CGImageRef platformImage = canvas->createPlatformImage();
     if (!platformImage)
         return;
@@ -903,7 +903,7 @@ PassRefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLCanvasElem
     if (ec)
         return 0;
     // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
     CGImageRef image = canvas->createPlatformImage();
     if (!image)
         return 0;
@@ -935,7 +935,7 @@ void CanvasRenderingContext2D::applyStrokePattern()
     if (!c)
         return;
 
-#if __APPLE__
+#if PLATFORM(CG)
     // Check for case where the pattern is already set.
     CGAffineTransform m = CGContextGetCTM(c->platformContext());
     if (state().m_appliedStrokePattern
@@ -969,7 +969,7 @@ void CanvasRenderingContext2D::applyFillPattern()
     if (!c)
         return;
 
-#if __APPLE__
+#if PLATFORM(CG)
     // Check for case where the pattern is already set.
     CGAffineTransform m = CGContextGetCTM(c->platformContext());
     if (state().m_appliedFillPattern
index 47ea82169196e7a94dbf7d557768d3fae319fc3b..cd35632626be023524ea0ef27f3fdecf979108f2 100644 (file)
@@ -32,7 +32,7 @@
 #include "PlatformString.h"
 #include <wtf/Vector.h>
 
-#if __APPLE__
+#if PLATFORM(CG)
 #include <ApplicationServices/ApplicationServices.h>
 #endif
 
@@ -181,7 +181,7 @@ namespace WebCore {
             CompositeOperator m_globalComposite;
             bool m_appliedStrokePattern;
             bool m_appliedFillPattern;
-#if __APPLE__
+#if PLATFORM(CG)
             CGAffineTransform m_strokeStylePatternTransform;
             CGAffineTransform m_fillStylePatternTransform;
 #endif
index c0ef8687c4071c46c42b3befdf7df51f4f728e34..92b917f1ec77f091e4dc6a619d8418ded988825a 100644 (file)
@@ -82,7 +82,7 @@ void CanvasStyle::applyStrokeColor(GraphicsContext* context)
         case ColorString: {
             RGBA32 color = CSSParser::parseColor(m_color);
             // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
             CGContextSetRGBStrokeColor(context->platformContext(),
                 ((color >> 16) & 0xFF) / 255.0,
                 ((color >> 8) & 0xFF) / 255.0,
@@ -94,7 +94,7 @@ void CanvasStyle::applyStrokeColor(GraphicsContext* context)
         case ColorStringWithAlpha: {
             RGBA32 color = CSSParser::parseColor(m_color);
             // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
             CGContextSetRGBStrokeColor(context->platformContext(),
                 ((color >> 16) & 0xFF) / 255.0,
                 ((color >> 8) & 0xFF) / 255.0,
@@ -105,19 +105,19 @@ void CanvasStyle::applyStrokeColor(GraphicsContext* context)
         }
         case GrayLevel:
             // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
             CGContextSetGrayStrokeColor(context->platformContext(), m_grayLevel, m_alpha);
 #endif
             break;
         case RGBA:
             // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
             CGContextSetRGBStrokeColor(context->platformContext(), m_red, m_green, m_blue, m_alpha);
 #endif
             break;
         case CMYKA:
             // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
             CGContextSetCMYKStrokeColor(context->platformContext(), m_cyan, m_magenta, m_yellow, m_black, m_alpha);
 #endif
             break;
@@ -135,7 +135,7 @@ void CanvasStyle::applyFillColor(GraphicsContext* context)
         case ColorString: {
             RGBA32 color = CSSParser::parseColor(m_color);
             // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
             CGContextSetRGBFillColor(context->platformContext(),
                 ((color >> 16) & 0xFF) / 255.0,
                 ((color >> 8) & 0xFF) / 255.0,
@@ -147,7 +147,7 @@ void CanvasStyle::applyFillColor(GraphicsContext* context)
         case ColorStringWithAlpha: {
             RGBA32 color = CSSParser::parseColor(m_color);
             // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
             CGContextSetRGBFillColor(context->platformContext(),
                 ((color >> 16) & 0xFF) / 255.0,
                 ((color >> 8) & 0xFF) / 255.0,
@@ -158,19 +158,19 @@ void CanvasStyle::applyFillColor(GraphicsContext* context)
         }
         case GrayLevel:
             // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
             CGContextSetGrayFillColor(context->platformContext(), m_grayLevel, m_alpha);
 #endif
             break;
         case RGBA:
             // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
             CGContextSetRGBFillColor(context->platformContext(), m_red, m_green, m_blue, m_alpha);
 #endif
             break;
         case CMYKA:
             // FIXME: Do this through platform-independent GraphicsContext API.
-#if __APPLE__
+#if PLATFORM(CG)
             CGContextSetCMYKFillColor(context->platformContext(), m_cyan, m_magenta, m_yellow, m_black, m_alpha);
 #endif
             break;
index 16ddebc05224d11bb9e322acf44d002289a977aa..d90d89ecd5250a3b568a24f66ecce1c9be89f331 100644 (file)
@@ -138,7 +138,7 @@ void HTMLCanvasElement::paint(GraphicsContext* p, const IntRect& r)
 {
     if (p->paintingDisabled())
         return;
-#if __APPLE__
+#if PLATFORM(CG)
     if (CGImageRef image = createPlatformImage()) {
         CGContextDrawImage(p->platformContext(), p->roundToDevicePixels(r), image);
         CGImageRelease(image);
@@ -171,7 +171,7 @@ void HTMLCanvasElement::createDrawingContext() const
     m_data = fastCalloc(h, bytesPerRow);
     if (!m_data)
         return;
-#if __APPLE__
+#if PLATFORM(CG)
     CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
     CGContextRef bitmapContext = CGBitmapContextCreate(m_data, w, h, 8, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast);
     CGContextScaleCTM(bitmapContext, w / unscaledWidth, h / unscaledHeight);
@@ -188,7 +188,7 @@ GraphicsContext* HTMLCanvasElement::drawingContext() const
     return m_drawingContext;
 }
 
-#if __APPLE__
+#if PLATFORM(CG)
 
 CGImageRef HTMLCanvasElement::createPlatformImage() const
 {
index 3dce2893f2625dab1e01cb9d677efb6825ce08f9..4acabe740f0aca9cdc1d547e9638453ec56106ce 100644 (file)
@@ -29,8 +29,8 @@
 #include "HTMLElement.h"
 #include "IntSize.h"
 
-#if __APPLE__
-// FIXME: Mac-specific parts need to move to the platform directory.
+#if PLATFORM(CG)
+// FIXME: CG-specific parts need to move to the platform directory.
 typedef struct CGContext* CGContextRef;
 typedef struct CGImage* CGImageRef;
 #endif
@@ -65,7 +65,7 @@ public:
 
     GraphicsContext* drawingContext() const;
 
-#if __APPLE__
+#if PLATFORM(CG)
     CGImageRef createPlatformImage() const;
 #endif