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

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

Issue 293963009: Fixing GraphicsContext state checks to support oilpan (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: removed change to test expectations Created 6 years, 6 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 | « no previous file | Source/core/html/canvas/CanvasRenderingContext2D.h » ('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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 return adoptRefWillBeRefCountedGarbageCollected(new HTMLCanvasElement(docume nt)); 91 return adoptRefWillBeRefCountedGarbageCollected(new HTMLCanvasElement(docume nt));
92 } 92 }
93 93
94 HTMLCanvasElement::~HTMLCanvasElement() 94 HTMLCanvasElement::~HTMLCanvasElement()
95 { 95 {
96 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_external lyAllocatedMemory); 96 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_external lyAllocatedMemory);
97 #if !ENABLE(OILPAN) 97 #if !ENABLE(OILPAN)
98 HashSet<RawPtr<CanvasObserver> >::iterator end = m_observers.end(); 98 HashSet<RawPtr<CanvasObserver> >::iterator end = m_observers.end();
99 for (HashSet<RawPtr<CanvasObserver> >::iterator it = m_observers.begin(); it != end; ++it) 99 for (HashSet<RawPtr<CanvasObserver> >::iterator it = m_observers.begin(); it != end; ++it)
100 (*it)->canvasDestroyed(this); 100 (*it)->canvasDestroyed(this);
101 m_context.clear(); // Ensure this goes away before the ImageBuffer. 101 // Ensure these go away before the ImageBuffer.
102 m_contextStateSaver.clear();
103 m_context.clear();
102 #endif 104 #endif
103 } 105 }
104 106
105 void HTMLCanvasElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) 107 void HTMLCanvasElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value)
106 { 108 {
107 if (name == widthAttr || name == heightAttr) 109 if (name == widthAttr || name == heightAttr)
108 reset(); 110 reset();
109 HTMLElement::parseAttribute(name, value); 111 HTMLElement::parseAttribute(name, value);
110 } 112 }
111 113
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 m_imageBuffer->context()->setImageInterpolationQuality(CanvasDefaultInterpol ationQuality); 510 m_imageBuffer->context()->setImageInterpolationQuality(CanvasDefaultInterpol ationQuality);
509 // Enabling MSAA overrides a request to disable antialiasing. This is true r egardless of whether the 511 // Enabling MSAA overrides a request to disable antialiasing. This is true r egardless of whether the
510 // rendering mode is accelerated or not. For consistency, we don't want to a pply AA in accelerated 512 // rendering mode is accelerated or not. For consistency, we don't want to a pply AA in accelerated
511 // canvases but not in unaccelerated canvases. 513 // canvases but not in unaccelerated canvases.
512 if (!msaaSampleCount && document().settings() && !document().settings()->ant ialiased2dCanvasEnabled()) 514 if (!msaaSampleCount && document().settings() && !document().settings()->ant ialiased2dCanvasEnabled())
513 m_imageBuffer->context()->setShouldAntialias(false); 515 m_imageBuffer->context()->setShouldAntialias(false);
514 // GraphicsContext's defaults don't always agree with the 2d canvas spec. 516 // GraphicsContext's defaults don't always agree with the 2d canvas spec.
515 // See CanvasRenderingContext2D::State::State() for more information. 517 // See CanvasRenderingContext2D::State::State() for more information.
516 m_imageBuffer->context()->setMiterLimit(10); 518 m_imageBuffer->context()->setMiterLimit(10);
517 m_imageBuffer->context()->setStrokeThickness(1); 519 m_imageBuffer->context()->setStrokeThickness(1);
520 #if !ASSERT_DISABLED
521 m_imageBuffer->context()->disableDestructionChecks(); // 2D canvas is allowe d to leave context in an unfinalized state.
522 #endif
518 m_contextStateSaver = adoptPtr(new GraphicsContextStateSaver(*m_imageBuffer- >context())); 523 m_contextStateSaver = adoptPtr(new GraphicsContextStateSaver(*m_imageBuffer- >context()));
519 524
520 if (m_context) 525 if (m_context)
521 setNeedsCompositingUpdate(); 526 setNeedsCompositingUpdate();
522 } 527 }
523 528
524 void HTMLCanvasElement::notifySurfaceInvalid() 529 void HTMLCanvasElement::notifySurfaceInvalid()
525 { 530 {
526 if (m_context && m_context->is2d()) { 531 if (m_context && m_context->is2d()) {
527 CanvasRenderingContext2D* context2d = toCanvasRenderingContext2D(m_conte xt.get()); 532 CanvasRenderingContext2D* context2d = toCanvasRenderingContext2D(m_conte xt.get());
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 { 700 {
696 return !originClean(); 701 return !originClean();
697 } 702 }
698 703
699 FloatSize HTMLCanvasElement::sourceSize() const 704 FloatSize HTMLCanvasElement::sourceSize() const
700 { 705 {
701 return FloatSize(width(), height()); 706 return FloatSize(width(), height());
702 } 707 }
703 708
704 } 709 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/canvas/CanvasRenderingContext2D.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698