OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 CHROME_COMMON_TRANSPORT_DIB_H_ | 5 #ifndef CHROME_COMMON_TRANSPORT_DIB_H_ |
6 #define CHROME_COMMON_TRANSPORT_DIB_H_ | 6 #define CHROME_COMMON_TRANSPORT_DIB_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "skia/ext/platform_canvas.h" |
9 | 10 |
10 #if defined(OS_WIN) || defined(OS_MACOSX) | 11 #if defined(OS_WIN) || defined(OS_MACOSX) |
11 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
12 #endif | 13 #endif |
13 | 14 |
14 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
15 #include <windows.h> | 16 #include <windows.h> |
16 #elif defined(OS_LINUX) | 17 #elif defined(OS_LINUX) |
17 #include "chrome/common/x11_util.h" | 18 #include "chrome/common/x11_util.h" |
18 #endif | 19 #endif |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 78 |
78 // Create a new TransportDIB | 79 // Create a new TransportDIB |
79 // size: the minimum size, in bytes | 80 // size: the minimum size, in bytes |
80 // epoch: Windows only: a global counter. See comment above. | 81 // epoch: Windows only: a global counter. See comment above. |
81 // returns: NULL on failure | 82 // returns: NULL on failure |
82 static TransportDIB* Create(size_t size, uint32 sequence_num); | 83 static TransportDIB* Create(size_t size, uint32 sequence_num); |
83 | 84 |
84 // Map the referenced transport DIB. Returns NULL on failure. | 85 // Map the referenced transport DIB. Returns NULL on failure. |
85 static TransportDIB* Map(Handle transport_dib); | 86 static TransportDIB* Map(Handle transport_dib); |
86 | 87 |
| 88 // Returns a canvas using the memory of this TransportDIB. The returned |
| 89 // pointer will be owned by the caller. The bitmap will be of the given size, |
| 90 // which should fit inside this memory. |
| 91 skia::PlatformCanvas* GetPlatformCanvas(int w, int h); |
| 92 |
87 // Return a pointer to the shared memory | 93 // Return a pointer to the shared memory |
88 void* memory() const; | 94 void* memory() const; |
89 | 95 |
90 // Return the maximum size of the shared memory. This is not the amount of | 96 // Return the maximum size of the shared memory. This is not the amount of |
91 // data which is valid, you have to know that via other means, this is simply | 97 // data which is valid, you have to know that via other means, this is simply |
92 // the maximum amount that /could/ be valid. | 98 // the maximum amount that /could/ be valid. |
93 size_t size() const { return size_; } | 99 size_t size() const { return size_; } |
94 | 100 |
95 // Return the identifier which can be used to refer to this shared memory | 101 // Return the identifier which can be used to refer to this shared memory |
96 // on the wire. | 102 // on the wire. |
(...skipping 20 matching lines...) Expand all Loading... |
117 void* address_; // mapped address | 123 void* address_; // mapped address |
118 XID x_shm_; // X id for the shared segment | 124 XID x_shm_; // X id for the shared segment |
119 Display* display_; // connection to the X server | 125 Display* display_; // connection to the X server |
120 #endif | 126 #endif |
121 size_t size_; // length, in bytes | 127 size_t size_; // length, in bytes |
122 }; | 128 }; |
123 | 129 |
124 class MessageLoop; | 130 class MessageLoop; |
125 | 131 |
126 #endif // CHROME_COMMON_TRANSPORT_DIB_H_ | 132 #endif // CHROME_COMMON_TRANSPORT_DIB_H_ |
OLD | NEW |