Changeset 139238 in webkit


Ignore:
Timestamp:
Jan 9, 2013 2:01:09 PM (11 years ago)
Author:
fmalita@chromium.org
Message:

[Skia] Implement GraphicsContext::addRoundedRectClip() using SkCanvas::clipRRect()
https://bugs.webkit.org/show_bug.cgi?id=106461

Reviewed by Stephen White.

Source/WebCore:

This patch adds a Skia-specific version of GraphicsContext::addRoundedRectClip() to take
advantage of the SkCanvas::clipRRect() primitive.

As a minor cleanup, the anonymous namespace in GraphicsContextSkia.cpp is extended to cover
all the local helper functions.

No new tests: coverage provided by existing tests.

  • platform/graphics/GraphicsContext.cpp:

(WebCore):

  • platform/graphics/skia/GraphicsContextSkia.cpp:

(WebCore::GraphicsContext::addRoundedRectClip):
(WebCore):
(WebCore::GraphicsContext::fillRoundedRect):

  • platform/graphics/skia/PlatformContextSkia.h:

(WebCore::PlatformContextSkia::clipRRect):
(WebCore):

LayoutTests:

  • platform/chromium-linux/fast/backgrounds/border-radius-split-background-image-expected.png:
  • platform/chromium-linux/fast/borders/border-radius-complex-inner-expected.png:
  • platform/chromium-linux/fast/borders/border-radius-inset-outset-expected.png:
  • platform/chromium-linux/fast/borders/border-radius-wide-border-05-expected.png:
  • platform/chromium-linux/fast/borders/border-styles-split-expected.png:
  • platform/chromium-linux/fast/borders/borderRadiusArcs01-expected.png:
  • platform/chromium-linux/fast/borders/mixed-border-styles-radius-expected.png:
  • platform/chromium-linux/fast/css/background-clip-radius-values-expected.png:
  • platform/chromium-linux/fast/replaced/border-radius-clip-content-edge-expected.png:
  • platform/chromium-linux/fast/writing-mode/border-styles-vertical-lr-expected.png:
  • platform/chromium-linux/fast/writing-mode/border-styles-vertical-rl-expected.png:
  • platform/chromium-linux/ietestcenter/css3/bordersbackgrounds/border-radius-sum-of-radii-001-expected.png:
  • platform/chromium-linux/ietestcenter/css3/bordersbackgrounds/border-radius-sum-of-radii-002-expected.png:
  • platform/chromium-linux/ietestcenter/css3/bordersbackgrounds/border-top-left-radius-values-004-expected.png:
  • platform/chromium-linux/ietestcenter/css3/bordersbackgrounds/border-top-right-radius-values-004-expected.png:
  • platform/chromium-linux/svg/custom/svg-fonts-in-html-expected.png:
  • platform/chromium/TestExpectations:
