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

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

Issue 1186863005: Add a ref-counted data holder to ArrayBufferContents (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: type in ArrayBuffer::shareContentsWith Created 5 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
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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 ASSERT(!m_actualAttributes.premultipliedAlpha); 851 ASSERT(!m_actualAttributes.premultipliedAlpha);
852 width = size().width(); 852 width = size().width();
853 height = size().height(); 853 height = size().height();
854 854
855 Checked<int, RecordOverflow> dataSize = 4; 855 Checked<int, RecordOverflow> dataSize = 4;
856 dataSize *= width; 856 dataSize *= width;
857 dataSize *= height; 857 dataSize *= height;
858 if (dataSize.hasOverflowed()) 858 if (dataSize.hasOverflowed())
859 return false; 859 return false;
860 860
861 WTF::ArrayBufferContents pixels(width * height, 4, WTF::ArrayBufferContents: :DontInitialize); 861 WTF::ArrayBufferContents pixels(width * height, 4, WTF::ArrayBufferContents: :NotShared, WTF::ArrayBufferContents::DontInitialize);
862 862
863 GLint fbo = 0; 863 GLint fbo = 0;
864 if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) { 864 if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) {
865 fbo = m_context->createFramebuffer(); 865 fbo = m_context->createFramebuffer();
866 m_context->bindFramebuffer(GL_FRAMEBUFFER, fbo); 866 m_context->bindFramebuffer(GL_FRAMEBUFFER, fbo);
867 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL _TEXTURE_2D, m_frontColorBuffer.texInfo.textureId, 0); 867 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL _TEXTURE_2D, m_frontColorBuffer.texInfo.textureId, 0);
868 } else { 868 } else {
869 m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer()); 869 m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer());
870 } 870 }
871 871
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) 994 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info)
995 { 995 {
996 if (info->imageId) { 996 if (info->imageId) {
997 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); 997 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId);
998 m_context->destroyImageCHROMIUM(info->imageId); 998 m_context->destroyImageCHROMIUM(info->imageId);
999 info->imageId = 0; 999 info->imageId = 0;
1000 } 1000 }
1001 } 1001 }
1002 1002
1003 } // namespace blink 1003 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698