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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp

Issue 1814563002: wtf/CheckedArithmetic.h delegates to base/numerics/safe_math.h. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 { 857 {
858 m_packAlignment = param; 858 m_packAlignment = param;
859 } 859 }
860 860
861 bool DrawingBuffer::paintRenderingResultsToImageData(int& width, int& height, So urceDrawingBuffer sourceBuffer, WTF::ArrayBufferContents& contents) 861 bool DrawingBuffer::paintRenderingResultsToImageData(int& width, int& height, So urceDrawingBuffer sourceBuffer, WTF::ArrayBufferContents& contents)
862 { 862 {
863 ASSERT(!m_actualAttributes.premultipliedAlpha); 863 ASSERT(!m_actualAttributes.premultipliedAlpha);
864 width = size().width(); 864 width = size().width();
865 height = size().height(); 865 height = size().height();
866 866
867 Checked<int, RecordOverflow> dataSize = 4; 867 WTF::CheckedNumeric<int> dataSize = 4;
868 dataSize *= width; 868 dataSize *= width;
869 dataSize *= height; 869 dataSize *= height;
870 if (dataSize.hasOverflowed()) 870 if (!dataSize.IsValid())
871 return false; 871 return false;
872 872
873 WTF::ArrayBufferContents pixels(width * height, 4, WTF::ArrayBufferContents: :NotShared, WTF::ArrayBufferContents::DontInitialize); 873 WTF::ArrayBufferContents pixels(width * height, 4, WTF::ArrayBufferContents: :NotShared, WTF::ArrayBufferContents::DontInitialize);
874 874
875 GLint fbo = 0; 875 GLint fbo = 0;
876 if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) { 876 if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) {
877 fbo = m_context->createFramebuffer(); 877 fbo = m_context->createFramebuffer();
878 m_context->bindFramebuffer(GL_FRAMEBUFFER, fbo); 878 m_context->bindFramebuffer(GL_FRAMEBUFFER, fbo);
879 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_ frontColorBuffer.texInfo.parameters.target, m_frontColorBuffer.texInfo.textureId , 0); 879 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_ frontColorBuffer.texInfo.parameters.target, m_frontColorBuffer.texInfo.textureId , 0);
880 } else { 880 } else {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 1032
1033 if (m_antiAliasingMode == MSAAImplicitResolve) 1033 if (m_antiAliasingMode == MSAAImplicitResolve)
1034 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_A TTACHMENT0, target, m_colorBuffer.textureId, 0, m_sampleCount); 1034 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_A TTACHMENT0, target, m_colorBuffer.textureId, 0, m_sampleCount);
1035 else 1035 else
1036 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, ta rget, m_colorBuffer.textureId, 0); 1036 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, ta rget, m_colorBuffer.textureId, 0);
1037 1037
1038 m_context->bindTexture(GL_TEXTURE_2D, m_texture2DBinding); 1038 m_context->bindTexture(GL_TEXTURE_2D, m_texture2DBinding);
1039 } 1039 }
1040 1040
1041 } // namespace blink 1041 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698