~ubuntu-branches/ubuntu/raring/glmark2/raring

« back to all changes in this revision

Viewing changes to src/image-reader.h

  • Committer: Package Import Robot
  • Author(s): Ricardo Salveti de Araujo
  • Date: 2012-08-21 15:38:09 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20120821153809-bwux72bat8qp2n5v
Tags: 2012.08-0ubuntu1
* New upstream release 2012.08 (LP: #1039736)
  - Avoid crashing if gl used is not >= 2.0 (LP: #842279)
* Bumping dh compatibility level to v9
* debian/control:
  - Update Standards-Version to 3.9.3.
  - Add libjpeg-dev build dependency.
  - Use libegl1-x11-dev as an build-dep alternative instead of libegl1-dev.
  - Update description of glmark2-data binary package.
* debian/copyright:
  - Refresh copyright based on the current upstrem version
* debian/rules:
  - Clean compiled python code from unpacked waflib/ directory, as
    described in http://wiki.debian.org/UnpackWaf

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2012 Linaro Limited
 
3
 *
 
4
 * This file is part of the glmark2 OpenGL (ES) 2.0 benchmark.
 
5
 *
 
6
 * glmark2 is free software: you can redistribute it and/or modify it under the
 
7
 * terms of the GNU General Public License as published by the Free Software
 
8
 * Foundation, either version 3 of the License, or (at your option) any later
 
9
 * version.
 
10
 *
 
11
 * glmark2 is distributed in the hope that it will be useful, but WITHOUT ANY
 
12
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
13
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
14
 * details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License along with
 
17
 * glmark2.  If not, see <http://www.gnu.org/licenses/>.
 
18
 *
 
19
 * Authors:
 
20
 *  Alexandros Frantzis
 
21
 */
 
22
#include <string>
 
23
 
 
24
class ImageReader
 
25
{
 
26
public:
 
27
    virtual bool error() = 0;
 
28
    virtual bool nextRow(unsigned char *dst) = 0;
 
29
    virtual unsigned int width() const = 0;
 
30
    virtual unsigned int height() const = 0;
 
31
    virtual unsigned int pixelBytes() const = 0;
 
32
    virtual ~ImageReader() {}
 
33
};
 
34
 
 
35
class PNGReaderPrivate;
 
36
 
 
37
class PNGReader : public ImageReader
 
38
{
 
39
public:
 
40
    PNGReader(const std::string& filename);
 
41
 
 
42
    virtual ~PNGReader();
 
43
    bool error();
 
44
    bool nextRow(unsigned char *dst);
 
45
 
 
46
    unsigned int width() const;
 
47
    unsigned int height() const;
 
48
    unsigned int pixelBytes() const;
 
49
 
 
50
private:
 
51
    bool init(const std::string& filename);
 
52
    void finish();
 
53
 
 
54
    PNGReaderPrivate *priv_;
 
55
};
 
56
 
 
57
class JPEGReaderPrivate;
 
58
 
 
59
class JPEGReader : public ImageReader
 
60
{
 
61
public:
 
62
    JPEGReader(const std::string& filename);
 
63
 
 
64
    virtual ~JPEGReader();
 
65
    bool error();
 
66
    bool nextRow(unsigned char *dst);
 
67
    unsigned int width() const;
 
68
    unsigned int height() const;
 
69
    unsigned int pixelBytes() const;
 
70
 
 
71
private:
 
72
    bool init(const std::string& filename);
 
73
    void finish();
 
74
 
 
75
    JPEGReaderPrivate *priv_;
 
76
};
 
77