⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 109255 in webkit


Ignore:
Timestamp:
Feb 29, 2012, 1:36:12 PM (15 years ago)
Author:
timothy_horton@apple.com
Message:

Make use of CG rounded-rect primitives
​https://bugs.webkit.org/show_bug.cgi?id=79932
<rdar://problem/9274953>

Reviewed by Simon Fraser.

Dispatch to potentially platform-specific rounded rectangle path
construction from addPathForRoundedRect. Make use of this to call
wkCGPathAddRoundedRect on Lion and above, as long as the rounded
corners are all equivalent.

No new tests, as this is covered by many that use rounded corners,
and is only a performance improvement.

  • WebCore.exp.in:
  • platform/graphics/Path.cpp:

(WebCore::Path::addRoundedRect):
(WebCore):
(WebCore::Path::addPathForRoundedRect):

  • platform/graphics/Path.h:

(Path):

  • platform/graphics/cg/PathCG.cpp:

(WebCore::Path::addPathForRoundedRect):
(WebCore):

  • platform/mac/WebCoreSystemInterface.h:
  • platform/mac/WebCoreSystemInterface.mm:

Add wkCGPathAddRoundedRect.

  • WebCoreSupport/WebSystemInterface.mm:

(InitWebCoreSystemInterface):

  • WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:

