OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2006, Google Inc. All rights reserved. | 2 * Copyright (c) 2006, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 SkPath path; | 399 SkPath path; |
400 path.addOval(oval, SkPath::kCCW_Direction); | 400 path.addOval(oval, SkPath::kCCW_Direction); |
401 platformContext()->canvas()->clipPath(path, SkRegion::kDifference_Op); | 401 platformContext()->canvas()->clipPath(path, SkRegion::kDifference_Op); |
402 } | 402 } |
403 | 403 |
404 void GraphicsContext::clipPath(WindRule clipRule) | 404 void GraphicsContext::clipPath(WindRule clipRule) |
405 { | 405 { |
406 if (paintingDisabled()) | 406 if (paintingDisabled()) |
407 return; | 407 return; |
408 | 408 |
409 const SkPath* oldPath = platformContext()->currentPathInGlobalCoordinates(); | 409 SkPath path = platformContext()->currentPath(); |
410 SkPath path(*oldPath); | |
411 path.setFillType(clipRule == RULE_EVENODD ? SkPath::kEvenOdd_FillType : SkPa
th::kWinding_FillType); | 410 path.setFillType(clipRule == RULE_EVENODD ? SkPath::kEvenOdd_FillType : SkPa
th::kWinding_FillType); |
412 platformContext()->canvas()->clipPath(path); | 411 platformContext()->canvas()->clipPath(path); |
413 } | 412 } |
414 | 413 |
415 void GraphicsContext::clipToImageBuffer(const FloatRect& rect, | 414 void GraphicsContext::clipToImageBuffer(const FloatRect& rect, |
416 const ImageBuffer* imageBuffer) | 415 const ImageBuffer* imageBuffer) |
417 { | 416 { |
418 if (paintingDisabled()) | 417 if (paintingDisabled()) |
419 return; | 418 return; |
420 | 419 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 ClipRectToCanvas(*platformContext()->canvas(), r, &r); | 668 ClipRectToCanvas(*platformContext()->canvas(), r, &r); |
670 | 669 |
671 platformContext()->drawRect(r); | 670 platformContext()->drawRect(r); |
672 } | 671 } |
673 | 672 |
674 void GraphicsContext::fillPath() | 673 void GraphicsContext::fillPath() |
675 { | 674 { |
676 if (paintingDisabled()) | 675 if (paintingDisabled()) |
677 return; | 676 return; |
678 | 677 |
679 SkPath path = platformContext()->currentPathInLocalCoordinates(); | 678 SkPath path = platformContext()->currentPath(); |
680 if (!isPathSkiaSafe(getCTM(), path)) | 679 if (!isPathSkiaSafe(getCTM(), path)) |
681 return; | 680 return; |
682 | 681 |
683 const GraphicsContextState& state = m_common->state; | 682 const GraphicsContextState& state = m_common->state; |
684 ColorSpace colorSpace = state.fillColorSpace; | 683 ColorSpace colorSpace = state.fillColorSpace; |
685 | 684 |
686 if (colorSpace == SolidColorSpace && !fillColor().alpha()) | 685 if (colorSpace == SolidColorSpace && !fillColor().alpha()) |
687 return; | 686 return; |
688 | 687 |
689 platformContext()->setFillRule(state.fillRule == RULE_EVENODD ? | 688 path.setFillType(state.fillRule == RULE_EVENODD ? |
690 SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType); | 689 SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType); |
691 | 690 |
692 SkPaint paint; | 691 SkPaint paint; |
693 platformContext()->setupPaintForFilling(&paint); | 692 platformContext()->setupPaintForFilling(&paint); |
694 | 693 |
695 if (colorSpace == PatternColorSpace) { | 694 if (colorSpace == PatternColorSpace) { |
696 SkShader* pat = state.fillPattern->createPlatformPattern(getCTM()); | 695 SkShader* pat = state.fillPattern->createPlatformPattern(getCTM()); |
697 paint.setShader(pat); | 696 paint.setShader(pat); |
698 pat->unref(); | 697 pat->unref(); |
699 } else if (colorSpace == GradientColorSpace) | 698 } else if (colorSpace == GradientColorSpace) |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 if (!isPathSkiaSafe(getCTM(), path)) | 1042 if (!isPathSkiaSafe(getCTM(), path)) |
1044 return; | 1043 return; |
1045 platformContext()->canvas()->drawPath(path, paint); | 1044 platformContext()->canvas()->drawPath(path, paint); |
1046 } | 1045 } |
1047 | 1046 |
1048 void GraphicsContext::strokePath() | 1047 void GraphicsContext::strokePath() |
1049 { | 1048 { |
1050 if (paintingDisabled()) | 1049 if (paintingDisabled()) |
1051 return; | 1050 return; |
1052 | 1051 |
1053 SkPath path = platformContext()->currentPathInLocalCoordinates(); | 1052 SkPath path = platformContext()->currentPath(); |
1054 if (!isPathSkiaSafe(getCTM(), path)) | 1053 if (!isPathSkiaSafe(getCTM(), path)) |
1055 return; | 1054 return; |
1056 | 1055 |
1057 const GraphicsContextState& state = m_common->state; | 1056 const GraphicsContextState& state = m_common->state; |
1058 ColorSpace colorSpace = state.strokeColorSpace; | 1057 ColorSpace colorSpace = state.strokeColorSpace; |
1059 | 1058 |
1060 if (colorSpace == SolidColorSpace && !strokeColor().alpha()) | 1059 if (colorSpace == SolidColorSpace && !strokeColor().alpha()) |
1061 return; | 1060 return; |
1062 | 1061 |
1063 SkPaint paint; | 1062 SkPaint paint; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 void GraphicsContext::translate(float w, float h) | 1112 void GraphicsContext::translate(float w, float h) |
1114 { | 1113 { |
1115 if (paintingDisabled()) | 1114 if (paintingDisabled()) |
1116 return; | 1115 return; |
1117 | 1116 |
1118 platformContext()->canvas()->translate(WebCoreFloatToSkScalar(w), | 1117 platformContext()->canvas()->translate(WebCoreFloatToSkScalar(w), |
1119 WebCoreFloatToSkScalar(h)); | 1118 WebCoreFloatToSkScalar(h)); |
1120 } | 1119 } |
1121 | 1120 |
1122 } // namespace WebCore | 1121 } // namespace WebCore |
OLD | NEW |