blob: b3b76932b77357d3be289a4856eee79695f05ba7 [file] [log] [blame]
daniel@transgaming.comb9d7e6f2012-10-31 19:08:32 +00001//
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
Jamie Madill135570a2014-09-30 16:33:51 -04007// Image.h: Implements the rx::Image class, an abstract base class for the
daniel@transgaming.com4ba24062012-12-20 20:54:24 +00008// renderer-specific classes which will define the interface to the underlying
9// surfaces or resources.
10
Geoff Lang2b5420c2014-11-19 14:20:15 -050011#include "libANGLE/renderer/Image.h"
12#include "libANGLE/Framebuffer.h"
daniel@transgaming.comb9d7e6f2012-10-31 19:08:32 +000013
daniel@transgaming.com31b13e12012-11-28 19:34:30 +000014namespace rx
daniel@transgaming.comb9d7e6f2012-10-31 19:08:32 +000015{
daniel@transgaming.com0ad830b2012-10-31 19:52:12 +000016
daniel@transgaming.comb9d7e6f2012-10-31 19:08:32 +000017Image::Image()
18{
Jamie Madill135570a2014-09-30 16:33:51 -040019 mWidth = 0;
daniel@transgaming.comb9d7e6f2012-10-31 19:08:32 +000020 mHeight = 0;
shannon.woods%transgaming.com@gtempaccount.com4760c562013-04-13 03:42:30 +000021 mDepth = 0;
daniel@transgaming.comb9d7e6f2012-10-31 19:08:32 +000022 mInternalFormat = GL_NONE;
daniel@transgaming.com20d36662012-10-31 19:51:43 +000023 mActualFormat = GL_NONE;
shannon.woods%transgaming.com@gtempaccount.com56074f32013-04-13 03:45:30 +000024 mTarget = GL_NONE;
shannonwoods@chromium.org803be0a2013-05-30 00:08:59 +000025 mRenderable = false;
Geoff Lang34256ed2013-09-30 15:15:52 -040026 mDirty = false;
daniel@transgaming.comb9d7e6f2012-10-31 19:08:32 +000027}
28
Geoff Langef7b0162014-09-04 13:29:23 -040029gl::Error Image::copy(GLint xoffset, GLint yoffset, GLint zoffset, const gl::Rectangle &area, gl::Framebuffer *source)
Jamie Madill5a0c45e2014-10-02 11:10:36 -040030{
31 gl::FramebufferAttachment *colorbuffer = source->getReadColorbuffer();
Geoff Langef7b0162014-09-04 13:29:23 -040032 ASSERT(colorbuffer);
Jamie Madill5a0c45e2014-10-02 11:10:36 -040033
Geoff Lang64f23f62014-09-10 14:40:12 -040034 RenderTarget *renderTarget = NULL;
35 gl::Error error = GetAttachmentRenderTarget(colorbuffer, &renderTarget);
36 if (error.isError())
37 {
38 return error;
39 }
40
Jamie Madill5a0c45e2014-10-02 11:10:36 -040041 ASSERT(renderTarget);
Geoff Langef7b0162014-09-04 13:29:23 -040042 return copy(xoffset, yoffset, zoffset, area, renderTarget);
Jamie Madill5a0c45e2014-10-02 11:10:36 -040043}
44
daniel@transgaming.comb9d7e6f2012-10-31 19:08:32 +000045}