Gnash  0.8.11dev
Renderer_agg_bitmap.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #ifndef BACKEND_RENDER_HANDLER_AGG_BITMAP_H
20 #define BACKEND_RENDER_HANDLER_AGG_BITMAP_H
21 
22 #include <memory>
23 #include <memory>
24 #include <cstdint>
25 
26 #include "GnashImage.h"
27 #include "CachedBitmap.h"
28 
29 namespace gnash {
30 
32 {
33 public:
34 
35  agg_bitmap_info(std::unique_ptr<image::GnashImage> im)
36  :
37  _image(im.release()),
38  _bpp(_image->type() == image::TYPE_RGB ? 24 : 32)
39  {
40  }
41 
43  assert(!disposed());
44  return *_image;
45  }
46 
47  void dispose() {
48  _image.reset();
49  }
50 
51  bool disposed() const {
52  return !_image.get();
53  }
54 
55  int get_width() const { return _image->width(); }
56  int get_height() const { return _image->height(); }
57  int get_bpp() const { return _bpp; }
58  int get_rowlen() const { return _image->stride(); }
59  std::uint8_t* get_data() const { return _image->begin(); }
60 
61 private:
62 
63  std::unique_ptr<image::GnashImage> _image;
64 
65  int _bpp;
66 
67 };
68 
69 
70 } // namespace gnash
71 
72 #endif // BACKEND_RENDER_HANDLER_AGG_BITMAP_H
int get_bpp() const
Definition: Renderer_agg_bitmap.h:57
image::GnashImage & image()
Return a GnashImage for manipulation.
Definition: Renderer_agg_bitmap.h:42
Definition: Renderer_agg_bitmap.h:31
Definition: GnashImage.h:49
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
type
Definition: GnashKey.h:329
int get_width() const
Definition: Renderer_agg_bitmap.h:55
int get_height() const
Definition: Renderer_agg_bitmap.h:56
std::uint8_t * get_data() const
Definition: Renderer_agg_bitmap.h:59
agg_bitmap_info(std::unique_ptr< image::GnashImage > im)
Definition: Renderer_agg_bitmap.h:35
int get_rowlen() const
Definition: Renderer_agg_bitmap.h:58
Base class for different types of bitmaps.
Definition: GnashImage.h:77
void dispose()
Free the memory associated with this CachedBitmap.
Definition: Renderer_agg_bitmap.h:47
A CachedBitmap is created by the renderer in a format of its choosing.
Definition: CachedBitmap.h:37
bool disposed() const
Whether the CachedBitmap has been disposed.
Definition: Renderer_agg_bitmap.h:51