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