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

Side by Side Diff: third_party/WebKit/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp

Issue 17454: Fixing gradient problem. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | third_party/WebKit/WebCore/platform/graphics/skia/PathSkia.cpp » ('j') | 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) 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
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()->currentPath(); 409 const SkPath* oldPath = platformContext()->currentPathInGlobalCoordinates();
410 SkPath path(*oldPath); 410 SkPath path(*oldPath);
411 path.setFillType(clipRule == RULE_EVENODD ? SkPath::kEvenOdd_FillType : SkPa th::kWinding_FillType); 411 path.setFillType(clipRule == RULE_EVENODD ? SkPath::kEvenOdd_FillType : SkPa th::kWinding_FillType);
412 platformContext()->canvas()->clipPath(path); 412 platformContext()->canvas()->clipPath(path);
413 } 413 }
414 414
415 void GraphicsContext::clipToImageBuffer(const FloatRect& rect, 415 void GraphicsContext::clipToImageBuffer(const FloatRect& rect,
416 const ImageBuffer* imageBuffer) 416 const ImageBuffer* imageBuffer)
417 { 417 {
418 if (paintingDisabled()) 418 if (paintingDisabled())
419 return; 419 return;
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 ClipRectToCanvas(*platformContext()->canvas(), r, &r); 669 ClipRectToCanvas(*platformContext()->canvas(), r, &r);
670 670
671 platformContext()->drawRect(r); 671 platformContext()->drawRect(r);
672 } 672 }
673 673
674 void GraphicsContext::fillPath() 674 void GraphicsContext::fillPath()
675 { 675 {
676 if (paintingDisabled()) 676 if (paintingDisabled())
677 return; 677 return;
678 678
679 const SkPath& path = *platformContext()->currentPath(); 679 SkPath path = platformContext()->currentPathInLocalCoordinates();
680 if (!isPathSkiaSafe(getCTM(), path)) 680 if (!isPathSkiaSafe(getCTM(), path))
681 return; 681 return;
682 682
683 const GraphicsContextState& state = m_common->state; 683 const GraphicsContextState& state = m_common->state;
684 ColorSpace colorSpace = state.fillColorSpace; 684 ColorSpace colorSpace = state.fillColorSpace;
685 685
686 if (colorSpace == SolidColorSpace && !fillColor().alpha()) 686 if (colorSpace == SolidColorSpace && !fillColor().alpha())
687 return; 687 return;
688 688
689 platformContext()->setFillRule(state.fillRule == RULE_EVENODD ? 689 platformContext()->setFillRule(state.fillRule == RULE_EVENODD ?
Evan Stade 2009/01/13 00:19:18 found the bug :( since path is no longer a refere
brettw 2009/01/13 17:44:36 Actually, I think this current code is pretty weir
690 SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType); 690 SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType);
691 691
692 SkPaint paint; 692 SkPaint paint;
693 platformContext()->setupPaintForFilling(&paint); 693 platformContext()->setupPaintForFilling(&paint);
694 694
695 if (colorSpace == PatternColorSpace) { 695 if (colorSpace == PatternColorSpace) {
696 SkShader* pat = state.fillPattern->createPlatformPattern(getCTM()); 696 SkShader* pat = state.fillPattern->createPlatformPattern(getCTM());
697 paint.setShader(pat); 697 paint.setShader(pat);
698 pat->unref(); 698 pat->unref();
699 } else if (colorSpace == GradientColorSpace) 699 } else if (colorSpace == GradientColorSpace)
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 if (!isPathSkiaSafe(getCTM(), path)) 1043 if (!isPathSkiaSafe(getCTM(), path))
1044 return; 1044 return;
1045 platformContext()->canvas()->drawPath(path, paint); 1045 platformContext()->canvas()->drawPath(path, paint);
1046 } 1046 }
1047 1047
1048 void GraphicsContext::strokePath() 1048 void GraphicsContext::strokePath()
1049 { 1049 {
1050 if (paintingDisabled()) 1050 if (paintingDisabled())
1051 return; 1051 return;
1052 1052
1053 const SkPath& path = *platformContext()->currentPath(); 1053 SkPath path = platformContext()->currentPathInLocalCoordinates();
1054 if (!isPathSkiaSafe(getCTM(), path)) 1054 if (!isPathSkiaSafe(getCTM(), path))
1055 return; 1055 return;
1056 1056
1057 const GraphicsContextState& state = m_common->state; 1057 const GraphicsContextState& state = m_common->state;
1058 ColorSpace colorSpace = state.strokeColorSpace; 1058 ColorSpace colorSpace = state.strokeColorSpace;
1059 1059
1060 if (colorSpace == SolidColorSpace && !strokeColor().alpha()) 1060 if (colorSpace == SolidColorSpace && !strokeColor().alpha())
1061 return; 1061 return;
1062 1062
1063 SkPaint paint; 1063 SkPaint paint;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 void GraphicsContext::translate(float w, float h) 1113 void GraphicsContext::translate(float w, float h)
1114 { 1114 {
1115 if (paintingDisabled()) 1115 if (paintingDisabled())
1116 return; 1116 return;
1117 1117
1118 platformContext()->canvas()->translate(WebCoreFloatToSkScalar(w), 1118 platformContext()->canvas()->translate(WebCoreFloatToSkScalar(w),
1119 WebCoreFloatToSkScalar(h)); 1119 WebCoreFloatToSkScalar(h));
1120 } 1120 }
1121 1121
1122 } // namespace WebCore 1122 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/WebCore/platform/graphics/skia/PathSkia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698