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

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

Issue 200003002: Canvas element that use the alpha attribute don't display correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 8 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.js ('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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 319
320 if (hasImageBuffer()) { 320 if (hasImageBuffer()) {
321 ImageBuffer* imageBuffer = buffer(); 321 ImageBuffer* imageBuffer = buffer();
322 if (imageBuffer) { 322 if (imageBuffer) {
323 CompositeOperator compositeOperator = !m_context || m_context->hasAl pha() ? CompositeSourceOver : CompositeCopy; 323 CompositeOperator compositeOperator = !m_context || m_context->hasAl pha() ? CompositeSourceOver : CompositeCopy;
324 if (m_presentedImage) 324 if (m_presentedImage)
325 context->drawImage(m_presentedImage.get(), pixelSnappedIntRect(r ), compositeOperator, DoNotRespectImageOrientation); 325 context->drawImage(m_presentedImage.get(), pixelSnappedIntRect(r ), compositeOperator, DoNotRespectImageOrientation);
326 else 326 else
327 context->drawImageBuffer(imageBuffer, pixelSnappedIntRect(r), co mpositeOperator, blink::WebBlendModeNormal); 327 context->drawImageBuffer(imageBuffer, pixelSnappedIntRect(r), co mpositeOperator, blink::WebBlendModeNormal);
328 } 328 }
329 } else {
330 // When alpha is false, we should draw to opaque black.
331 if (m_context && !m_context->hasAlpha())
332 context->fillRect(FloatRect(0, 0, width(), height()), Color(0, 0, 0) );
329 } 333 }
330 334
331 if (is3D()) 335 if (is3D())
332 toWebGLRenderingContext(m_context.get())->markLayerComposited(); 336 toWebGLRenderingContext(m_context.get())->markLayerComposited();
333 } 337 }
334 338
335 bool HTMLCanvasElement::is3D() const 339 bool HTMLCanvasElement::is3D() const
336 { 340 {
337 return m_context && m_context->is3d(); 341 return m_context && m_context->is3d();
338 } 342 }
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 { 688 {
685 return !originClean(); 689 return !originClean();
686 } 690 }
687 691
688 FloatSize HTMLCanvasElement::sourceSize() const 692 FloatSize HTMLCanvasElement::sourceSize() const
689 { 693 {
690 return FloatSize(width(), height()); 694 return FloatSize(width(), height());
691 } 695 }
692 696
693 } 697 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/canvas/alpha.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698