| OLD | NEW |
| 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 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 ASSERT(m_canvas); | 1107 ASSERT(m_canvas); |
| 1108 | 1108 |
| 1109 m_canvas->drawRRect(rrect, paint); | 1109 m_canvas->drawRRect(rrect, paint); |
| 1110 } | 1110 } |
| 1111 | 1111 |
| 1112 void GraphicsContext::fillPath(const Path& pathToFill) | 1112 void GraphicsContext::fillPath(const Path& pathToFill) |
| 1113 { | 1113 { |
| 1114 if (contextDisabled() || pathToFill.isEmpty()) | 1114 if (contextDisabled() || pathToFill.isEmpty()) |
| 1115 return; | 1115 return; |
| 1116 | 1116 |
| 1117 // Use const_cast and temporarily modify the fill type instead of copying th
e path. | 1117 drawPath(pathToFill.skPath(), immutableState()->fillPaint()); |
| 1118 SkPath& path = const_cast<SkPath&>(pathToFill.skPath()); | |
| 1119 SkPath::FillType previousFillType = path.getFillType(); | |
| 1120 | |
| 1121 SkPath::FillType temporaryFillType = WebCoreWindRuleToSkFillType(immutableSt
ate()->fillRule()); | |
| 1122 path.setFillType(temporaryFillType); | |
| 1123 | |
| 1124 drawPath(path, immutableState()->fillPaint()); | |
| 1125 | |
| 1126 path.setFillType(previousFillType); | |
| 1127 } | 1118 } |
| 1128 | 1119 |
| 1129 void GraphicsContext::fillRect(const FloatRect& rect) | 1120 void GraphicsContext::fillRect(const FloatRect& rect) |
| 1130 { | 1121 { |
| 1131 if (contextDisabled()) | 1122 if (contextDisabled()) |
| 1132 return; | 1123 return; |
| 1133 | 1124 |
| 1134 drawRect(rect, immutableState()->fillPaint()); | 1125 drawRect(rect, immutableState()->fillPaint()); |
| 1135 } | 1126 } |
| 1136 | 1127 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1460 { | 1451 { |
| 1461 setMatrix(affineTransformToSkMatrix(affine)); | 1452 setMatrix(affineTransformToSkMatrix(affine)); |
| 1462 } | 1453 } |
| 1463 | 1454 |
| 1464 void GraphicsContext::fillRectWithRoundedHole(const FloatRect& rect, const Float
RoundedRect& roundedHoleRect, const Color& color) | 1455 void GraphicsContext::fillRectWithRoundedHole(const FloatRect& rect, const Float
RoundedRect& roundedHoleRect, const Color& color) |
| 1465 { | 1456 { |
| 1466 if (contextDisabled()) | 1457 if (contextDisabled()) |
| 1467 return; | 1458 return; |
| 1468 | 1459 |
| 1469 Path path; | 1460 Path path; |
| 1461 path.setWindRule(RULE_EVENODD); |
| 1470 path.addRect(rect); | 1462 path.addRect(rect); |
| 1471 | 1463 |
| 1472 if (!roundedHoleRect.radii().isZero()) | 1464 if (!roundedHoleRect.radii().isZero()) |
| 1473 path.addRoundedRect(roundedHoleRect); | 1465 path.addRoundedRect(roundedHoleRect); |
| 1474 else | 1466 else |
| 1475 path.addRect(roundedHoleRect.rect()); | 1467 path.addRect(roundedHoleRect.rect()); |
| 1476 | 1468 |
| 1477 WindRule oldFillRule = immutableState()->fillRule(); | 1469 SkPaint paint(immutableState()->fillPaint()); |
| 1478 Color oldFillColor = fillColor(); | 1470 paint.setColor(color.rgb()); |
| 1479 | 1471 |
| 1480 setFillRule(RULE_EVENODD); | 1472 drawPath(path.skPath(), paint); |
| 1481 setFillColor(color); | |
| 1482 | |
| 1483 fillPath(path); | |
| 1484 | |
| 1485 setFillRule(oldFillRule); | |
| 1486 setFillColor(oldFillColor); | |
| 1487 } | 1473 } |
| 1488 | 1474 |
| 1489 void GraphicsContext::clearRect(const FloatRect& rect) | 1475 void GraphicsContext::clearRect(const FloatRect& rect) |
| 1490 { | 1476 { |
| 1491 if (contextDisabled()) | 1477 if (contextDisabled()) |
| 1492 return; | 1478 return; |
| 1493 | 1479 |
| 1494 SkRect r = rect; | 1480 SkRect r = rect; |
| 1495 SkPaint paint(immutableState()->fillPaint()); | 1481 SkPaint paint(immutableState()->fillPaint()); |
| 1496 paint.setXfermodeMode(SkXfermode::kClear_Mode); | 1482 paint.setXfermodeMode(SkXfermode::kClear_Mode); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1719 // being returned from computeInterpolationQuality. | 1705 // being returned from computeInterpolationQuality. |
| 1720 resampling = InterpolationLow; | 1706 resampling = InterpolationLow; |
| 1721 } | 1707 } |
| 1722 resampling = limitInterpolationQuality(this, resampling); | 1708 resampling = limitInterpolationQuality(this, resampling); |
| 1723 paint->setFilterQuality(static_cast<SkFilterQuality>(resampling)); | 1709 paint->setFilterQuality(static_cast<SkFilterQuality>(resampling)); |
| 1724 | 1710 |
| 1725 return initialSaveCount; | 1711 return initialSaveCount; |
| 1726 } | 1712 } |
| 1727 | 1713 |
| 1728 } // namespace blink | 1714 } // namespace blink |
| OLD | NEW |