Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / angle / src / libGLESv2 / renderer / Image.cpp
1 //
2 // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6
7 // Image.h: Implements the rx::Image class, an abstract base class for the
8 // renderer-specific classes which will define the interface to the underlying
9 // surfaces or resources.
10
11 #include "libGLESv2/renderer/Image.h"
12 #include "libGLESv2/Framebuffer.h"
13 #include "libGLESv2/main.h"
14
15 namespace rx
16 {
17
18 Image::Image()
19 {
20     mWidth = 0;
21     mHeight = 0;
22     mDepth = 0;
23     mInternalFormat = GL_NONE;
24     mActualFormat = GL_NONE;
25     mTarget = GL_NONE;
26     mRenderable = false;
27     mDirty = false;
28 }
29
30 gl::Error Image::copy(GLint xoffset, GLint yoffset, GLint zoffset, const gl::Rectangle &area, gl::Framebuffer *source)
31 {
32     gl::FramebufferAttachment *colorbuffer = source->getReadColorbuffer();
33     ASSERT(colorbuffer);
34
35     RenderTarget *renderTarget = NULL;
36     gl::Error error = GetAttachmentRenderTarget(colorbuffer, &renderTarget);
37     if (error.isError())
38     {
39         return error;
40     }
41
42     ASSERT(renderTarget);
43     return copy(xoffset, yoffset, zoffset, area, renderTarget);
44 }
45
46 }