Title: [112726] trunk/Source/WebCore
Revision
112726
Author
r...@google.com
Date
2012-03-30 14:16:40 -0700 (Fri, 30 Mar 2012)

Log Message

Remove deadcode behind "SafeSkia" flag
https://bugs.webkit.org/show_bug.cgi?id=82771

Reviewed by Stephen White.

Just removing dead code (behind obsolete build flag), existing webkit tests apply

* platform/graphics/skia/GraphicsContextSkia.cpp:
(WebCore::GraphicsContext::addInnerRoundedRectClip):
(WebCore::GraphicsContext::clearRect):
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::canvasClip):
(WebCore::GraphicsContext::clipOut):
(WebCore::GraphicsContext::clipPath):
(WebCore::GraphicsContext::drawConvexPolygon):
(WebCore::GraphicsContext::clipConvexPolygon):
(WebCore::GraphicsContext::drawEllipse):
(WebCore::GraphicsContext::drawLine):
(WebCore::GraphicsContext::drawRect):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::fillRoundedRect):
(WebCore::GraphicsContext::strokeArc):
(WebCore::GraphicsContext::strokePath):
(WebCore::GraphicsContext::strokeRect):
(WebCore::GraphicsContext::platformFillEllipse):
(WebCore::GraphicsContext::platformStrokeEllipse):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (112725 => 112726)


--- trunk/Source/WebCore/ChangeLog	2012-03-30 21:14:26 UTC (rev 112725)
+++ trunk/Source/WebCore/ChangeLog	2012-03-30 21:16:40 UTC (rev 112726)
@@ -1,3 +1,33 @@
+2012-03-30  Mike Reed  <r...@google.com>
+
+        Remove deadcode behind "SafeSkia" flag
+        https://bugs.webkit.org/show_bug.cgi?id=82771
+
+        Reviewed by Stephen White.
+
+        Just removing dead code (behind obsolete build flag), existing webkit tests apply
+
+        * platform/graphics/skia/GraphicsContextSkia.cpp:
+        (WebCore::GraphicsContext::addInnerRoundedRectClip):
+        (WebCore::GraphicsContext::clearRect):
+        (WebCore::GraphicsContext::clip):
+        (WebCore::GraphicsContext::canvasClip):
+        (WebCore::GraphicsContext::clipOut):
+        (WebCore::GraphicsContext::clipPath):
+        (WebCore::GraphicsContext::drawConvexPolygon):
+        (WebCore::GraphicsContext::clipConvexPolygon):
+        (WebCore::GraphicsContext::drawEllipse):
+        (WebCore::GraphicsContext::drawLine):
+        (WebCore::GraphicsContext::drawRect):
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::fillRect):
+        (WebCore::GraphicsContext::fillRoundedRect):
+        (WebCore::GraphicsContext::strokeArc):
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::strokeRect):
+        (WebCore::GraphicsContext::platformFillEllipse):
+        (WebCore::GraphicsContext::platformStrokeEllipse):
+
 2012-03-30  Ryosuke Niwa  <rn...@webkit.org>
 
         Add a compile assert for the size of InlineFlowBox

Modified: trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp (112725 => 112726)


--- trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp	2012-03-30 21:14:26 UTC (rev 112725)
+++ trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp	2012-03-30 21:16:40 UTC (rev 112726)
@@ -82,111 +82,6 @@
 
 }  // namespace
 
