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

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 173593002: HTML5 Canvas should avoid converting rotation angle to degrees (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 9 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
« no previous file with comments | « Source/core/html/canvas/CanvasPathMethods.cpp ('k') | Source/platform/graphics/Path.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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved.
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
10 * 10 *
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 GraphicsContext* c = drawingContext(); 621 GraphicsContext* c = drawingContext();
622 if (!c) 622 if (!c)
623 return; 623 return;
624 if (!state().m_invertibleCTM) 624 if (!state().m_invertibleCTM)
625 return; 625 return;
626 626
627 if (!std::isfinite(angleInRadians)) 627 if (!std::isfinite(angleInRadians))
628 return; 628 return;
629 629
630 AffineTransform newTransform = state().m_transform; 630 AffineTransform newTransform = state().m_transform;
631 newTransform.rotate(angleInRadians / piDouble * 180.0); 631 newTransform.rotateRadians(angleInRadians);
632 if (state().m_transform == newTransform) 632 if (state().m_transform == newTransform)
633 return; 633 return;
634 634
635 realizeSaves(); 635 realizeSaves();
636 636
637 if (!newTransform.isInvertible()) { 637 if (!newTransform.isInvertible()) {
638 modifiableState().m_invertibleCTM = false; 638 modifiableState().m_invertibleCTM = false;
639 return; 639 return;
640 } 640 }
641 641
642 modifiableState().m_transform = newTransform; 642 modifiableState().m_transform = newTransform;
643 c->rotate(angleInRadians); 643 c->rotate(angleInRadians);
644 m_path.transform(AffineTransform().rotate(-angleInRadians / piDouble * 180.0 )); 644 m_path.transform(AffineTransform().rotateRadians(-angleInRadians));
645 } 645 }
646 646
647 void CanvasRenderingContext2D::translate(float tx, float ty) 647 void CanvasRenderingContext2D::translate(float tx, float ty)
648 { 648 {
649 GraphicsContext* c = drawingContext(); 649 GraphicsContext* c = drawingContext();
650 if (!c) 650 if (!c)
651 return; 651 return;
652 if (!state().m_invertibleCTM) 652 if (!state().m_invertibleCTM)
653 return; 653 return;
654 654
(...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after
2300 const int focusRingWidth = 5; 2300 const int focusRingWidth = 5;
2301 const int focusRingOutline = 0; 2301 const int focusRingOutline = 0;
2302 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); 2302 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor);
2303 2303
2304 c->restore(); 2304 c->restore();
2305 2305
2306 didDraw(dirtyRect); 2306 didDraw(dirtyRect);
2307 } 2307 }
2308 2308
2309 } // namespace WebCore 2309 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasPathMethods.cpp ('k') | Source/platform/graphics/Path.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698