(InitWebCoreSystemInterface):

  • WebKitSystemInterface.h:
  • libWebKitSystemInterfaceLeopard.a:
  • libWebKitSystemInterfaceLion.a:
  • libWebKitSystemInterfaceSnowLeopard.a:
Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r109252 r109255  
     12012-02-29  Tim Horton  <timothy_horton@apple.com>
     2
     3        Make use of CG rounded-rect primitives
     4        https://bugs.webkit.org/show_bug.cgi?id=79932
     5        <rdar://problem/9274953>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Dispatch to potentially platform-specific rounded rectangle path
     10        construction from addPathForRoundedRect. Make use of this to call
     11        wkCGPathAddRoundedRect on Lion and above, as long as the rounded
     12        corners are all equivalent.
     13
     14        No new tests, as this is covered by many that use rounded corners,
     15        and is only a performance improvement.
     16
     17        * WebCore.exp.in:
     18        * platform/graphics/Path.cpp:
     19        (WebCore::Path::addRoundedRect):
     20        (WebCore):
     21        (WebCore::Path::addPathForRoundedRect):
     22        * platform/graphics/Path.h:
     23        (Path):
     24        * platform/graphics/cg/PathCG.cpp:
     25        (WebCore::Path::addPathForRoundedRect):
     26        (WebCore):
     27        * platform/mac/WebCoreSystemInterface.h:
     28        * platform/mac/WebCoreSystemInterface.mm:
     29
    1302012-02-29  Leo Yang  <leo.yang@torchmobile.com.cn>
    231
  • trunk/Source/WebCore/WebCore.exp.in

    r109184 r109255  
    15171517_wkCGContextGetShouldSmoothFonts
    15181518_wkCGContextResetClip
     1519#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     1520_wkCGPathAddRoundedRect
     1521#endif
    15191522_wkCGPatternCreateWithImageAndTransform
    15201523_wkCopyCFLocalizationPreferredName
  • trunk/Source/WebCore/platform/graphics/Path.cpp

    r99460 r109255  
    116116        radius.setHeight(halfSize.height());
    117117
    118     addBeziersForRoundedRect(rect, radius, radius, radius, radius);
     118    addPathForRoundedRect(rect, radius, radius, radius, radius);
    119119}
    120120
    … …  
    133133    }
    134134
     135    addPathForRoundedRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
     136}
     137
     138#if !USE(CG)
     139void Path::addPathForRoundedRect(const FloatRect& rect, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius)
     140{
    135141    addBeziersForRoundedRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
    136142}
     143#endif
    137144
    138145// Approximation of control point positions on a bezier to simulate a quarter of a circle.
  • trunk/Source/WebCore/platform/graphics/Path.h

    r106357 r109255  
    147147        void transform(const AffineTransform&);
    148148
     149        void addPathForRoundedRect(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius);
    149150        void addBeziersForRoundedRect(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius);
    150151
  • trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp

    r106016 r109255  
    4040#include <wtf/RetainPtr.h>
    4141
     42#if PLATFORM(MAC) || PLATFORM(CHROMIUM)
     43#include "WebCoreSystemInterface.h"
     44#endif
     45
     46#if PLATFORM(WIN)
     47#include <WebKitSystemInterface/WebKitSystemInterface.h>
     48#endif
     49
    4250namespace WebCore {
    4351
    … …  
    225233{
    226234    CGPathAddArcToPoint(m_path, 0, p1.x(), p1.y(), p2.x(), p2.y(), radius);
     235}
     236
     237void Path::addPathForRoundedRect(const FloatRect& rect, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius)
     238{
     239#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     240    bool equalWidths = (topLeftRadius.width() == topRightRadius.width() && topRightRadius.width() == bottomLeftRadius.width() && bottomLeftRadius.width() == bottomRightRadius.width());
     241    bool equalHeights = (topLeftRadius.height() == bottomLeftRadius.height() && bottomLeftRadius.height() == topRightRadius.height() && topRightRadius.height() == bottomRightRadius.height());
     242
     243    if (equalWidths && equalHeights) {
     244        wkCGPathAddRoundedRect(m_path, 0, rect, topLeftRadius.width(), topLeftRadius.height());
     245        return;
     246    }
     247#endif
     248
     249    addBeziersForRoundedRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
    227250}
    228251
  • trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h

    r109181 r109255  
    4242typedef struct CGColorSpace *CGColorSpaceRef;
    4343typedef struct CGPattern *CGPatternRef;
     44typedef struct CGPath *CGMutablePathRef;
    4445typedef unsigned short CGGlyph;
    4546typedef struct __CFReadStream * CFReadStreamRef;
    … …  
    306307#endif
    307308
     309#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     310extern void (*wkCGPathAddRoundedRect)(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight);
     311#endif
     312
    308313}
    309314
  • trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm

    r109181 r109255  
    186186bool (*wkExecutableWasLinkedOnOrBeforeLion)(void);
    187187#endif
     188
     189#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     190void (*wkCGPathAddRoundedRect)(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight);
     191#endif
  • trunk/Source/WebKit/mac/ChangeLog

    r109254 r109255  
     12012-02-29  Tim Horton  <timothy_horton@apple.com>
     2
     3        Make use of CG rounded-rect primitives
     4        https://bugs.webkit.org/show_bug.cgi?id=79932
     5        <rdar://problem/9274953>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add wkCGPathAddRoundedRect.
     10
     11        * WebCoreSupport/WebSystemInterface.mm:
     12        (InitWebCoreSystemInterface):
     13
    1142012-02-29  Enrica Casucci  <enrica@apple.com>
    215
  • trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm

    r109181 r109255  
    179179#endif
    180180
     181#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     182    INIT(CGPathAddRoundedRect);
     183#endif
     184
    181185    didInit = true;
    182186}
  • trunk/Source/WebKit2/ChangeLog

    r109249 r109255  
     12012-02-29  Tim Horton  <timothy_horton@apple.com>
     2
     3        Make use of CG rounded-rect primitives
     4        https://bugs.webkit.org/show_bug.cgi?id=79932
     5        <rdar://problem/9274953>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add wkCGPathAddRoundedRect.
     10
     11        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
     12        (InitWebCoreSystemInterface):
     13
    1142012-02-29  Andy Estes  <aestes@apple.com>
    215
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm

    r109181 r109255  
    164164#endif
    165165
     166#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     167        INIT(CGPathAddRoundedRect);
     168#endif
     169
    166170    });
    167171}
  • trunk/WebKitLibraries/ChangeLog

    r109231 r109255  
     12012-02-29  Tim Horton  <timothy_horton@apple.com>
     2
     3        Make use of CG rounded-rect primitives
     4        https://bugs.webkit.org/show_bug.cgi?id=79932
     5        <rdar://problem/9274953>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add wkCGPathAddRoundedRect.
     10
     11        * WebKitSystemInterface.h:
     12        * libWebKitSystemInterfaceLeopard.a:
     13        * libWebKitSystemInterfaceLion.a:
     14        * libWebKitSystemInterfaceSnowLeopard.a:
     15
    1162012-02-28  Jer Noble  <jer.noble@apple.com>
    217
  • trunk/WebKitLibraries/WebKitSystemInterface.h

    r109181 r109255  
    472472#endif
    473473
     474#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
     475void WKCGPathAddRoundedRect(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight);
     476#endif
     477
    474478#ifdef __cplusplus
    475479}
Note: See TracChangeset for help on using the changeset viewer.