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

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

Issue 895153002: Make CanvasRenderingContext2D use SkCanvas directly (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix issue with the copy composite operator Created 5 years, 10 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, 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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 if (checkedExternallyAllocatedMemory.safeGet(externallyAllocatedMemory) == C heckedState::DidOverflow) 693 if (checkedExternallyAllocatedMemory.safeGet(externallyAllocatedMemory) == C heckedState::DidOverflow)
694 externallyAllocatedMemory = std::numeric_limits<intptr_t>::max(); 694 externallyAllocatedMemory = std::numeric_limits<intptr_t>::max();
695 695
696 // Subtracting two intptr_t that are known to be positive will never underfl ow. 696 // Subtracting two intptr_t that are known to be positive will never underfl ow.
697 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(externallyA llocatedMemory - m_externallyAllocatedMemory); 697 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(externallyA llocatedMemory - m_externallyAllocatedMemory);
698 m_externallyAllocatedMemory = externallyAllocatedMemory; 698 m_externallyAllocatedMemory = externallyAllocatedMemory;
699 } 699 }
700 700
701 GraphicsContext* HTMLCanvasElement::drawingContext() const 701 GraphicsContext* HTMLCanvasElement::drawingContext() const
702 { 702 {
703 return buffer() ? m_imageBuffer->context() : 0; 703 return buffer() ? m_imageBuffer->context() : nullptr;
704 } 704 }
705 705
706 GraphicsContext* HTMLCanvasElement::existingDrawingContext() const 706 GraphicsContext* HTMLCanvasElement::existingDrawingContext() const
707 { 707 {
708 if (!hasImageBuffer()) 708 if (!hasImageBuffer())
709 return nullptr; 709 return nullptr;
710 710
711 return drawingContext(); 711 return drawingContext();
712 } 712 }
713 713
714 SkCanvas* HTMLCanvasElement::drawingCanvas() const
715 {
716 return buffer() ? m_imageBuffer->canvas() : nullptr;
717 }
718
719 SkCanvas* HTMLCanvasElement::existingDrawingCanvas() const
720 {
721 if (!hasImageBuffer())
722 return nullptr;
723
724 return m_imageBuffer->canvas();
725 }
726
714 ImageBuffer* HTMLCanvasElement::buffer() const 727 ImageBuffer* HTMLCanvasElement::buffer() const
715 { 728 {
716 ASSERT(m_context); 729 ASSERT(m_context);
717 if (!hasImageBuffer() && !m_didFailToCreateImageBuffer) 730 if (!hasImageBuffer() && !m_didFailToCreateImageBuffer)
718 const_cast<HTMLCanvasElement*>(this)->createImageBuffer(); 731 const_cast<HTMLCanvasElement*>(this)->createImageBuffer();
719 return m_imageBuffer.get(); 732 return m_imageBuffer.get();
720 } 733 }
721 734
722 void HTMLCanvasElement::ensureUnacceleratedImageBuffer() 735 void HTMLCanvasElement::ensureUnacceleratedImageBuffer()
723 { 736 {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 { 849 {
837 return !originClean(); 850 return !originClean();
838 } 851 }
839 852
840 FloatSize HTMLCanvasElement::sourceSize() const 853 FloatSize HTMLCanvasElement::sourceSize() const
841 { 854 {
842 return FloatSize(width(), height()); 855 return FloatSize(width(), height());
843 } 856 }
844 857
845 } 858 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLCanvasElement.h ('k') | Source/core/html/canvas/CanvasRenderingContext2D.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698