OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_GFX_BITMAP_PLATFORM_DEVICE_LINUX_H_ | 5 #ifndef BASE_GFX_BITMAP_PLATFORM_DEVICE_LINUX_H_ |
6 #define BASE_GFX_BITMAP_PLATFORM_DEVICE_LINUX_H_ | 6 #define BASE_GFX_BITMAP_PLATFORM_DEVICE_LINUX_H_ |
7 | 7 |
8 #include "base/gfx/platform_device_linux.h" | 8 #include "base/gfx/platform_device_linux.h" |
9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
10 | 10 |
| 11 #include "gdk-pixbuf/gdk-pixbuf.h" |
| 12 |
11 namespace gfx { | 13 namespace gfx { |
12 | 14 |
13 // I'm trying to get away with defining as little as possible on this. Right | 15 // ----------------------------------------------------------------------------- |
14 // now, we don't do anything. | 16 // This is the Linux bitmap backing for Skia. It's a GdkPixbuf of the correct |
| 17 // size and we implement a SkPixelRef in order that Skia can write directly to |
| 18 // the pixel memory backing the Pixbuf. |
| 19 // |
| 20 // We then provide an accessor for getting the pixbuf object and that can be |
| 21 // drawn to a GDK drawing area to display the rendering result. |
| 22 // |
| 23 // This is all quite ok for test_shell. In the future we will want to use |
| 24 // shared memory between the renderer and the main process at least. In this |
| 25 // case we'll probably create the pixbuf from a precreated region of memory. |
| 26 // ----------------------------------------------------------------------------- |
15 class BitmapPlatformDeviceLinux : public PlatformDeviceLinux { | 27 class BitmapPlatformDeviceLinux : public PlatformDeviceLinux { |
16 public: | 28 public: |
17 /// Static constructor. I don't understand this, it's just a copy of the mac | 29 /// Static constructor. I don't understand this, it's just a copy of the mac |
18 static BitmapPlatformDeviceLinux* Create(int width, int height, | 30 static BitmapPlatformDeviceLinux* Create(int width, int height, |
19 bool is_opaque); | 31 bool is_opaque); |
20 | 32 |
21 /// Create a BitmapPlatformDeviceLinux from an already constructed bitmap; | 33 /// Create a BitmapPlatformDeviceLinux from an already constructed bitmap; |
22 /// you should probably be using Create(). This may become private later if | 34 /// you should probably be using Create(). This may become private later if |
23 /// we ever have to share state between some native drawing UI and Skia, like | 35 /// we ever have to share state between some native drawing UI and Skia, like |
24 /// the Windows and Mac versions of this class do. | 36 /// the Windows and Mac versions of this class do. |
25 BitmapPlatformDeviceLinux(const SkBitmap& other); | 37 BitmapPlatformDeviceLinux(const SkBitmap& other, GdkPixbuf* pixbuf); |
26 virtual ~BitmapPlatformDeviceLinux(); | 38 virtual ~BitmapPlatformDeviceLinux(); |
27 | 39 |
28 // A stub copy constructor. Needs to be properly implemented. | 40 // A stub copy constructor. Needs to be properly implemented. |
29 BitmapPlatformDeviceLinux(const BitmapPlatformDeviceLinux& other); | 41 BitmapPlatformDeviceLinux(const BitmapPlatformDeviceLinux& other); |
30 | 42 |
31 // Bitmaps aren't vector graphics. | 43 // Bitmaps aren't vector graphics. |
32 virtual bool IsVectorial() { return false; } | 44 virtual bool IsVectorial() { return false; } |
| 45 |
| 46 GdkPixbuf* pixbuf() const { return pixbuf_; } |
| 47 |
| 48 private: |
| 49 GdkPixbuf* pixbuf_; |
33 }; | 50 }; |
34 | 51 |
35 } // namespace gfx | 52 } // namespace gfx |
36 | 53 |
37 #endif // BASE_GFX_BITMAP_PLATFORM_DEVICE_LINUX_H_ | 54 #endif // BASE_GFX_BITMAP_PLATFORM_DEVICE_LINUX_H_ |
OLD | NEW |