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

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: Consider Return value optimization. Check assignment operator correctly. 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(const SVGMatrix& currentTrans form)
600 {
601 setTransform(currentTransform.a(), currentTransform.b(), currentTransform.c( ), currentTransform.d(), currentTransform.e(), currentTransform.f());
602 }
603
599 void CanvasRenderingContext2D::scale(float sx, float sy) 604 void CanvasRenderingContext2D::scale(float sx, float sy)
600 { 605 {
601 GraphicsContext* c = drawingContext(); 606 GraphicsContext* c = drawingContext();
602 if (!c) 607 if (!c)
603 return; 608 return;
604 if (!state().m_invertibleCTM) 609 if (!state().m_invertibleCTM)
605 return; 610 return;
606 611
607 if (!std::isfinite(sx) | !std::isfinite(sy)) 612 if (!std::isfinite(sx) | !std::isfinite(sy))
608 return; 613 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)) 696 if (!std::isfinite(m11) | !std::isfinite(m21) | !std::isfinite(dx) | !std::i sfinite(m12) | !std::isfinite(m22) | !std::isfinite(dy))
692 return; 697 return;
693 698
694 AffineTransform transform(m11, m12, m21, m22, dx, dy); 699 AffineTransform transform(m11, m12, m21, m22, dx, dy);
695 AffineTransform newTransform = state().m_transform * transform; 700 AffineTransform newTransform = state().m_transform * transform;
696 if (state().m_transform == newTransform) 701 if (state().m_transform == newTransform)
697 return; 702 return;
698 703
699 realizeSaves(); 704 realizeSaves();
700 705
706 modifiableState().m_transform = newTransform;
701 if (!newTransform.isInvertible()) { 707 if (!newTransform.isInvertible()) {
702 modifiableState().m_invertibleCTM = false; 708 modifiableState().m_invertibleCTM = false;
703 return; 709 return;
704 } 710 }
705 711
706 modifiableState().m_transform = newTransform;
707 c->concatCTM(transform); 712 c->concatCTM(transform);
708 m_path.transform(transform.inverse()); 713 m_path.transform(transform.inverse());
709 } 714 }
710 715
711 void CanvasRenderingContext2D::resetTransform() 716 void CanvasRenderingContext2D::resetTransform()
712 { 717 {
713 GraphicsContext* c = drawingContext(); 718 GraphicsContext* c = drawingContext();
714 if (!c) 719 if (!c)
715 return; 720 return;
716 721
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after
2366 Color focusRingColor = RenderTheme::focusRingColor(); 2371 Color focusRingColor = RenderTheme::focusRingColor();
2367 const int focusRingWidth = 5; 2372 const int focusRingWidth = 5;
2368 const int focusRingOutline = 0; 2373 const int focusRingOutline = 0;
2369 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); 2374 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor);
2370 didDraw(path.boundingRect()); 2375 didDraw(path.boundingRect());
2371 2376
2372 c->restore(); 2377 c->restore();
2373 } 2378 }
2374 2379
2375 } // namespace WebCore 2380 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698