| 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 BitmapPlatformDeviceLinux_h |
| 6 #define BASE_GFX_BITMAP_PLATFORM_DEVICE_LINUX_H_ | 6 #define BitmapPlatformDeviceLinux_h |
| 7 | 7 |
| 8 #include "base/gfx/platform_device_linux.h" | 8 #include "PLatformDeviceLinux.h" |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 | 10 |
| 11 typedef struct _cairo_surface cairo_surface_t; | 11 typedef struct _cairo_surface cairo_surface_t; |
| 12 | 12 |
| 13 // ----------------------------------------------------------------------------- | 13 // ----------------------------------------------------------------------------- |
| 14 // Image byte ordering on Linux: | 14 // Image byte ordering on Linux: |
| 15 // | 15 // |
| 16 // Pixels are packed into 32-bit words these days. Even for 24-bit images, | 16 // Pixels are packed into 32-bit words these days. Even for 24-bit images, |
| 17 // often 8-bits will be left unused for alignment reasons. Thus, when you see | 17 // often 8-bits will be left unused for alignment reasons. Thus, when you see |
| 18 // ARGB as the byte order you have to wonder if that's in memory order or | 18 // ARGB as the byte order you have to wonder if that's in memory order or |
| (...skipping 29 matching lines...) Expand all Loading... |
| 48 // machines). | 48 // machines). |
| 49 // | 49 // |
| 50 // For now we are also using Cairo to paint to the Drawables so we provide an | 50 // For now we are also using Cairo to paint to the Drawables so we provide an |
| 51 // accessor for getting the surface. | 51 // accessor for getting the surface. |
| 52 // | 52 // |
| 53 // This is all quite ok for test_shell. In the future we will want to use | 53 // This is all quite ok for test_shell. In the future we will want to use |
| 54 // shared memory between the renderer and the main process at least. In this | 54 // shared memory between the renderer and the main process at least. In this |
| 55 // case we'll probably create the buffer from a precreated region of memory. | 55 // case we'll probably create the buffer from a precreated region of memory. |
| 56 // ----------------------------------------------------------------------------- | 56 // ----------------------------------------------------------------------------- |
| 57 class BitmapPlatformDeviceLinux : public PlatformDeviceLinux { | 57 class BitmapPlatformDeviceLinux : public PlatformDeviceLinux { |
| 58 // A reference counted cairo surface |
| 59 class BitmapPlatformDeviceLinuxData; |
| 60 |
| 58 public: | 61 public: |
| 59 /// Static constructor. I don't understand this, it's just a copy of the mac | 62 /// Static constructor. I don't understand this, it's just a copy of the mac |
| 60 static BitmapPlatformDeviceLinux* Create(int width, int height, | 63 static BitmapPlatformDeviceLinux* Create(int width, int height, |
| 61 bool is_opaque); | 64 bool is_opaque); |
| 62 | 65 |
| 63 // Create a BitmapPlatformDeviceLinux from an already constructed bitmap; | 66 // Create a BitmapPlatformDeviceLinux from an already constructed bitmap; |
| 64 // you should probably be using Create(). This may become private later if | 67 // you should probably be using Create(). This may become private later if |
| 65 // we ever have to share state between some native drawing UI and Skia, like | 68 // we ever have to share state between some native drawing UI and Skia, like |
| 66 // the Windows and Mac versions of this class do. | 69 // the Windows and Mac versions of this class do. |
| 67 // | 70 // |
| 68 // This object takes ownership of @surface. | 71 // This object takes ownership of @data. |
| 69 BitmapPlatformDeviceLinux(const SkBitmap& other, cairo_surface_t* surface); | 72 BitmapPlatformDeviceLinux(const SkBitmap& other, |
| 73 BitmapPlatformDeviceLinuxData* data); |
| 70 virtual ~BitmapPlatformDeviceLinux(); | 74 virtual ~BitmapPlatformDeviceLinux(); |
| 75 BitmapPlatformDeviceLinux& operator=(const BitmapPlatformDeviceLinux& other); |
| 71 | 76 |
| 72 // A stub copy constructor. Needs to be properly implemented. | 77 // A stub copy constructor. Needs to be properly implemented. |
| 73 BitmapPlatformDeviceLinux(const BitmapPlatformDeviceLinux& other); | 78 BitmapPlatformDeviceLinux(const BitmapPlatformDeviceLinux& other); |
| 74 | 79 |
| 75 // Bitmaps aren't vector graphics. | 80 // Bitmaps aren't vector graphics. |
| 76 virtual bool IsVectorial() { return false; } | 81 virtual bool IsVectorial() { return false; } |
| 77 | 82 |
| 78 cairo_surface_t* surface() const { return surface_; } | 83 cairo_surface_t* surface() const; |
| 79 | 84 |
| 80 private: | 85 private: |
| 81 cairo_surface_t* surface_; | 86 scoped_refptr<BitmapPlatformDeviceLinuxData> data_; |
| 82 }; | 87 }; |
| 83 | 88 |
| 84 } // namespace gfx | 89 } // namespace gfx |
| 85 | 90 |
| 86 #endif // BASE_GFX_BITMAP_PLATFORM_DEVICE_LINUX_H_ | 91 #endif // BitmapPlatformDeviceLinux_h |
| OLD | NEW |