-// "Seatbelt" functions ------------------------------------------------------
-//
-// These functions check certain graphics primitives for being "safe".
-// Skia has historically crashed when sent crazy data. These functions do
-// additional checking to prevent crashes.
-//
-// Ideally, all of these would be fixed in the graphics layer and we would not
-// have to do any checking. You can uncomment the ENSURE_VALUE_SAFETY_FOR_SKIA
-// flag to check the graphics layer.
-
-// Disabling these checks (20/01/2010), since we think we've fixed all the Skia
-// bugs.  Leaving the code in for now, so we can revert easily if necessary.
-// #define ENSURE_VALUE_SAFETY_FOR_SKIA
-
-#ifdef ENSURE_VALUE_SAFETY_FOR_SKIA
-static bool isCoordinateSkiaSafe(float coord)
-{
-    // First check for valid floats.
-#if defined(_MSC_VER)
-    if (!_finite(coord))
-#else
-    if (!finite(coord))
-#endif
-        return false;
-
-    // Skia uses 16.16 fixed point and 26.6 fixed point in various places. If
-    // the transformed point exceeds 15 bits, we just declare that it's
-    // unreasonable to catch both of these cases.
-    static const int maxPointMagnitude = 32767;
-    if (coord > maxPointMagnitude || coord < -maxPointMagnitude)
-        return false;
-
-    return true;
-}
-#endif
-
-static bool isPointSkiaSafe(const SkMatrix& transform, const SkPoint& pt)
-{
-#ifdef ENSURE_VALUE_SAFETY_FOR_SKIA
-    // Now check for points that will overflow. We check the *transformed*
-    // points since this is what will be rasterized.
-    SkPoint xPt;
-    transform.mapPoints(&xPt, &pt, 1);
-    return isCoordinateSkiaSafe(xPt.fX) && isCoordinateSkiaSafe(xPt.fY);
-#else
-    return true;
-#endif
-}
-
-static bool isRectSkiaSafe(const SkMatrix& transform, const SkRect& rc)
-{
-#ifdef ENSURE_VALUE_SAFETY_FOR_SKIA
-    SkPoint topleft = {rc.fLeft, rc.fTop};
-    SkPoint bottomright = {rc.fRight, rc.fBottom};
-    return isPointSkiaSafe(transform, topleft) && isPointSkiaSafe(transform, bottomright);
-#else
-    return true;
-#endif
-}
-
-bool isPathSkiaSafe(const SkMatrix& transform, const SkPath& path)
-{
-#ifdef ENSURE_VALUE_SAFETY_FOR_SKIA
-    SkPoint current_points[4];
-    SkPath::Iter iter(path, false);
-    for (SkPath::Verb verb = iter.next(current_points);
-         verb != SkPath::kDone_Verb;
-         verb = iter.next(current_points)) {
-        switch (verb) {
-        case SkPath::kMove_Verb:
-            // This move will be duplicated in the next verb, so we can ignore.
-            break;
-        case SkPath::kLine_Verb:
-            // iter.next returns 2 points.
-            if (!isPointSkiaSafe(transform, current_points[0])
-                || !isPointSkiaSafe(transform, current_points[1]))
-                return false;
-            break;
-        case SkPath::kQuad_Verb:
-            // iter.next returns 3 points.
-            if (!isPointSkiaSafe(transform, current_points[0])
-                || !isPointSkiaSafe(transform, current_points[1])
-                || !isPointSkiaSafe(transform, current_points[2]))
-                return false;
-            break;
-        case SkPath::kCubic_Verb:
-            // iter.next returns 4 points.
-            if (!isPointSkiaSafe(transform, current_points[0])
-                || !isPointSkiaSafe(transform, current_points[1])
-                || !isPointSkiaSafe(transform, current_points[2])
-                || !isPointSkiaSafe(transform, current_points[3]))
-                return false;
-            break;
-        case SkPath::kClose_Verb:
-        case SkPath::kDone_Verb:
-        default:
-            break;
-        }
-    }
-    return true;
-#else
-    return true;
-#endif
-}
-
 // Local helper functions ------------------------------------------------------
 
 void addCornerArc(SkPath* path, const SkRect& rect, const IntSize& size, int startAngle)
@@ -303,9 +198,6 @@
         return;
 
     SkRect r(rect);
-    if (!isRectSkiaSafe(getCTM(), r))
-        return;
-
     SkPath path;
     path.addOval(r, SkPath::kCW_Direction);
     // only perform the inset if we won't invert r
@@ -332,9 +224,6 @@
         return;
 
     SkRect r = rect;
-    if (!isRectSkiaSafe(getCTM(), r))
-        ClipRectToCanvas(*platformContext()->canvas(), r, &r);
-
     SkPaint paint;
     platformContext()->setupPaintForFilling(&paint);
     paint.setXfermodeMode(SkXfermode::kClear_Mode);
@@ -347,11 +236,7 @@
     if (paintingDisabled())
         return;
 
