diff options
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/core/cross/gles2/render_surface_gles2.cc | 13 | ||||
-rw-r--r-- | o3d/core/cross/gles2/render_surface_gles2.h | 4 | ||||
-rw-r--r-- | o3d/core/cross/gles2/texture_gles2.cc | 1 |
3 files changed, 10 insertions, 8 deletions
diff --git a/o3d/core/cross/gles2/render_surface_gles2.cc b/o3d/core/cross/gles2/render_surface_gles2.cc index 6d21dc8..02b2ee3 100644 --- a/o3d/core/cross/gles2/render_surface_gles2.cc +++ b/o3d/core/cross/gles2/render_surface_gles2.cc @@ -54,13 +54,14 @@ RenderSurfaceGLES2::RenderSurfaceGLES2(ServiceLocator *service_locator, RenderSurfaceGLES2::~RenderSurfaceGLES2() { } -Bitmap::Ref RenderSurfaceGLES2::PlatformSpecificGetBitmap() const { +bool RenderSurfaceGLES2::PlatformSpecificGetIntoBitmap( + Bitmap::Ref bitmap) const { Renderer* renderer = service_locator()->GetService<Renderer>(); DCHECK(renderer); - - Bitmap::Ref bitmap = Bitmap::Ref(new Bitmap(service_locator())); - bitmap->Allocate( - Texture::ARGB8, clip_width(), clip_height(), 1, Bitmap::IMAGE); + DCHECK(bitmap->width() == static_cast<unsigned int>(clip_width()) && + bitmap->height() == static_cast<unsigned int>(clip_height()) && + bitmap->num_mipmaps() == 1 && + bitmap->format() == Texture::ARGB8); const RenderSurface* old_render_surface; const RenderDepthStencilSurface* old_depth_surface; @@ -76,7 +77,7 @@ Bitmap::Ref RenderSurfaceGLES2::PlatformSpecificGetBitmap() const { renderer->SetRenderSurfaces(old_render_surface, old_depth_surface, old_is_back_buffer); - return bitmap; + return true; } RenderDepthStencilSurfaceGLES2::RenderDepthStencilSurfaceGLES2( diff --git a/o3d/core/cross/gles2/render_surface_gles2.h b/o3d/core/cross/gles2/render_surface_gles2.h index 820647c..df5825b 100644 --- a/o3d/core/cross/gles2/render_surface_gles2.h +++ b/o3d/core/cross/gles2/render_surface_gles2.h @@ -74,8 +74,8 @@ class RenderSurfaceGLES2 : public RenderSurface { } protected: - // The platform specific part of GetBitmap. - virtual Bitmap::Ref PlatformSpecificGetBitmap() const; + // The platform specific part of GetIntoBitmap. + virtual bool PlatformSpecificGetIntoBitmap(Bitmap::Ref bitmap) const; private: GLenum cube_face_; diff --git a/o3d/core/cross/gles2/texture_gles2.cc b/o3d/core/cross/gles2/texture_gles2.cc index dcb652d..b4da4e8 100644 --- a/o3d/core/cross/gles2/texture_gles2.cc +++ b/o3d/core/cross/gles2/texture_gles2.cc @@ -319,6 +319,7 @@ Texture2DGLES2* Texture2DGLES2::Create(ServiceLocator* service_locator, bool enable_render_surfaces) { DLOG(INFO) << "Texture2DGLES2 Create"; DCHECK_NE(format, Texture::UNKNOWN_FORMAT); + DCHECK_GE(levels, 0); RendererGLES2 *renderer = static_cast<RendererGLES2 *>( service_locator->GetService<Renderer>()); renderer->MakeCurrentLazy(); |