Location:
trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r139235 r139238  
     12013-01-09  Florin Malita  <fmalita@chromium.org>
     2
     3        [Skia] Implement GraphicsContext::addRoundedRectClip() using SkCanvas::clipRRect()
     4        https://bugs.webkit.org/show_bug.cgi?id=106461
     5
     6        Reviewed by Stephen White.
     7
     8        * platform/chromium-linux/fast/backgrounds/border-radius-split-background-image-expected.png:
     9        * platform/chromium-linux/fast/borders/border-radius-complex-inner-expected.png:
     10        * platform/chromium-linux/fast/borders/border-radius-inset-outset-expected.png:
     11        * platform/chromium-linux/fast/borders/border-radius-wide-border-05-expected.png:
     12        * platform/chromium-linux/fast/borders/border-styles-split-expected.png:
     13        * platform/chromium-linux/fast/borders/borderRadiusArcs01-expected.png:
     14        * platform/chromium-linux/fast/borders/mixed-border-styles-radius-expected.png:
     15        * platform/chromium-linux/fast/css/background-clip-radius-values-expected.png:
     16        * platform/chromium-linux/fast/replaced/border-radius-clip-content-edge-expected.png:
     17        * platform/chromium-linux/fast/writing-mode/border-styles-vertical-lr-expected.png:
     18        * platform/chromium-linux/fast/writing-mode/border-styles-vertical-rl-expected.png:
     19        * platform/chromium-linux/ietestcenter/css3/bordersbackgrounds/border-radius-sum-of-radii-001-expected.png:
     20        * platform/chromium-linux/ietestcenter/css3/bordersbackgrounds/border-radius-sum-of-radii-002-expected.png:
     21        * platform/chromium-linux/ietestcenter/css3/bordersbackgrounds/border-top-left-radius-values-004-expected.png:
     22        * platform/chromium-linux/ietestcenter/css3/bordersbackgrounds/border-top-right-radius-values-004-expected.png:
     23        * platform/chromium-linux/svg/custom/svg-fonts-in-html-expected.png:
     24        * platform/chromium/TestExpectations:
     25
    1262013-01-09  Dimitri Glazkov  <dglazkov@chromium.org>
    227
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r139233 r139238  
    13811381webkit.org/b/106366 platform/chromium/fast/forms/calendar-picker/calendar-picker-appearance-ru.html [ ImageOnlyFailure Pass ]
    13821382
     1383# Need rebaseline after https://bugs.webkit.org/show_bug.cgi?id=106461
     1384webkit.org/b/106461 fast/backgrounds/border-radius-split-background-image.html [ ImageOnlyFailure Pass ]
     1385webkit.org/b/106461 fast/borders/border-radius-complex-inner.html [ ImageOnlyFailure Pass ]
     1386webkit.org/b/106461 fast/borders/border-radius-inset-outset.html [ ImageOnlyFailure Pass ]
     1387webkit.org/b/106461 fast/borders/border-radius-wide-border-05.html [ ImageOnlyFailure Pass ]
     1388webkit.org/b/106461 fast/borders/border-styles-split.html [ ImageOnlyFailure Pass ]
     1389webkit.org/b/106461 fast/borders/borderRadiusArcs01.html [ ImageOnlyFailure Pass ]
     1390webkit.org/b/106461 fast/borders/mixed-border-styles-radius.html [ ImageOnlyFailure Pass ]
     1391webkit.org/b/106461 fast/writing-mode/border-styles-vertical-lr.html [ ImageOnlyFailure Pass ]
     1392webkit.org/b/106461 fast/writing-mode/border-styles-vertical-rl.html [ ImageOnlyFailure Pass ]
     1393webkit.org/b/106461 ietestcenter/css3/bordersbackgrounds/border-radius-sum-of-radii-001.htm [ ImageOnlyFailure Pass ]
     1394webkit.org/b/106461 ietestcenter/css3/bordersbackgrounds/border-radius-sum-of-radii-002.htm [ ImageOnlyFailure Pass ]
     1395webkit.org/b/106461 ietestcenter/css3/bordersbackgrounds/border-top-left-radius-values-004.htm [ ImageOnlyFailure Pass ]
     1396webkit.org/b/106461 ietestcenter/css3/bordersbackgrounds/border-top-right-radius-values-004.htm [ ImageOnlyFailure Pass ]
     1397webkit.org/b/106461 svg/custom/svg-fonts-in-html.html [ ImageOnlyFailure Pass ]
     1398
    13831399# Failing since added by r108699
    13841400webkit.org/b/79454 [ Android Linux Mac ] svg/text/text-rescale.html [ ImageOnlyFailure Pass ]
  • trunk/Source/WebCore/ChangeLog

    r139236 r139238  
     12013-01-09  Florin Malita  <fmalita@chromium.org>
     2
     3        [Skia] Implement GraphicsContext::addRoundedRectClip() using SkCanvas::clipRRect()
     4        https://bugs.webkit.org/show_bug.cgi?id=106461
     5
     6        Reviewed by Stephen White.
     7
     8        This patch adds a Skia-specific version of GraphicsContext::addRoundedRectClip() to take
     9        advantage of the SkCanvas::clipRRect() primitive.
     10
     11        As a minor cleanup, the anonymous namespace in GraphicsContextSkia.cpp is extended to cover
     12        all the local helper functions.
     13
     14        No new tests: coverage provided by existing tests.
     15
     16        * platform/graphics/GraphicsContext.cpp:
     17        (WebCore):
     18        * platform/graphics/skia/GraphicsContextSkia.cpp:
     19        (WebCore::GraphicsContext::addRoundedRectClip):
     20        (WebCore):
     21        (WebCore::GraphicsContext::fillRoundedRect):
     22        * platform/graphics/skia/PlatformContextSkia.h:
     23        (WebCore::PlatformContextSkia::clipRRect):
     24        (WebCore):
     25
    1262013-01-09  Andreas Kling  <akling@apple.com>
    227
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp

    r137011 r139238  
    605605#endif
    606606
     607#if !USE(SKIA)
    607608void GraphicsContext::addRoundedRectClip(const RoundedRect& rect)
    608609{
     
    614615    clip(path);
    615616}
     617#endif
    616618
    617619void GraphicsContext::clipOutRoundedRect(const RoundedRect& rect)
  • trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp

    r139191 r139238  
    6969
    7070namespace {
     71// Local helper functions ------------------------------------------------------
    7172
    7273// Return value % max, but account for value possibly being negative.
     
    8485    return value;
    8586}
    86 
    87 }  // namespace
    88 
    89 // Local helper functions ------------------------------------------------------
    9087
    9188void addCornerArc(SkPath* path, const SkRect& rect, const IntSize& size, int startAngle)
     
    201198}
    202199
     200inline void setRadii(SkVector* radii, IntSize topLeft, IntSize topRight, IntSize bottomRight, IntSize bottomLeft)
     201{
     202    radii[SkRRect::kUpperLeft_Corner].set(SkIntToScalar(topLeft.width()),
     203        SkIntToScalar(topLeft.height()));
     204    radii[SkRRect::kUpperRight_Corner].set(SkIntToScalar(topRight.width()),
     205        SkIntToScalar(topRight.height()));
     206    radii[SkRRect::kLowerRight_Corner].set(SkIntToScalar(bottomRight.width()),
     207        SkIntToScalar(bottomRight.height()));
     208    radii[SkRRect::kLowerLeft_Corner].set(SkIntToScalar(bottomLeft.width()),
     209        SkIntToScalar(bottomLeft.height()));
     210}
     211
     212} // namespace
     213
    203214// -----------------------------------------------------------------------------
    204215
     
    310321
    311322    platformContext()->clipPath(*path.platformPath(), PlatformContextSkia::AntiAliased);
     323}
     324
     325void GraphicsContext::addRoundedRectClip(const RoundedRect& rect)
     326{
     327    if (paintingDisabled())
     328        return;
     329
     330    SkVector radii[4];
     331    RoundedRect::Radii wkRadii = rect.radii();
     332    setRadii(radii, wkRadii.topLeft(), wkRadii.topRight(), wkRadii.bottomRight(), wkRadii.bottomLeft());
     333
     334    SkRRect r;
     335    r.setRectRadii(rect.rect(), radii);
     336
     337    platformContext()->clipRRect(r, PlatformContextSkia::AntiAliased);
    312338}
    313339
     
    809835
    810836    SkVector radii[4];
    811     radii[SkRRect::kUpperLeft_Corner].set(SkIntToScalar(topLeft.width()), SkIntToScalar(topLeft.height()));
    812     radii[SkRRect::kUpperRight_Corner].set(SkIntToScalar(topRight.width()), SkIntToScalar(topRight.height()));
    813     radii[SkRRect::kLowerRight_Corner].set(SkIntToScalar(bottomRight.width()), SkIntToScalar(bottomRight.height()));
    814     radii[SkRRect::kLowerLeft_Corner].set(SkIntToScalar(bottomLeft.width()), SkIntToScalar(bottomLeft.height()));
     837    setRadii(radii, topLeft, topRight, bottomRight, bottomLeft);
    815838
    816839    SkRRect rr;
  • trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h

    r139191 r139238  
    227227    bool clipRect(const SkRect&, AntiAliasingMode = NotAntiAliased,
    228228        SkRegion::Op = SkRegion::kIntersect_Op);
     229    bool clipRRect(const SkRRect&, AntiAliasingMode = NotAntiAliased,
     230        SkRegion::Op = SkRegion::kIntersect_Op);
    229231    bool getClipBounds(SkRect*) const;
    230232
     
    368370}
    369371
     372inline bool PlatformContextSkia::clipRRect(const SkRRect& rect, AntiAliasingMode aa, SkRegion::Op op)
     373{
     374    realizeSave(SkCanvas::kClip_SaveFlag);
     375
     376    return m_canvas->clipRRect(rect, op, aa == AntiAliased);
     377}
     378
    370379inline bool PlatformContextSkia::getClipBounds(SkRect* bounds) const
    371380{
Note: See TracChangeset for help on using the changeset viewer.