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

Side by Side Diff: core/cross/gles2/render_surface_gles2.cc

Issue 1741009: Pulled changes from issue 669220 to fix building with renderer=gles2. (Closed)
Patch Set: Created 10 years, 7 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
« no previous file with comments | « core/cross/gles2/render_surface_gles2.h ('k') | core/cross/gles2/texture_gles2.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 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 Texture *texture) 47 Texture *texture)
48 : RenderSurface(service_locator, width, height, texture), 48 : RenderSurface(service_locator, width, height, texture),
49 cube_face_(cube_face), 49 cube_face_(cube_face),
50 mip_level_(mip_level) { 50 mip_level_(mip_level) {
51 DCHECK(texture); 51 DCHECK(texture);
52 } 52 }
53 53
54 RenderSurfaceGLES2::~RenderSurfaceGLES2() { 54 RenderSurfaceGLES2::~RenderSurfaceGLES2() {
55 } 55 }
56 56
57 Bitmap::Ref RenderSurfaceGLES2::PlatformSpecificGetBitmap() const { 57 bool RenderSurfaceGLES2::PlatformSpecificGetIntoBitmap(
58 Bitmap::Ref bitmap) const {
58 Renderer* renderer = service_locator()->GetService<Renderer>(); 59 Renderer* renderer = service_locator()->GetService<Renderer>();
59 DCHECK(renderer); 60 DCHECK(renderer);
60 61 DCHECK(bitmap->width() == static_cast<unsigned int>(clip_width()) &&
61 Bitmap::Ref bitmap = Bitmap::Ref(new Bitmap(service_locator())); 62 bitmap->height() == static_cast<unsigned int>(clip_height()) &&
62 bitmap->Allocate( 63 bitmap->num_mipmaps() == 1 &&
63 Texture::ARGB8, clip_width(), clip_height(), 1, Bitmap::IMAGE); 64 bitmap->format() == Texture::ARGB8);
64 65
65 const RenderSurface* old_render_surface; 66 const RenderSurface* old_render_surface;
66 const RenderDepthStencilSurface* old_depth_surface; 67 const RenderDepthStencilSurface* old_depth_surface;
67 bool old_is_back_buffer; 68 bool old_is_back_buffer;
68 69
69 renderer->GetRenderSurfaces(&old_render_surface, &old_depth_surface, 70 renderer->GetRenderSurfaces(&old_render_surface, &old_depth_surface,
70 &old_is_back_buffer); 71 &old_is_back_buffer);
71 renderer->SetRenderSurfaces(this, NULL, false); 72 renderer->SetRenderSurfaces(this, NULL, false);
72 73
73 ::glReadPixels(0, 0, clip_width(), clip_height(), GL_BGRA, GL_UNSIGNED_BYTE, 74 ::glReadPixels(0, 0, clip_width(), clip_height(), GL_BGRA, GL_UNSIGNED_BYTE,
74 bitmap->image_data()); 75 bitmap->image_data());
75 76
76 renderer->SetRenderSurfaces(old_render_surface, old_depth_surface, 77 renderer->SetRenderSurfaces(old_render_surface, old_depth_surface,
77 old_is_back_buffer); 78 old_is_back_buffer);
78 79
79 return bitmap; 80 return true;
80 } 81 }
81 82
82 RenderDepthStencilSurfaceGLES2::RenderDepthStencilSurfaceGLES2( 83 RenderDepthStencilSurfaceGLES2::RenderDepthStencilSurfaceGLES2(
83 ServiceLocator *service_locator, 84 ServiceLocator *service_locator,
84 int width, 85 int width,
85 int height) 86 int height)
86 : RenderDepthStencilSurface(service_locator, width, height) { 87 : RenderDepthStencilSurface(service_locator, width, height) {
87 88
88 #ifndef DISABLE_FBO 89 #ifndef DISABLE_FBO
89 #if defined(GLES2_BACKEND_DESKTOP_GL) 90 #if defined(GLES2_BACKEND_DESKTOP_GL)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 if (GLEW_EXT_packed_depth_stencil) { 134 if (GLEW_EXT_packed_depth_stencil) {
134 glDeleteRenderbuffersEXT(1, render_buffers_); 135 glDeleteRenderbuffersEXT(1, render_buffers_);
135 return; 136 return;
136 } 137 }
137 #endif 138 #endif
138 glDeleteRenderbuffersEXT(2, render_buffers_); 139 glDeleteRenderbuffersEXT(2, render_buffers_);
139 #endif 140 #endif
140 } 141 }
141 142
142 } // end namespace o3d 143 } // end namespace o3d
OLDNEW
« no previous file with comments | « core/cross/gles2/render_surface_gles2.h ('k') | core/cross/gles2/texture_gles2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698