| OLD | NEW | 
|---|
| 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  Loading... | 
| 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  Loading... | 
| 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 | 
| OLD | NEW | 
|---|