-    SkRect r(rect);
-    if (!isRectSkiaSafe(getCTM(), r))
-        return;
-
-    platformContext()->canvas()->clipRect(r);
+    platformContext()->canvas()->clipRect(rect);
 }
 
 void GraphicsContext::clip(const Path& path)
@@ -359,11 +244,7 @@
     if (paintingDisabled())
         return;
 
-    const SkPath& p = *path.platformPath();
-    if (!isPathSkiaSafe(getCTM(), p))
-        return;
-
-    platformContext()->clipPathAntiAliased(p);
+    platformContext()->clipPathAntiAliased(*path.platformPath());
 }
 
 void GraphicsContext::canvasClip(const Path& path)
@@ -371,11 +252,7 @@
     if (paintingDisabled())
         return;
 
-    const SkPath& p = *path.platformPath();
-    if (!isPathSkiaSafe(getCTM(), p))
-        return;
-
-    platformContext()->canvasClipPath(p);
+    platformContext()->canvasClipPath(*path.platformPath());
 }
 
 void GraphicsContext::clipOut(const IntRect& rect)
@@ -383,11 +260,7 @@
     if (paintingDisabled())
         return;
 
-    SkRect r(rect);
-    if (!isRectSkiaSafe(getCTM(), r))
-        return;
-
-    platformContext()->canvas()->clipRect(r, SkRegion::kDifference_Op);
+    platformContext()->canvas()->clipRect(rect, SkRegion::kDifference_Op);
 }
 
 void GraphicsContext::clipOut(const Path& p)
@@ -397,9 +270,6 @@
 
     // We must make a copy of the path, to mark it as inverse-filled.
     SkPath path(*p.platformPath());
-    if (!isPathSkiaSafe(getCTM(), path))
-        return;
-
     path.toggleInverseFillType();
     platformContext()->clipPathAntiAliased(path);
 }
@@ -410,9 +280,6 @@
         return;
 
     const SkPath* path = pathToClip.platformPath();
-    if (!isPathSkiaSafe(getCTM(), *path))
-        return;
-
     SkPath::FillType ftype = (clipRule == RULE_EVENODD) ? SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType;
     SkPath storage;
     if (path->getFillType() != ftype) {
@@ -474,9 +341,6 @@
     SkPath path;
     setPathFromConvexPoints(&path, numPoints, points);
 
-    if (!isPathSkiaSafe(getCTM(), path))
-        return;
-
     SkPaint paint;
     platformContext()->setupPaintForFilling(&paint);
     paint.setAntiAlias(shouldAntialias);
@@ -500,9 +364,6 @@
         return;
 
     SkPath path;
-    if (!isPathSkiaSafe(getCTM(), path))
-        return;
-
     setPathFromConvexPoints(&path, numPoints, points);
     if (antialiased)
         platformContext()->clipPathAntiAliased(path);
@@ -517,9 +378,6 @@
         return;
 
     SkRect rect = elipseRect;
-    if (!isRectSkiaSafe(getCTM(), rect))
-        return;
-
     SkPaint paint;
     platformContext()->setupPaintForFilling(&paint);
     platformContext()->canvas()->drawOval(rect, paint);
@@ -610,9 +468,6 @@
         return;
 
     SkPaint paint;
-    if (!isPointSkiaSafe(getCTM(), point1) || !isPointSkiaSafe(getCTM(), point2))
-        return;
-
     FloatPoint p1 = point1;
     FloatPoint p2 = point2;
     bool isVerticalLine = (p1.x() == p2.x());
@@ -795,13 +650,7 @@
     if (paintingDisabled())
         return;
 
-    SkRect r = rect;
-    if (!isRectSkiaSafe(getCTM(), r)) {
-        // See the fillRect below.
-        ClipRectToCanvas(*platformContext()->canvas(), r, &r);
-    }
-
-    platformContext()->drawRect(r);
+    platformContext()->drawRect(rect);
 }
 
 void GraphicsContext::fillPath(const Path& pathToFill)
@@ -809,14 +658,11 @@
     if (paintingDisabled())
         return;
 
