Changeset 129005 in webkit


Ignore:
Timestamp:
Sep 19, 2012 7:42:52 AM (12 years ago)
Author:
Patrick Gansterer
Message:

Remove all usages of M_PI from WebCore
https://bugs.webkit.org/show_bug.cgi?id=93109

Reviewed by Dirk Schulze.

<wtf/MathExtras.h> implements many functions dealing with M_PI.
Use them in WebCore instead of duplicating the functionality.

  • platform/blackberry/PlatformTouchEventBlackBerry.cpp:

(WebCore::PlatformTouchEvent::PlatformTouchEvent):

  • platform/graphics/ca/mac/PlatformCALayerMac.mm:

(PlatformCALayer::setFilters):

  • platform/graphics/cairo/GraphicsContextCairo.cpp:

(WebCore::GraphicsContext::drawEllipse):
(WebCore::GraphicsContext::strokeArc):

  • platform/graphics/wx/FontPlatformDataWxMac.mm:
  • platform/mac/WebWindowAnimation.mm:

(-[WebWindowScaleAnimation currentValue]):

  • platform/wx/wxcode/gdiplus/non-kerned-drawing.cpp:

(DegToRad):
(RadToDeg):

Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r129003 r129005  
     12012-09-19  Patrick Gansterer  <paroga@webkit.org>
     2
     3        Remove all usages of M_PI from WebCore
     4        https://bugs.webkit.org/show_bug.cgi?id=93109
     5
     6        Reviewed by Dirk Schulze.
     7
     8        <wtf/MathExtras.h> implements many functions dealing with M_PI.
     9        Use them in WebCore instead of duplicating the functionality.
     10
     11        * platform/blackberry/PlatformTouchEventBlackBerry.cpp:
     12        (WebCore::PlatformTouchEvent::PlatformTouchEvent):
     13        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
     14        (PlatformCALayer::setFilters):
     15        * platform/graphics/cairo/GraphicsContextCairo.cpp:
     16        (WebCore::GraphicsContext::drawEllipse):
     17        (WebCore::GraphicsContext::strokeArc):
     18        * platform/graphics/wx/FontPlatformDataWxMac.mm:
     19        * platform/mac/WebWindowAnimation.mm:
     20        (-[WebWindowScaleAnimation currentValue]):
     21        * platform/wx/wxcode/gdiplus/non-kerned-drawing.cpp:
     22        (DegToRad):
     23        (RadToDeg):
     24
    1252012-09-10  Vsevolod Vlasov  <vsevik@chromium.org>
    226
  • trunk/Source/WebCore/platform/blackberry/PlatformTouchEventBlackBerry.cpp

    r112792 r129005  
    2323#include "PlatformTouchEvent.h"
    2424
     25#if ENABLE(TOUCH_EVENTS)
     26
    2527#include <BlackBerryPlatformTouchEvent.h>
    26 
    2728#include <wtf/CurrentTime.h>
    28 
    29 #if ENABLE(TOUCH_EVENTS)
     29#include <wtf/MathExtras.h>
    3030
    3131namespace WebCore {
     
    6767        BlackBerry::Platform::PinchGestureData* data = static_cast<BlackBerry::Platform::PinchGestureData*>(pinch.m_data);
    6868        if (data) {
    69             m_rotation = data->m_angle * 180 / M_PI;
     69            m_rotation = rad2deg(data->m_angle);
    7070            m_scale = data->m_scale;
    7171        }
  • trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm

    r122670 r129005  
    4343#import <QuartzCore/QuartzCore.h>
    4444#import <wtf/CurrentTime.h>
     45#import <wtf/MathExtras.h>
    4546#import <wtf/UnusedParam.h>
    4647
     
    756757           
    757758            // The CIHueAdjust value is in radians
    758             [caFilter setValue:[NSNumber numberWithFloat:op->amount() * M_PI * 2 / 360] forKey:@"inputAngle"];
     759            [caFilter setValue:[NSNumber numberWithFloat:deg2rad(op->amount())] forKey:@"inputAngle"];
    759760            [caFilter setName:filterName];
    760761            [array.get() addObject:caFilter];
  • trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

    r128570 r129005  
    6666using namespace std;
    6767
    68 #ifndef M_PI
    69 #define M_PI 3.14159265358979323846
    70 #endif
    71 
    7268namespace WebCore {
    7369
     
    354350    cairo_translate(cr, rect.x() + xRadius, rect.y() + yRadius);
    355351    cairo_scale(cr, xRadius, yRadius);
    356     cairo_arc(cr, 0., 0., 1., 0., 2 * M_PI);
     352    cairo_arc(cr, 0., 0., 1., 0., 2 * piFloat);
    357353    cairo_restore(cr);
    358354
     
    393389        cairo_scale(cr, 1., scaleFactor);
    394390
    395     cairo_arc_negative(cr, x + hRadius, (y + vRadius) * reverseScaleFactor, hRadius, -fa * M_PI/180, -falen * M_PI/180);
     391    cairo_arc_negative(cr, x + hRadius, (y + vRadius) * reverseScaleFactor, hRadius, deg2rad(-fa), deg2rad(-falen));
    396392
    397393    if (w != h)
  • trunk/Source/WebCore/platform/graphics/wx/FontPlatformDataWxMac.mm

    r95901 r129005  
    3030#include "FontPlatformData.h"
    3131
     32#include <wtf/MathExtras.h>
    3233#include <wx/defs.h>
    3334#include <wx/font.h>
     
    4243#if !wxCHECK_VERSION(2,9,0) || !wxOSX_USE_COCOA
    4344
    44 static inline double DegToRad(double deg)
    45 {
    46     return (deg * M_PI) / 180.0;
    47 }
    48 
    49 static const NSAffineTransformStruct kSlantNSTransformStruct = { 1, 0, tan(DegToRad(11)), 1, 0, 0  };
     45static const NSAffineTransformStruct kSlantNSTransformStruct = { 1, 0, tan(deg2rad(11)), 1, 0, 0  };
    5046
    5147NSFont* OSXCreateNSFont(const wxNativeFontInfo* info)
  • trunk/Source/WebCore/platform/mac/WebWindowAnimation.mm

    r115847 r129005  
    3131#import "WebCoreSystemInterface.h"
    3232#import <wtf/Assertions.h>
     33#import <wtf/MathExtras.h>
    3334#import <wtf/UnusedParam.h>
    3435
     
    102103- (float)currentValue
    103104{
    104     return narrowPrecisionToFloat(0.5 - 0.5 * cos(M_PI * (1 - [self currentProgress])));
     105    return narrowPrecisionToFloat(0.5 - 0.5 * cos(piDouble * (1 - [self currentProgress])));
    105106}
    106107
  • trunk/Source/WebCore/platform/wx/wxcode/gdiplus/non-kerned-drawing.cpp

    r95901 r129005  
    3030#include "GraphicsContext.h"
    3131#include "SimpleFontData.h"
    32 
     32#include <wtf/MathExtras.h>
    3333#include <wx/defs.h>
    3434
     
    4646//-----------------------------------------------------------------------------
    4747
    48 const double RAD2DEG = 180.0 / M_PI;
     48const double RAD2DEG = 180.0 / piDouble;
    4949
    5050//-----------------------------------------------------------------------------
     
    5555static inline double dmax(double a, double b) { return a > b ? a : b; }
    5656
    57 static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; }
    58 static inline double RadToDeg(double deg) { return (deg * 180.0) / M_PI; }
     57static inline double DegToRad(double deg) { return deg2rad(deg); }
     58static inline double RadToDeg(double rad) { return rad2deg(rad); }
    5959
    6060#include "wx/msw/private.h"
Note: See TracChangeset for help on using the changeset viewer.