OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_SURFACE_TRANSPORT_DIB_H_ | 5 #ifndef UI_SURFACE_TRANSPORT_DIB_H_ |
6 #define UI_SURFACE_TRANSPORT_DIB_H_ | 6 #define UI_SURFACE_TRANSPORT_DIB_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // pointer will be owned by the caller. The bitmap will be of the given size, | 64 // pointer will be owned by the caller. The bitmap will be of the given size, |
65 // which should fit inside this memory. Bitmaps returned will be either | 65 // which should fit inside this memory. Bitmaps returned will be either |
66 // opaque or have premultiplied alpha. | 66 // opaque or have premultiplied alpha. |
67 // | 67 // |
68 // On POSIX, this |TransportDIB| will be mapped if not already. On Windows, | 68 // On POSIX, this |TransportDIB| will be mapped if not already. On Windows, |
69 // this |TransportDIB| will NOT be mapped and should not be mapped prior, | 69 // this |TransportDIB| will NOT be mapped and should not be mapped prior, |
70 // because PlatformCanvas will map the file internally. | 70 // because PlatformCanvas will map the file internally. |
71 // | 71 // |
72 // Will return NULL on allocation failure. This could be because the image | 72 // Will return NULL on allocation failure. This could be because the image |
73 // is too large to map into the current process' address space. | 73 // is too large to map into the current process' address space. |
74 SkCanvas* GetPlatformCanvas(int w, int h, bool opaque); | 74 std::unique_ptr<SkCanvas> GetPlatformCanvas(int w, int h, bool opaque); |
75 | 75 |
76 // Map the DIB into the current process if it is not already. This is used to | 76 // Map the DIB into the current process if it is not already. This is used to |
77 // map a DIB that has already been created. Returns true if the DIB is mapped. | 77 // map a DIB that has already been created. Returns true if the DIB is mapped. |
78 bool Map(); | 78 bool Map(); |
79 | 79 |
80 // Return a pointer to the shared memory. | 80 // Return a pointer to the shared memory. |
81 void* memory() const; | 81 void* memory() const; |
82 | 82 |
83 // Return the maximum size of the shared memory. This is not the amount of | 83 // Return the maximum size of the shared memory. This is not the amount of |
84 // data which is valid, you have to know that via other means, this is simply | 84 // data which is valid, you have to know that via other means, this is simply |
(...skipping 11 matching lines...) Expand all Loading... |
96 | 96 |
97 explicit TransportDIB(base::SharedMemoryHandle dib); | 97 explicit TransportDIB(base::SharedMemoryHandle dib); |
98 base::SharedMemory shared_memory_; | 98 base::SharedMemory shared_memory_; |
99 uint32_t sequence_num_; | 99 uint32_t sequence_num_; |
100 size_t size_; // length, in bytes | 100 size_t size_; // length, in bytes |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(TransportDIB); | 102 DISALLOW_COPY_AND_ASSIGN(TransportDIB); |
103 }; | 103 }; |
104 | 104 |
105 #endif // UI_SURFACE_TRANSPORT_DIB_H_ | 105 #endif // UI_SURFACE_TRANSPORT_DIB_H_ |
OLD | NEW |