-    const SkPath* path = pathToFill.platformPath();
-    if (!isPathSkiaSafe(getCTM(), *path))
-      return;
-
     const GraphicsContextState& state = m_state;
     SkPath::FillType ftype = state.fillRule == RULE_EVENODD ?
         SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType;
 
+    const SkPath* path = pathToFill.platformPath();
     SkPath storage;
     if (path->getFillType() != ftype) {
         storage = *path;
@@ -837,10 +683,6 @@
         return;
 
     SkRect r = rect;
-    if (!isRectSkiaSafe(getCTM(), r)) {
-        // See the other version of fillRect below.
-        ClipRectToCanvas(*platformContext()->canvas(), r, &r);
-    }
 
     SkPaint paint;
     platformContext()->setupPaintForFilling(&paint);
@@ -854,20 +696,6 @@
         return;
 
     SkRect r = rect;
-    if (!isRectSkiaSafe(getCTM(), r)) {
-        // Special case when the rectangle overflows fixed point. This is a
-        // workaround to fix bug 1212844. When the input rectangle is very
-        // large, it can overflow Skia's internal fixed point rect. This
-        // should be fixable in Skia (since the output bitmap isn't that
-        // large), but until that is fixed, we try to handle it ourselves.
-        //
-        // We manually clip the rectangle to the current clip rect. This
-        // will prevent overflow. The rectangle will be transformed to the
-        // canvas' coordinate space before it is converted to fixed point
-        // so we are guaranteed not to overflow after doing this.
-        ClipRectToCanvas(*platformContext()->canvas(), r, &r);
-    }
-
     SkPaint paint;
     platformContext()->setupPaintCommon(&paint);
     paint.setColor(color.rgb());
@@ -886,11 +714,6 @@
     if (paintingDisabled())
         return;
 
-    SkRect r = rect;
-    if (!isRectSkiaSafe(getCTM(), r))
-        // See fillRect().
-        ClipRectToCanvas(*platformContext()->canvas(), r, &r);
-
     if (topLeft.width() + topRight.width() > rect.width()
             || bottomLeft.width() + bottomRight.width() > rect.width()
             || topLeft.height() + bottomLeft.height() > rect.height()
@@ -902,6 +725,7 @@
         return;
     }
 
+    SkRect r = rect;
     SkPath path;
     addCornerArc(&path, r, topRight, 270);
     addCornerArc(&path, r, bottomRight, 0);
@@ -1194,8 +1018,6 @@
 
     SkPath path;
     path.addArc(oval, SkIntToScalar(-startAngle), SkIntToScalar(-angleSpan));
-    if (!isPathSkiaSafe(getCTM(), path))
-        return;
     platformContext()->canvas()->drawPath(path, paint);
     platformContext()->didDrawPath(path, paint);
 }
@@ -1206,9 +1028,6 @@
         return;
 
     const SkPath& path = *pathToStroke.platformPath();
-    if (!isPathSkiaSafe(getCTM(), path))
-        return;
-
     SkPaint paint;
     platformContext()->setupPaintForStroking(&paint, 0, 0);
     platformContext()->canvas()->drawPath(path, paint);
@@ -1220,9 +1039,6 @@
     if (paintingDisabled())
         return;
 
-    if (!isRectSkiaSafe(getCTM(), rect))
-        return;
-
     SkPaint paint;
     platformContext()->setupPaintForStroking(&paint, 0, 0);
     paint.setStrokeWidth(WebCoreFloatToSkScalar(lineWidth));
@@ -1285,9 +1101,6 @@
         return;
 
     SkRect rect = ellipse;
-    if (!isRectSkiaSafe(getCTM(), rect))
-        return;
-
     SkPaint paint;
     platformContext()->setupPaintForFilling(&paint);
     platformContext()->canvas()->drawOval(rect, paint);
@@ -1300,9 +1113,6 @@
         return;
 
     SkRect rect(ellipse);
-    if (!isRectSkiaSafe(getCTM(), rect))
-        return;
-
     SkPaint paint;
     platformContext()->setupPaintForStroking(&paint, 0, 0);
     platformContext()->canvas()->drawOval(rect, paint);
@@ -1310,3 +1120,4 @@
 }
 
 }  // namespace WebCore
+
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to