| OLD | NEW |
| 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 25 matching lines...) Expand all Loading... |
| 36 #include "platform/graphics/GraphicsLayer.h" | 36 #include "platform/graphics/GraphicsLayer.h" |
| 37 #include "platform/graphics/ImageBuffer.h" | 37 #include "platform/graphics/ImageBuffer.h" |
| 38 #include "platform/graphics/gpu/Extensions3DUtil.h" | 38 #include "platform/graphics/gpu/Extensions3DUtil.h" |
| 39 #include "public/platform/Platform.h" | 39 #include "public/platform/Platform.h" |
| 40 #include "public/platform/WebCompositorSupport.h" | 40 #include "public/platform/WebCompositorSupport.h" |
| 41 #include "public/platform/WebExternalBitmap.h" | 41 #include "public/platform/WebExternalBitmap.h" |
| 42 #include "public/platform/WebExternalTextureLayer.h" | 42 #include "public/platform/WebExternalTextureLayer.h" |
| 43 #include "public/platform/WebGraphicsContext3D.h" | 43 #include "public/platform/WebGraphicsContext3D.h" |
| 44 #include "public/platform/WebGraphicsContext3DProvider.h" | 44 #include "public/platform/WebGraphicsContext3DProvider.h" |
| 45 #include "wtf/ArrayBufferContents.h" | 45 #include "wtf/ArrayBufferContents.h" |
| 46 #include "wtf/CheckedNumeric.h" | |
| 47 #include <algorithm> | 46 #include <algorithm> |
| 48 #ifndef NDEBUG | 47 #ifndef NDEBUG |
| 49 #include "wtf/RefCountedLeakCounter.h" | 48 #include "wtf/RefCountedLeakCounter.h" |
| 50 #endif | 49 #endif |
| 51 | 50 |
| 52 namespace blink { | 51 namespace blink { |
| 53 | 52 |
| 54 namespace { | 53 namespace { |
| 55 | 54 |
| 56 const float s_resourceAdjustedRatio = 0.5; | 55 const float s_resourceAdjustedRatio = 0.5; |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 { | 863 { |
| 865 m_packAlignment = param; | 864 m_packAlignment = param; |
| 866 } | 865 } |
| 867 | 866 |
| 868 bool DrawingBuffer::paintRenderingResultsToImageData(int& width, int& height, So
urceDrawingBuffer sourceBuffer, WTF::ArrayBufferContents& contents) | 867 bool DrawingBuffer::paintRenderingResultsToImageData(int& width, int& height, So
urceDrawingBuffer sourceBuffer, WTF::ArrayBufferContents& contents) |
| 869 { | 868 { |
| 870 ASSERT(!m_actualAttributes.premultipliedAlpha); | 869 ASSERT(!m_actualAttributes.premultipliedAlpha); |
| 871 width = size().width(); | 870 width = size().width(); |
| 872 height = size().height(); | 871 height = size().height(); |
| 873 | 872 |
| 874 CheckedNumeric<int> dataSize = 4; | 873 Checked<int, RecordOverflow> dataSize = 4; |
| 875 dataSize *= width; | 874 dataSize *= width; |
| 876 dataSize *= height; | 875 dataSize *= height; |
| 877 if (!dataSize.IsValid()) | 876 if (dataSize.hasOverflowed()) |
| 878 return false; | 877 return false; |
| 879 | 878 |
| 880 WTF::ArrayBufferContents pixels(width * height, 4, WTF::ArrayBufferContents:
:NotShared, WTF::ArrayBufferContents::DontInitialize); | 879 WTF::ArrayBufferContents pixels(width * height, 4, WTF::ArrayBufferContents:
:NotShared, WTF::ArrayBufferContents::DontInitialize); |
| 881 | 880 |
| 882 GLint fbo = 0; | 881 GLint fbo = 0; |
| 883 if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) { | 882 if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) { |
| 884 fbo = m_context->createFramebuffer(); | 883 fbo = m_context->createFramebuffer(); |
| 885 m_gl->BindFramebuffer(GL_FRAMEBUFFER, fbo); | 884 m_gl->BindFramebuffer(GL_FRAMEBUFFER, fbo); |
| 886 m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_front
ColorBuffer.texInfo.parameters.target, m_frontColorBuffer.texInfo.textureId, 0); | 885 m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_front
ColorBuffer.texInfo.parameters.target, m_frontColorBuffer.texInfo.textureId, 0); |
| 887 } else { | 886 } else { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 | 1038 |
| 1040 if (m_antiAliasingMode == MSAAImplicitResolve) | 1039 if (m_antiAliasingMode == MSAAImplicitResolve) |
| 1041 m_gl->FramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACH
MENT0, target, m_colorBuffer.textureId, 0, m_sampleCount); | 1040 m_gl->FramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACH
MENT0, target, m_colorBuffer.textureId, 0, m_sampleCount); |
| 1042 else | 1041 else |
| 1043 m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target,
m_colorBuffer.textureId, 0); | 1042 m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target,
m_colorBuffer.textureId, 0); |
| 1044 | 1043 |
| 1045 m_gl->BindTexture(GL_TEXTURE_2D, m_texture2DBinding); | 1044 m_gl->BindTexture(GL_TEXTURE_2D, m_texture2DBinding); |
| 1046 } | 1045 } |
| 1047 | 1046 |
| 1048 } // namespace blink | 1047 } // namespace blink |
| OLD | NEW |