Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: Source/platform/graphics/GraphicsContext.cpp

Issue 781373002: use SkClipOps instead of (deprecated) SkRegion ops Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/graphics/GraphicsContext.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 } 1517 }
1518 1518
1519 void GraphicsContext::strokeEllipse(const FloatRect& ellipse) 1519 void GraphicsContext::strokeEllipse(const FloatRect& ellipse)
1520 { 1520 {
1521 if (contextDisabled()) 1521 if (contextDisabled())
1522 return; 1522 return;
1523 1523
1524 drawOval(ellipse, immutableState()->strokePaint()); 1524 drawOval(ellipse, immutableState()->strokePaint());
1525 } 1525 }
1526 1526
1527 void GraphicsContext::clipRoundedRect(const RoundedRect& rect, SkRegion::Op regi onOp) 1527 void GraphicsContext::clipRoundedRect(const RoundedRect& rect, SkClipOp op)
1528 { 1528 {
1529 if (contextDisabled()) 1529 if (contextDisabled())
1530 return; 1530 return;
1531 1531
1532 if (!rect.isRounded()) { 1532 if (!rect.isRounded()) {
1533 clipRect(rect.rect(), NotAntiAliased, regionOp); 1533 clipRect(rect.rect(), NotAntiAliased, op);
1534 return; 1534 return;
1535 } 1535 }
1536 1536
1537 SkVector radii[4]; 1537 SkVector radii[4];
1538 RoundedRect::Radii wkRadii = rect.radii(); 1538 RoundedRect::Radii wkRadii = rect.radii();
1539 setRadii(radii, wkRadii.topLeft(), wkRadii.topRight(), wkRadii.bottomRight() , wkRadii.bottomLeft()); 1539 setRadii(radii, wkRadii.topLeft(), wkRadii.topRight(), wkRadii.bottomRight() , wkRadii.bottomLeft());
1540 1540
1541 SkRRect r; 1541 SkRRect r;
1542 r.setRectRadii(rect.rect(), radii); 1542 r.setRectRadii(rect.rect(), radii);
1543 1543
1544 clipRRect(r, AntiAliased, regionOp); 1544 clipRRect(r, AntiAliased, op);
1545 } 1545 }
1546 1546
1547 void GraphicsContext::clipOut(const Path& pathToClip) 1547 void GraphicsContext::clipOut(const Path& pathToClip)
1548 { 1548 {
1549 if (contextDisabled()) 1549 if (contextDisabled())
1550 return; 1550 return;
1551 1551
1552 // Use const_cast and temporarily toggle the inverse fill type instead of co pying the path. 1552 // Use const_cast and temporarily toggle the inverse fill type instead of co pying the path.
1553 SkPath& path = const_cast<SkPath&>(pathToClip.skPath()); 1553 SkPath& path = const_cast<SkPath&>(pathToClip.skPath());
1554 path.toggleInverseFillType(); 1554 path.toggleInverseFillType();
(...skipping 27 matching lines...) Expand all
1582 SkPath path; 1582 SkPath path;
1583 setPathFromPoints(&path, numPoints, points); 1583 setPathFromPoints(&path, numPoints, points);
1584 clipPath(path, antialiased ? AntiAliased : NotAntiAliased); 1584 clipPath(path, antialiased ? AntiAliased : NotAntiAliased);
1585 } 1585 }
1586 1586
1587 void GraphicsContext::clipOutRoundedRect(const RoundedRect& rect) 1587 void GraphicsContext::clipOutRoundedRect(const RoundedRect& rect)
1588 { 1588 {
1589 if (contextDisabled()) 1589 if (contextDisabled())
1590 return; 1590 return;
1591 1591
1592 clipRoundedRect(rect, SkRegion::kDifference_Op); 1592 clipRoundedRect(rect, kDifference_SkClipOp);
1593 } 1593 }
1594 1594
1595 void GraphicsContext::clipRect(const SkRect& rect, AntiAliasingMode aa, SkRegion ::Op op) 1595 void GraphicsContext::clipRect(const SkRect& rect, AntiAliasingMode aa, SkClipOp op)
1596 { 1596 {
1597 ASSERT(m_canvas); 1597 ASSERT(m_canvas);
1598 if (contextDisabled()) 1598 if (contextDisabled())
1599 return; 1599 return;
1600 1600
1601 m_canvas->clipRect(rect, op, aa == AntiAliased); 1601 m_canvas->clipRect(rect, op, aa == AntiAliased);
1602 } 1602 }
1603 1603
1604 void GraphicsContext::clipPath(const SkPath& path, AntiAliasingMode aa, SkRegion ::Op op) 1604 void GraphicsContext::clipPath(const SkPath& path, AntiAliasingMode aa, SkClipOp op)
1605 { 1605 {
1606 ASSERT(m_canvas); 1606 ASSERT(m_canvas);
1607 if (contextDisabled()) 1607 if (contextDisabled())
1608 return; 1608 return;
1609 1609
1610 m_canvas->clipPath(path, op, aa == AntiAliased); 1610 m_canvas->clipPath(path, op, aa == AntiAliased);
1611 } 1611 }
1612 1612
1613 void GraphicsContext::clipRRect(const SkRRect& rect, AntiAliasingMode aa, SkRegi on::Op op) 1613 void GraphicsContext::clipRRect(const SkRRect& rect, AntiAliasingMode aa, SkClip Op op)
1614 { 1614 {
1615 ASSERT(m_canvas); 1615 ASSERT(m_canvas);
1616 if (contextDisabled()) 1616 if (contextDisabled())
1617 return; 1617 return;
1618 1618
1619 m_canvas->clipRRect(rect, op, aa == AntiAliased); 1619 m_canvas->clipRRect(rect, op, aa == AntiAliased);
1620 } 1620 }
1621 1621
1622 void GraphicsContext::rotate(float angleInRadians) 1622 void GraphicsContext::rotate(float angleInRadians)
1623 { 1623 {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 // FIXME: This is to not break tests (it results in the filter bitmap fl ag 1989 // FIXME: This is to not break tests (it results in the filter bitmap fl ag
1990 // being set to true). We need to decide if we respect InterpolationNone 1990 // being set to true). We need to decide if we respect InterpolationNone
1991 // being returned from computeInterpolationQuality. 1991 // being returned from computeInterpolationQuality.
1992 resampling = InterpolationLow; 1992 resampling = InterpolationLow;
1993 } 1993 }
1994 resampling = limitInterpolationQuality(this, resampling); 1994 resampling = limitInterpolationQuality(this, resampling);
1995 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling)); 1995 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling));
1996 } 1996 }
1997 1997
1998 } // namespace blink 1998 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/GraphicsContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698