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 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 | 1266 |
1267 void GraphicsContext::fillPath(const Path& pathToFill) | 1267 void GraphicsContext::fillPath(const Path& pathToFill) |
1268 { | 1268 { |
1269 if (contextDisabled() || pathToFill.isEmpty()) | 1269 if (contextDisabled() || pathToFill.isEmpty()) |
1270 return; | 1270 return; |
1271 | 1271 |
1272 // Use const_cast and temporarily modify the fill type instead of copying th
e path. | 1272 // Use const_cast and temporarily modify the fill type instead of copying th
e path. |
1273 SkPath& path = const_cast<SkPath&>(pathToFill.skPath()); | 1273 SkPath& path = const_cast<SkPath&>(pathToFill.skPath()); |
1274 SkPath::FillType previousFillType = path.getFillType(); | 1274 SkPath::FillType previousFillType = path.getFillType(); |
1275 | 1275 |
1276 SkPath::FillType temporaryFillType = | 1276 SkPath::FillType temporaryFillType = static_cast<SkPath::FillType>(immutable
State()->fillRule()); |
1277 immutableState()->fillRule() == RULE_EVENODD ? SkPath::kEvenOdd_FillType
: SkPath::kWinding_FillType; | |
1278 path.setFillType(temporaryFillType); | 1277 path.setFillType(temporaryFillType); |
1279 | 1278 |
1280 drawPath(path, immutableState()->fillPaint()); | 1279 drawPath(path, immutableState()->fillPaint()); |
1281 | 1280 |
1282 path.setFillType(previousFillType); | 1281 path.setFillType(previousFillType); |
1283 } | 1282 } |
1284 | 1283 |
1285 void GraphicsContext::fillRect(const FloatRect& rect) | 1284 void GraphicsContext::fillRect(const FloatRect& rect) |
1286 { | 1285 { |
1287 if (contextDisabled()) | 1286 if (contextDisabled()) |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 | 1457 |
1459 void GraphicsContext::clipPath(const Path& pathToClip, WindRule clipRule) | 1458 void GraphicsContext::clipPath(const Path& pathToClip, WindRule clipRule) |
1460 { | 1459 { |
1461 if (contextDisabled() || pathToClip.isEmpty()) | 1460 if (contextDisabled() || pathToClip.isEmpty()) |
1462 return; | 1461 return; |
1463 | 1462 |
1464 // Use const_cast and temporarily modify the fill type instead of copying th
e path. | 1463 // Use const_cast and temporarily modify the fill type instead of copying th
e path. |
1465 SkPath& path = const_cast<SkPath&>(pathToClip.skPath()); | 1464 SkPath& path = const_cast<SkPath&>(pathToClip.skPath()); |
1466 SkPath::FillType previousFillType = path.getFillType(); | 1465 SkPath::FillType previousFillType = path.getFillType(); |
1467 | 1466 |
1468 SkPath::FillType temporaryFillType = clipRule == RULE_EVENODD ? SkPath::kEve
nOdd_FillType : SkPath::kWinding_FillType; | 1467 SkPath::FillType temporaryFillType = static_cast<SkPath::FillType>(clipRule)
; |
1469 path.setFillType(temporaryFillType); | 1468 path.setFillType(temporaryFillType); |
1470 clipPath(path, AntiAliased); | 1469 clipPath(path, AntiAliased); |
1471 | 1470 |
1472 path.setFillType(previousFillType); | 1471 path.setFillType(previousFillType); |
1473 } | 1472 } |
1474 | 1473 |
1475 void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin
ts, bool antialiased) | 1474 void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin
ts, bool antialiased) |
1476 { | 1475 { |
1477 if (contextDisabled()) | 1476 if (contextDisabled()) |
1478 return; | 1477 return; |
(...skipping 16 matching lines...) Expand all Loading... |
1495 | 1494 |
1496 void GraphicsContext::canvasClip(const Path& pathToClip, WindRule clipRule) | 1495 void GraphicsContext::canvasClip(const Path& pathToClip, WindRule clipRule) |
1497 { | 1496 { |
1498 if (contextDisabled()) | 1497 if (contextDisabled()) |
1499 return; | 1498 return; |
1500 | 1499 |
1501 // Use const_cast and temporarily modify the fill type instead of copying th
e path. | 1500 // Use const_cast and temporarily modify the fill type instead of copying th
e path. |
1502 SkPath& path = const_cast<SkPath&>(pathToClip.skPath()); | 1501 SkPath& path = const_cast<SkPath&>(pathToClip.skPath()); |
1503 SkPath::FillType previousFillType = path.getFillType(); | 1502 SkPath::FillType previousFillType = path.getFillType(); |
1504 | 1503 |
1505 SkPath::FillType temporaryFillType = clipRule == RULE_EVENODD ? SkPath::kEve
nOdd_FillType : SkPath::kWinding_FillType; | 1504 SkPath::FillType temporaryFillType = static_cast<SkPath::FillType>(clipRule)
; |
1506 path.setFillType(temporaryFillType); | 1505 path.setFillType(temporaryFillType); |
1507 clipPath(path); | 1506 clipPath(path); |
1508 | 1507 |
1509 path.setFillType(previousFillType); | 1508 path.setFillType(previousFillType); |
1510 } | 1509 } |
1511 | 1510 |
1512 void GraphicsContext::clipRect(const SkRect& rect, AntiAliasingMode aa, SkRegion
::Op op) | 1511 void GraphicsContext::clipRect(const SkRect& rect, AntiAliasingMode aa, SkRegion
::Op op) |
1513 { | 1512 { |
1514 if (contextDisabled()) | 1513 if (contextDisabled()) |
1515 return; | 1514 return; |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1938 // FIXME: This is to not break tests (it results in the filter bitmap fl
ag | 1937 // FIXME: This is to not break tests (it results in the filter bitmap fl
ag |
1939 // being set to true). We need to decide if we respect InterpolationNone | 1938 // being set to true). We need to decide if we respect InterpolationNone |
1940 // being returned from computeInterpolationQuality. | 1939 // being returned from computeInterpolationQuality. |
1941 resampling = InterpolationLow; | 1940 resampling = InterpolationLow; |
1942 } | 1941 } |
1943 resampling = limitInterpolationQuality(this, resampling); | 1942 resampling = limitInterpolationQuality(this, resampling); |
1944 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling)); | 1943 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling)); |
1945 } | 1944 } |
1946 | 1945 |
1947 } | 1946 } |
OLD | NEW |