Title: [93725] trunk/Source/WebCore
- Revision
- 93725
- Author
- r...@google.com
- Date
- 2011-08-24 13:08:51 -0700 (Wed, 24 Aug 2011)
Log Message
Change clip routine to promote the clipbounds up to (local) floats and then perform the intersection,
rather than rounding the srcRect down to integers.
https://bugs.webkit.org/show_bug.cgi?id=66810
Reviewed by Kenneth Russell.
No new tests. Existing tests that resize images will exercise this code path
* platform/graphics/skia/SkiaUtils.cpp:
(WebCore::ClipRectToCanvas):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (93724 => 93725)
--- trunk/Source/WebCore/ChangeLog 2011-08-24 20:04:44 UTC (rev 93724)
+++ trunk/Source/WebCore/ChangeLog 2011-08-24 20:08:51 UTC (rev 93725)
@@ -1,3 +1,16 @@
+2011-08-24 Mike Reed <r...@google.com>
+
+ Change clip routine to promote the clipbounds up to (local) floats and then perform the intersection,
+ rather than rounding the srcRect down to integers.
+ https://bugs.webkit.org/show_bug.cgi?id=66810
+
+ Reviewed by Kenneth Russell.
+
+ No new tests. Existing tests that resize images will exercise this code path
+
+ * platform/graphics/skia/SkiaUtils.cpp:
+ (WebCore::ClipRectToCanvas):
+
2011-08-24 Alexandru Chiculita <ach...@adobe.com>
[CSSRegions] RenderRegion is not used if there's another renderer after it
Modified: trunk/Source/WebCore/platform/graphics/skia/SkiaUtils.cpp (93724 => 93725)
--- trunk/Source/WebCore/platform/graphics/skia/SkiaUtils.cpp 2011-08-24 20:04:44 UTC (rev 93724)
+++ trunk/Source/WebCore/platform/graphics/skia/SkiaUtils.cpp 2011-08-24 20:08:51 UTC (rev 93725)
@@ -106,46 +106,12 @@
return SkPMColorToColor(pm);
}
-void IntersectRectAndRegion(const SkRegion& region, const SkRect& srcRect, SkRect* destRect) {
- // The cliperator requires an int rect, so we round out.
- SkIRect srcRectRounded;
- srcRect.roundOut(&srcRectRounded);
-
- // The Cliperator will iterate over a bunch of rects where our transformed
- // rect and the clipping region (which may be non-square) overlap.
- SkRegion::Cliperator cliperator(region, srcRectRounded);
- if (cliperator.done()) {
+void ClipRectToCanvas(const SkCanvas& canvas, const SkRect& srcRect, SkRect* destRect)
+{
+ if (!canvas.getClipBounds(destRect) || !destRect->intersect(srcRect))
destRect->setEmpty();
- return;
- }
-
- // Get the union of all visible rects in the clip that overlap our bitmap.
- SkIRect currentVisibleRect = cliperator.rect();
- cliperator.next();
- while (!cliperator.done()) {
- currentVisibleRect.join(cliperator.rect());
- cliperator.next();
- }
-
- destRect->set(currentVisibleRect);
}
-void ClipRectToCanvas(const SkCanvas& canvas, const SkRect& srcRect, SkRect* destRect) {
- // Translate into the canvas' coordinate space. This is where the clipping
- // region applies.
- SkRect transformedSrc;
- canvas.getTotalMatrix().mapRect(&transformedSrc, srcRect);
-
- // Do the intersection.
- SkRect transformedDest;
- IntersectRectAndRegion(canvas.getTotalClip(), transformedSrc, &transformedDest);
-
- // Now transform it back into world space.
- SkMatrix inverseTransform;
- canvas.getTotalMatrix().invert(&inverseTransform);
- inverseTransform.mapRect(destRect, transformedDest);
-}
-
bool SkPathContainsPoint(SkPath* originalPath, const FloatPoint& point, SkPath::FillType ft)
{
SkRegion rgn;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes