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: Defines 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#ifndef LIBGLESV2_RENDERER_IMAGE_H_
12#define LIBGLESV2_RENDERER_IMAGE_H_
13
14#include "common/debug.h"
15
16#include <GLES2/gl2.h>
17
18namespace gl
19{
20class Framebuffer;
21}
22
23namespace rx
24{
25
26class Renderer;
27
28class Image
29{
30  public:
31    Image();
32    virtual ~Image() {};
33
34    GLsizei getWidth() const { return mWidth; }
35    GLsizei getHeight() const { return mHeight; }
36    GLsizei getDepth() const { return mDepth; }
37    GLenum getInternalFormat() const { return mInternalFormat; }
38    GLenum getActualFormat() const { return mActualFormat; }
39    GLenum getTarget() const { return mTarget; }
40    bool isRenderableFormat() const { return mRenderable; }
41
42    void markDirty() {mDirty = true;}
43    void markClean() {mDirty = false;}
44    virtual bool isDirty() const = 0;
45
46    virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease) = 0;
47
48    virtual void loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
49                          GLint unpackAlignment, GLenum type, const void *input) = 0;
50    virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
51                                    const void *input) = 0;
52
53    virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
54
55  protected:
56    GLsizei mWidth;
57    GLsizei mHeight;
58    GLsizei mDepth;
59    GLenum mInternalFormat;
60    GLenum mActualFormat;
61    bool mRenderable;
62    GLenum mTarget;
63
64    bool mDirty;
65
66  private:
67    DISALLOW_COPY_AND_ASSIGN(Image);
68};
69
70}
71
72#endif // LIBGLESV2_RENDERER_IMAGE_H_
73