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 | |
13 namespace gfx { | 11 namespace gfx { |
14 | 12 |
15 // ----------------------------------------------------------------------------- | 13 // I'm trying to get away with defining as little as possible on this. Right |
16 // This is the Linux bitmap backing for Skia. It's a GdkPixbuf of the correct | 14 // now, we don't do anything. |
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 // ----------------------------------------------------------------------------- | |
27 class BitmapPlatformDeviceLinux : public PlatformDeviceLinux { | 15 class BitmapPlatformDeviceLinux : public PlatformDeviceLinux { |
28 public: | 16 public: |
29 /// Static constructor. I don't understand this, it's just a copy of the mac | 17 /// Static constructor. I don't understand this, it's just a copy of the mac |
30 static BitmapPlatformDeviceLinux* Create(int width, int height, | 18 static BitmapPlatformDeviceLinux* Create(int width, int height, |
31 bool is_opaque); | 19 bool is_opaque); |
32 | 20 |
33 /// Create a BitmapPlatformDeviceLinux from an already constructed bitmap; | 21 /// Create a BitmapPlatformDeviceLinux from an already constructed bitmap; |
34 /// you should probably be using Create(). This may become private later if | 22 /// you should probably be using Create(). This may become private later if |
35 /// we ever have to share state between some native drawing UI and Skia, like | 23 /// we ever have to share state between some native drawing UI and Skia, like |
36 /// the Windows and Mac versions of this class do. | 24 /// the Windows and Mac versions of this class do. |
37 BitmapPlatformDeviceLinux(const SkBitmap& other, GdkPixbuf* pixbuf); | 25 BitmapPlatformDeviceLinux(const SkBitmap& other); |
38 virtual ~BitmapPlatformDeviceLinux(); | 26 virtual ~BitmapPlatformDeviceLinux(); |
39 | 27 |
40 // A stub copy constructor. Needs to be properly implemented. | 28 // A stub copy constructor. Needs to be properly implemented. |
41 BitmapPlatformDeviceLinux(const BitmapPlatformDeviceLinux& other); | 29 BitmapPlatformDeviceLinux(const BitmapPlatformDeviceLinux& other); |
42 | 30 |
43 // Bitmaps aren't vector graphics. | 31 // Bitmaps aren't vector graphics. |
44 virtual bool IsVectorial() { return false; } | 32 virtual bool IsVectorial() { return false; } |
45 | |
46 GdkPixbuf* pixbuf() const { return pixbuf_; } | |
47 | |
48 private: | |
49 GdkPixbuf* pixbuf_; | |
50 }; | 33 }; |
51 | 34 |
52 } // namespace gfx | 35 } // namespace gfx |
53 | 36 |
54 #endif // BASE_GFX_BITMAP_PLATFORM_DEVICE_LINUX_H_ | 37 #endif // BASE_GFX_BITMAP_PLATFORM_DEVICE_LINUX_H_ |
OLD | NEW |