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

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

Issue 327703005: The position of opaque black rect is incorrect when alpha is false. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: v/g/f/c/alpha.html needs rebaseline as well 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
« no previous file with comments | « LayoutTests/fast/canvas/alpha.html ('k') | no next file » | 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 if (imageBuffer) { 315 if (imageBuffer) {
316 CompositeOperator compositeOperator = !m_context || m_context->hasAl pha() ? CompositeSourceOver : CompositeCopy; 316 CompositeOperator compositeOperator = !m_context || m_context->hasAl pha() ? CompositeSourceOver : CompositeCopy;
317 if (m_presentedImage) 317 if (m_presentedImage)
318 context->drawImage(m_presentedImage.get(), pixelSnappedIntRect(r ), compositeOperator, DoNotRespectImageOrientation); 318 context->drawImage(m_presentedImage.get(), pixelSnappedIntRect(r ), compositeOperator, DoNotRespectImageOrientation);
319 else 319 else
320 context->drawImageBuffer(imageBuffer, pixelSnappedIntRect(r), 0, compositeOperator); 320 context->drawImageBuffer(imageBuffer, pixelSnappedIntRect(r), 0, compositeOperator);
321 } 321 }
322 } else { 322 } else {
323 // When alpha is false, we should draw to opaque black. 323 // When alpha is false, we should draw to opaque black.
324 if (m_context && !m_context->hasAlpha()) 324 if (m_context && !m_context->hasAlpha())
325 context->fillRect(FloatRect(0, 0, width(), height()), Color(0, 0, 0) ); 325 context->fillRect(FloatRect(r), Color(0, 0, 0));
326 } 326 }
327 327
328 if (is3D()) 328 if (is3D())
329 toWebGLRenderingContext(m_context.get())->markLayerComposited(); 329 toWebGLRenderingContext(m_context.get())->markLayerComposited();
330 } 330 }
331 331
332 bool HTMLCanvasElement::is3D() const 332 bool HTMLCanvasElement::is3D() const
333 { 333 {
334 return m_context && m_context->is3d(); 334 return m_context && m_context->is3d();
335 } 335 }
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 { 698 {
699 return !originClean(); 699 return !originClean();
700 } 700 }
701 701
702 FloatSize HTMLCanvasElement::sourceSize() const 702 FloatSize HTMLCanvasElement::sourceSize() const
703 { 703 {
704 return FloatSize(width(), height()); 704 return FloatSize(width(), height());
705 } 705 }
706 706
707 } 707 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/canvas/alpha.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698