Changeset 139191 in webkit


Ignore:
Timestamp:
Jan 9, 2013 6:31:59 AM (11 years ago)
Author:
fmalita@chromium.org
Message:

[Skia] Implement GraphicsContext::fillRoundedRect() using SkCanvas::drawRRect()
https://bugs.webkit.org/show_bug.cgi?id=106366

Reviewed by Stephen White.

Source/WebCore:

Skia provides rounded-rect primitives, so we can avoid degrading fillRoundedRect() to
drawPath().

Due to subtle pixel differences (not visually noticeable), switching from drawPath() to
drawRRect() requires rebaselining some of the existing results.

No new tests: coverage provided by existing tests.

  • platform/graphics/skia/GraphicsContextSkia.cpp:

(WebCore::GraphicsContext::fillRoundedRect):

  • platform/graphics/skia/PlatformContextSkia.h:

(WebCore::PlatformContextSkia::drawRRect):
(WebCore):

LayoutTests:

  • platform/chromium-linux/compositing/video/video-controls-layer-creation-expected.png:
  • platform/chromium-linux/fast/backgrounds/background-leakage-expected.png:
  • platform/chromium-linux/fast/backgrounds/background-leakage-transforms-expected.png:
  • platform/chromium-linux/fast/borders/border-radius-split-inline-expected.png:
  • platform/chromium-linux/fast/borders/borderRadiusAllStylesAllCorners-expected.png:
  • platform/chromium-linux/fast/borders/borderRadiusDouble03-expected.png:
  • platform/chromium-linux/fast/borders/borderRadiusGroove02-expected.png:
  • platform/chromium-linux/fast/borders/borderRadiusInset01-expected.png:
  • platform/chromium-linux/fast/box-shadow/basic-shadows-expected.png:
  • platform/chromium-linux/fast/box-shadow/box-shadow-clipped-slices-expected.png:
  • platform/chromium-linux/fast/box-shadow/spread-expected.png:
  • platform/chromium-linux/fast/css/box-shadow-and-border-radius-expected.png:
  • platform/chromium-linux/fast/css/shadow-multiple-expected.png:
  • platform/chromium-linux/fast/css/text-input-with-webkit-border-radius-expected.png:
  • platform/chromium-linux/fast/hidpi/video-controls-in-hidpi-expected.png:
  • platform/chromium-linux/fast/layers/video-layer-expected.png:
  • platform/chromium-linux/fast/regions/full-screen-video-from-region-expected.png:
  • platform/chromium-linux/fast/repaint/shadow-multiple-horizontal-expected.png:
  • platform/chromium-linux/fast/repaint/shadow-multiple-strict-horizontal-expected.png:
  • platform/chromium-linux/fast/repaint/shadow-multiple-strict-vertical-expected.png:
  • platform/chromium-linux/fast/repaint/shadow-multiple-vertical-expected.png:
  • platform/chromium-linux/fast/transforms/shadows-expected.png:
  • platform/chromium-linux/fullscreen/full-screen-stacking-context-expected.png:
  • platform/chromium-linux/http/tests/media/video-buffered-range-contains-currentTime-expected.png:
  • platform/chromium-linux/ietestcenter/css3/bordersbackgrounds/background-color-applied-to-rounded-inline-element-expected.png:
  • platform/chromium-linux/ietestcenter/css3/bordersbackgrounds/border-radius-clip-002-expected.png:
  • platform/chromium-linux/ietestcenter/css3/bordersbackgrounds/border-radius-style-005-expected.png:
  • platform/chromium-linux/media/audio-controls-rendering-expected.png:
  • platform/chromium-linux/media/audio-repaint-expected.png:
  • platform/chromium-linux/media/controls-after-reload-expected.png:
  • platform/chromium-linux/media/controls-layout-direction-expected.png:
  • platform/chromium-linux/media/controls-strict-expected.png:
  • platform/chromium-linux/media/controls-styling-expected.png:
  • platform/chromium-linux/media/controls-styling-strict-expected.png:
  • platform/chromium-linux/media/controls-without-preload-expected.png:
  • platform/chromium-linux/media/media-controls-clone-expected.png:
  • platform/chromium-linux/media/media-document-audio-repaint-expected.png:
  • platform/chromium-linux/media/video-controls-rendering-expected.png:
  • platform/chromium-linux/media/video-display-toggle-expected.png:
  • platform/chromium-linux/media/video-empty-source-expected.png:
  • platform/chromium-linux/media/video-no-audio-expected.png:
  • platform/chromium-linux/media/video-playing-and-pause-expected.png:
  • platform/chromium-linux/media/video-zoom-controls-expected.png:
  • platform/chromium-linux/platform/chromium/fast/forms/calendar-picker/calendar-picker-appearance-expected.png:
  • platform/chromium-linux/platform/chromium/fast/forms/calendar-picker/calendar-picker-appearance-ru-expected.png:
  • platform/chromium-linux/platform/chromium/virtual/gpu/fast/hidpi/video-controls-in-hidpi-expected.png:
  • platform/chromium-linux/platform/chromium/virtual/softwarecompositing/video/video-controls-layer-creation-expected.png: Added.
  • platform/chromium/TestExpectations:
