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

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

Issue 24233004: Support currentTransform in 2D Canvas. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove custom binding based on ch.dumez's work Created 7 years, 3 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
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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 return; 589 return;
590 realizeSaves(); 590 realizeSaves();
591 modifiableState().m_globalComposite = op; 591 modifiableState().m_globalComposite = op;
592 modifiableState().m_globalBlend = blendMode; 592 modifiableState().m_globalBlend = blendMode;
593 GraphicsContext* c = drawingContext(); 593 GraphicsContext* c = drawingContext();
594 if (!c) 594 if (!c)
595 return; 595 return;
596 c->setCompositeOperation(op, blendMode); 596 c->setCompositeOperation(op, blendMode);
597 } 597 }
598 598
599 void CanvasRenderingContext2D::setCurrentTransform(SVGPropertyTearOff<SVGMatrix> * currentTransform, ExceptionState& es)
600 {
601 if (!currentTransform) {
602 es.throwDOMException(TypeError);
603 return;
604 }
605 const SVGMatrix& matrix = currentTransform->propertyReference();
606 setTransform(matrix.a(), matrix.b(), matrix.c(), matrix.d(), matrix.e(), mat rix.f());
607 }
608
599 void CanvasRenderingContext2D::scale(float sx, float sy) 609 void CanvasRenderingContext2D::scale(float sx, float sy)
600 { 610 {
601 GraphicsContext* c = drawingContext(); 611 GraphicsContext* c = drawingContext();
602 if (!c) 612 if (!c)
603 return; 613 return;
604 if (!state().m_invertibleCTM) 614 if (!state().m_invertibleCTM)
605 return; 615 return;
606 616
607 if (!std::isfinite(sx) | !std::isfinite(sy)) 617 if (!std::isfinite(sx) | !std::isfinite(sy))
608 return; 618 return;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 if (!std::isfinite(m11) | !std::isfinite(m21) | !std::isfinite(dx) | !std::i sfinite(m12) | !std::isfinite(m22) | !std::isfinite(dy)) 701 if (!std::isfinite(m11) | !std::isfinite(m21) | !std::isfinite(dx) | !std::i sfinite(m12) | !std::isfinite(m22) | !std::isfinite(dy))
692 return; 702 return;
693 703
694 AffineTransform transform(m11, m12, m21, m22, dx, dy); 704 AffineTransform transform(m11, m12, m21, m22, dx, dy);
695 AffineTransform newTransform = state().m_transform * transform; 705 AffineTransform newTransform = state().m_transform * transform;
696 if (state().m_transform == newTransform) 706 if (state().m_transform == newTransform)
697 return; 707 return;
698 708
699 realizeSaves(); 709 realizeSaves();
700 710
711 modifiableState().m_transform = newTransform;
dshwang 2013/09/20 11:38:52 when setting non-invertible matrix, currentTransfo
701 if (!newTransform.isInvertible()) { 712 if (!newTransform.isInvertible()) {
702 modifiableState().m_invertibleCTM = false; 713 modifiableState().m_invertibleCTM = false;
703 return; 714 return;
704 } 715 }
705 716
706 modifiableState().m_transform = newTransform;
707 c->concatCTM(transform); 717 c->concatCTM(transform);
708 m_path.transform(transform.inverse()); 718 m_path.transform(transform.inverse());
709 } 719 }
710 720
711 void CanvasRenderingContext2D::resetTransform() 721 void CanvasRenderingContext2D::resetTransform()
712 { 722 {
713 GraphicsContext* c = drawingContext(); 723 GraphicsContext* c = drawingContext();
714 if (!c) 724 if (!c)
715 return; 725 return;
716 726
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after
2414 const int focusRingWidth = 5; 2424 const int focusRingWidth = 5;
2415 const int focusRingOutline = 0; 2425 const int focusRingOutline = 0;
2416 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); 2426 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor);
2417 2427
2418 c->restore(); 2428 c->restore();
2419 2429
2420 didDraw(dirtyRect); 2430 didDraw(dirtyRect);
2421 } 2431 }
2422 2432
2423 } // namespace WebCore 2433 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.h ('k') | Source/core/html/canvas/CanvasRenderingContext2D.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698