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

Side by Side Diff: content/browser/renderer_host/compositing_iosurface_mac.mm

Issue 12220024: Fix CopyFromBackingStore giving back empty SkBitmaps on mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ifdef Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/compositing_iosurface_mac.h" 5 #include "content/browser/renderer_host/compositing_iosurface_mac.h"
6 6
7 #include <OpenGL/OpenGL.h> 7 #include <OpenGL/OpenGL.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 CHECK_GL_ERROR(); 858 CHECK_GL_ERROR();
859 859
860 if (buf) { 860 if (buf) {
861 SkAutoLockPixels bitmap_lock(copy_context_.out_buf); 861 SkAutoLockPixels bitmap_lock(copy_context_.out_buf);
862 memcpy(copy_context_.out_buf.getPixels(), buf, 862 memcpy(copy_context_.out_buf.getPixels(), buf,
863 copy_context_.dest_size.GetArea() * 4); 863 copy_context_.dest_size.GetArea() * 4);
864 glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB); CHECK_GL_ERROR(); 864 glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB); CHECK_GL_ERROR();
865 } 865 }
866 glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0); CHECK_GL_ERROR(); 866 glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0); CHECK_GL_ERROR();
867 867
868 // Ref so they don't get deleted in CleanupResourcesForCopy.
868 base::Callback<void(bool, const SkBitmap&)> callback = copy_context_.callback; 869 base::Callback<void(bool, const SkBitmap&)> callback = copy_context_.callback;
870 SkBitmap out_buf = copy_context_.out_buf;
871
869 CleanupResourcesForCopy(); 872 CleanupResourcesForCopy();
870 CGLSetCurrentContext(0); 873 CGLSetCurrentContext(0);
871 874
872 callback.Run(buf != NULL, copy_context_.out_buf); 875 callback.Run(buf != NULL, out_buf);
873 } 876 }
874 877
875 void CompositingIOSurfaceMac::CleanupResourcesForCopy() { 878 void CompositingIOSurfaceMac::CleanupResourcesForCopy() {
876 if (!copy_context_.started) 879 if (!copy_context_.started)
877 return; 880 return;
878 881
879 glDeleteFramebuffersEXT(1, &copy_context_.frame_buffer); CHECK_GL_ERROR(); 882 glDeleteFramebuffersEXT(1, &copy_context_.frame_buffer); CHECK_GL_ERROR();
880 glDeleteTextures(1, &copy_context_.frame_buffer_texture); CHECK_GL_ERROR(); 883 glDeleteTextures(1, &copy_context_.frame_buffer_texture); CHECK_GL_ERROR();
881 glDeleteBuffers(1, &copy_context_.pixel_buffer); CHECK_GL_ERROR(); 884 glDeleteBuffers(1, &copy_context_.pixel_buffer); CHECK_GL_ERROR();
882 if (copy_context_.use_fence) { 885 if (copy_context_.use_fence) {
883 glDeleteFencesAPPLE(1, &copy_context_.fence); CHECK_GL_ERROR(); 886 glDeleteFencesAPPLE(1, &copy_context_.fence); CHECK_GL_ERROR();
884 } 887 }
885 copy_context_.Reset(); 888 copy_context_.Reset();
886 } 889 }
887 890
888 } // namespace content 891 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698