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

Side by Side Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 181693006: Refactoring source image usage in CanvasRenderingContext2D (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: applied last corrections 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLCanvasElement.h ('k') | Source/core/html/HTMLCanvasElement.idl » ('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, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 } 592 }
593 } 593 }
594 } 594 }
595 595
596 void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument) 596 void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument)
597 { 597 {
598 setObservedDocument(document()); 598 setObservedDocument(document());
599 HTMLElement::didMoveToNewDocument(oldDocument); 599 HTMLElement::didMoveToNewDocument(oldDocument);
600 } 600 }
601 601
602 PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(SourceImageMode mod e, SourceImageStatus* status) const
603 {
604 if (!width() || !height()) {
605 *status = ZeroSizeCanvasSourceImageStatus;
606 return nullptr;
607 }
608
609 if (!buffer()) {
610 *status = InvalidSourceImageStatus;
611 return nullptr;
612 }
613
614 if (mode == CopySourceImageIfVolatile) {
615 *status = NormalSourceImageStatus;
616 return copiedImage();
617 }
618
619 if (m_context && m_context->is3d()) {
620 m_context->paintRenderingResultsToCanvas();
621 *status = ExternalSourceImageStatus;
622 } else {
623 *status = NormalSourceImageStatus;
624 }
625 return m_imageBuffer->copyImage(DontCopyBackingStore, Unscaled);
602 } 626 }
627
628 bool HTMLCanvasElement::wouldTaintOrigin(SecurityOrigin*) const
629 {
630 return !originClean();
631 }
632
633 FloatSize HTMLCanvasElement::sourceSize() const
634 {
635 return FloatSize(width(), height());
636 }
637
638 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLCanvasElement.h ('k') | Source/core/html/HTMLCanvasElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698