Location:
trunk
Files:
2 added
51 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r139190 r139191  
     12013-01-09  Florin Malita  <fmalita@chromium.org>
     2
     3        [Skia] Implement GraphicsContext::fillRoundedRect() using SkCanvas::drawRRect()
     4        https://bugs.webkit.org/show_bug.cgi?id=106366
     5
     6        Reviewed by Stephen White.
     7
     8        * platform/chromium-linux/compositing/video/video-controls-layer-creation-expected.png:
     9        * platform/chromium-linux/fast/backgrounds/background-leakage-expected.png:
     10        * platform/chromium-linux/fast/backgrounds/background-leakage-transforms-expected.png:
     11        * platform/chromium-linux/fast/borders/border-radius-split-inline-expected.png:
     12        * platform/chromium-linux/fast/borders/borderRadiusAllStylesAllCorners-expected.png:
     13        * platform/chromium-linux/fast/borders/borderRadiusDouble03-expected.png:
     14        * platform/chromium-linux/fast/borders/borderRadiusGroove02-expected.png:
     15        * platform/chromium-linux/fast/borders/borderRadiusInset01-expected.png:
     16        * platform/chromium-linux/fast/box-shadow/basic-shadows-expected.png:
     17        * platform/chromium-linux/fast/box-shadow/box-shadow-clipped-slices-expected.png:
     18        * platform/chromium-linux/fast/box-shadow/spread-expected.png:
     19        * platform/chromium-linux/fast/css/box-shadow-and-border-radius-expected.png:
     20        * platform/chromium-linux/fast/css/shadow-multiple-expected.png:
     21        * platform/chromium-linux/fast/css/text-input-with-webkit-border-radius-expected.png:
     22        * platform/chromium-linux/fast/hidpi/video-controls-in-hidpi-expected.png:
     23        * platform/chromium-linux/fast/layers/video-layer-expected.png:
     24        * platform/chromium-linux/fast/regions/full-screen-video-from-region-expected.png:
     25        * platform/chromium-linux/fast/repaint/shadow-multiple-horizontal-expected.png:
     26        * platform/chromium-linux/fast/repaint/shadow-multiple-strict-horizontal-expected.png:
     27        * platform/chromium-linux/fast/repaint/shadow-multiple-strict-vertical-expected.png:
     28        * platform/chromium-linux/fast/repaint/shadow-multiple-vertical-expected.png:
     29        * platform/chromium-linux/fast/transforms/shadows-expected.png:
     30        * platform/chromium-linux/fullscreen/full-screen-stacking-context-expected.png:
     31        * platform/chromium-linux/http/tests/media/video-buffered-range-contains-currentTime-expected.png:
     32        * platform/chromium-linux/ietestcenter/css3/bordersbackgrounds/background-color-applied-to-rounded-inline-element-expected.png:
     33        * platform/chromium-linux/ietestcenter/css3/bordersbackgrounds/border-radius-clip-002-expected.png:
     34        * platform/chromium-linux/ietestcenter/css3/bordersbackgrounds/border-radius-style-005-expected.png:
     35        * platform/chromium-linux/media/audio-controls-rendering-expected.png:
     36        * platform/chromium-linux/media/audio-repaint-expected.png:
     37        * platform/chromium-linux/media/controls-after-reload-expected.png:
     38        * platform/chromium-linux/media/controls-layout-direction-expected.png:
     39        * platform/chromium-linux/media/controls-strict-expected.png:
     40        * platform/chromium-linux/media/controls-styling-expected.png:
     41        * platform/chromium-linux/media/controls-styling-strict-expected.png:
     42        * platform/chromium-linux/media/controls-without-preload-expected.png:
     43        * platform/chromium-linux/media/media-controls-clone-expected.png:
     44        * platform/chromium-linux/media/media-document-audio-repaint-expected.png:
     45        * platform/chromium-linux/media/video-controls-rendering-expected.png:
     46        * platform/chromium-linux/media/video-display-toggle-expected.png:
     47        * platform/chromium-linux/media/video-empty-source-expected.png:
     48        * platform/chromium-linux/media/video-no-audio-expected.png:
     49        * platform/chromium-linux/media/video-playing-and-pause-expected.png:
     50        * platform/chromium-linux/media/video-zoom-controls-expected.png:
     51        * platform/chromium-linux/platform/chromium/fast/forms/calendar-picker/calendar-picker-appearance-expected.png:
     52        * platform/chromium-linux/platform/chromium/fast/forms/calendar-picker/calendar-picker-appearance-ru-expected.png:
     53        * platform/chromium-linux/platform/chromium/virtual/gpu/fast/hidpi/video-controls-in-hidpi-expected.png:
     54        * platform/chromium-linux/platform/chromium/virtual/softwarecompositing/video/video-controls-layer-creation-expected.png: Added.
     55        * platform/chromium/TestExpectations:
     56
    1572013-01-09  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
    258
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r139175 r139191  
    13331333webkit.org/b/78830 [ Debug ] svg/custom/mask-invalidation.svg [ ImageOnlyFailure Pass ]
    13341334
     1335# Need rebaseline after https://bugs.webkit.org/show_bug.cgi?id=106366
     1336webkit.org/b/106366 compositing/video/video-controls-layer-creation.html [ ImageOnlyFailure Pass ]
     1337webkit.org/b/106366 fast/backgrounds/background-leakage.html [ ImageOnlyFailure Pass ]
     1338webkit.org/b/106366 fast/backgrounds/background-leakage-transforms.html [ ImageOnlyFailure Pass ]
     1339webkit.org/b/106366 fast/borders/border-radius-split-inline.html [ ImageOnlyFailure Pass ]
     1340webkit.org/b/106366 fast/borders/borderRadiusAllStylesAllCorners.html [ ImageOnlyFailure Pass ]
     1341webkit.org/b/106366 fast/borders/borderRadiusDouble03.html [ ImageOnlyFailure Pass ]
     1342webkit.org/b/106366 fast/borders/borderRadiusGroove02.html [ ImageOnlyFailure Pass ]
     1343webkit.org/b/106366 fast/borders/borderRadiusInset01.html [ ImageOnlyFailure Pass ]
     1344webkit.org/b/106366 fast/box-shadow/basic-shadows.html [ ImageOnlyFailure Pass ]
     1345webkit.org/b/106366 fast/box-shadow/box-shadow-clipped-slices.html [ ImageOnlyFailure Pass ]
     1346webkit.org/b/106366 fast/box-shadow/spread.html [ ImageOnlyFailure Pass ]
     1347webkit.org/b/106366 fast/css/box-shadow-and-border-radius.html [ ImageOnlyFailure Pass ]
     1348webkit.org/b/106366 fast/css/shadow-multiple.html [ ImageOnlyFailure Pass ]
     1349webkit.org/b/106366 fast/css/text-input-with-webkit-border-radius.html [ ImageOnlyFailure Pass ]
     1350webkit.org/b/106366 fast/forms/validation-message-appearance.html [ ImageOnlyFailure Pass ]
     1351webkit.org/b/106366 fast/hidpi/video-controls-in-hidpi.html [ ImageOnlyFailure Pass ]
     1352webkit.org/b/106366 fast/layers/video-layer.html [ ImageOnlyFailure Pass ]
     1353webkit.org/b/106366 fast/regions/full-screen-video-from-region.html [ ImageOnlyFailure Pass ]
     1354webkit.org/b/106366 fast/repaint/shadow-multiple-horizontal.html [ ImageOnlyFailure Pass ]
     1355webkit.org/b/106366 fast/repaint/shadow-multiple-strict-horizontal.html [ ImageOnlyFailure Pass ]
     1356webkit.org/b/106366 fast/repaint/shadow-multiple-strict-vertical.html [ ImageOnlyFailure Pass ]
     1357webkit.org/b/106366 fast/repaint/shadow-multiple-vertical.html [ ImageOnlyFailure Pass ]
     1358webkit.org/b/106366 fast/transforms/shadows.html [ ImageOnlyFailure Pass ]
     1359webkit.org/b/106366 fullscreen/full-screen-stacking-context.html [ ImageOnlyFailure Pass ]
     1360webkit.org/b/106366 http/tests/media/video-buffered-range-contains-currentTime.html [ ImageOnlyFailure Pass ]
     1361webkit.org/b/106366 ietestcenter/css3/bordersbackgrounds/background-color-applied-to-rounded-inline-element.htm [ ImageOnlyFailure Pass ]
     1362webkit.org/b/106366 ietestcenter/css3/bordersbackgrounds/border-radius-clip-002.htm [ ImageOnlyFailure Pass ]
     1363webkit.org/b/106366 ietestcenter/css3/bordersbackgrounds/border-radius-style-005.htm [ ImageOnlyFailure Pass ]
     1364webkit.org/b/106366 media/audio-controls-rendering.html [ ImageOnlyFailure Pass ]
     1365webkit.org/b/106366 media/audio-repaint.html [ ImageOnlyFailure Pass ]
     1366webkit.org/b/106366 media/controls-after-reload.html [ ImageOnlyFailure Pass ]
     1367webkit.org/b/106366 media/controls-layout-direction.html [ ImageOnlyFailure Pass ]
     1368webkit.org/b/106366 media/controls-strict.html [ ImageOnlyFailure Pass ]
     1369webkit.org/b/106366 media/controls-styling.html [ ImageOnlyFailure Pass ]
     1370webkit.org/b/106366 media/controls-styling-strict.html [ ImageOnlyFailure Pass ]
     1371webkit.org/b/106366 media/controls-without-preload.html [ ImageOnlyFailure Pass ]
     1372webkit.org/b/106366 media/media-controls-clone.html [ ImageOnlyFailure Pass ]
     1373webkit.org/b/106366 media/media-document-audio-repaint.html [ ImageOnlyFailure Pass ]
     1374webkit.org/b/106366 media/video-controls-rendering.html [ ImageOnlyFailure Pass ]
     1375webkit.org/b/106366 media/video-display-toggle.html [ ImageOnlyFailure Pass ]
     1376webkit.org/b/106366 media/video-empty-source.html [ ImageOnlyFailure Pass ]
     1377webkit.org/b/106366 media/video-no-audio.html [ ImageOnlyFailure Pass ]
     1378webkit.org/b/106366 media/video-playing-and-pause.html [ ImageOnlyFailure Pass ]
     1379webkit.org/b/106366 media/video-zoom-controls.html [ ImageOnlyFailure Pass ]
     1380webkit.org/b/106366 platform/chromium/fast/forms/calendar-picker/calendar-picker-appearance.html [ ImageOnlyFailure Pass ]
     1381webkit.org/b/106366 platform/chromium/fast/forms/calendar-picker/calendar-picker-appearance-ru.html [ ImageOnlyFailure Pass ]
     1382
    13351383# Failing since added by r108699
    13361384webkit.org/b/79454 [ Android Linux Mac ] svg/text/text-rescale.html [ ImageOnlyFailure Pass ]
  • trunk/Source/WebCore/ChangeLog

    r139188 r139191  
     12013-01-09  Florin Malita  <fmalita@chromium.org>
     2
     3        [Skia] Implement GraphicsContext::fillRoundedRect() using SkCanvas::drawRRect()
     4        https://bugs.webkit.org/show_bug.cgi?id=106366
     5
     6        Reviewed by Stephen White.
     7
     8        Skia provides rounded-rect primitives, so we can avoid degrading fillRoundedRect() to
     9        drawPath().
     10
     11        Due to subtle pixel differences (not visually noticeable), switching from drawPath() to
     12        drawRRect() requires rebaselining some of the existing results.
     13
     14        No new tests: coverage provided by existing tests.
     15
     16        * platform/graphics/skia/GraphicsContextSkia.cpp:
     17        (WebCore::GraphicsContext::fillRoundedRect):
     18        * platform/graphics/skia/PlatformContextSkia.h:
     19        (WebCore::PlatformContextSkia::drawRRect):
     20        (WebCore):
     21
    1222013-01-09  Arnaud Renevier  <a.renevier@sisa.samsung.com>
    223
  • trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp

    r139138 r139191  
    5050#include "SkData.h"
    5151#include "SkLayerDrawLooper.h"
     52#include "SkRRect.h"
    5253#include "SkShader.h"
    5354#include "SkiaUtils.h"
     
    807808    }
    808809
    809     SkRect r = rect;
    810     SkPath path;
    811     addCornerArc(&path, r, topRight, 270);
    812     addCornerArc(&path, r, bottomRight, 0);
    813     addCornerArc(&path, r, bottomLeft, 90);
    814     addCornerArc(&path, r, topLeft, 180);
     810    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()));
     815
     816    SkRRect rr;
     817    rr.setRectRadii(rect, radii);
    815818
    816819    SkPaint paint;
    817820    platformContext()->setupPaintForFilling(&paint);
    818821    paint.setColor(color.rgb());
    819     platformContext()->drawPath(path, paint);
     822
     823    platformContext()->drawRRect(rr, paint);
    820824}
    821825
  • trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h

    r136755 r139191  
    4141#include "SkPaint.h"
    4242#include "SkPath.h"
     43#include "SkRRect.h"
    4344
    4445#include <wtf/Noncopyable.h>
     
    242243    void drawRect(const SkRect&, const SkPaint&);
    243244    void drawIRect(const SkIRect&, const SkPaint&);
     245    void drawRRect(const SkRRect&, const SkPaint&);
    244246    void drawPosText(const void* text, size_t byteLength, const SkPoint pos[], const SkPaint&);
    245247    void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY,
     
    474476}
    475477
     478inline void PlatformContextSkia::drawRRect(const SkRRect& rect, const SkPaint& paint)
     479{
     480    m_canvas->drawRRect(rect, paint);
     481
     482    if (m_trackOpaqueRegion)
     483        m_opaqueRegion.didDrawRect(this, rect.getBounds(), paint, 0);
     484}
     485
    476486inline void PlatformContextSkia::drawPosText(const void* text, size_t byteLength,
    477487    const SkPoint pos[], const SkPaint& paint)
Note: See TracChangeset for help on using the changeset viewer.