OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include <errno.h> | 5 #include <errno.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <sys/ipc.h> | 7 #include <sys/ipc.h> |
8 #include <sys/shm.h> | 8 #include <sys/shm.h> |
9 | 9 |
10 #include "base/gfx/size.h" | 10 #include "base/gfx/size.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 return NULL; | 73 return NULL; |
74 | 74 |
75 TransportDIB* dib = new TransportDIB; | 75 TransportDIB* dib = new TransportDIB; |
76 | 76 |
77 dib->address_ = address; | 77 dib->address_ = address; |
78 dib->size_ = shmst.shm_segsz; | 78 dib->size_ = shmst.shm_segsz; |
79 dib->key_ = shmkey; | 79 dib->key_ = shmkey; |
80 return dib; | 80 return dib; |
81 } | 81 } |
82 | 82 |
| 83 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { |
| 84 return new skia::PlatformCanvas(w, h, true, |
| 85 reinterpret_cast<uint8_t*>(memory())); |
| 86 } |
| 87 |
83 void* TransportDIB::memory() const { | 88 void* TransportDIB::memory() const { |
84 DCHECK_NE(address_, kInvalidAddress); | 89 DCHECK_NE(address_, kInvalidAddress); |
85 return address_; | 90 return address_; |
86 } | 91 } |
87 | 92 |
88 TransportDIB::Id TransportDIB::id() const { | 93 TransportDIB::Id TransportDIB::id() const { |
89 return key_; | 94 return key_; |
90 } | 95 } |
91 | 96 |
92 TransportDIB::Handle TransportDIB::handle() const { | 97 TransportDIB::Handle TransportDIB::handle() const { |
93 return key_; | 98 return key_; |
94 } | 99 } |
95 | 100 |
96 XID TransportDIB::MapToX(Display* display) { | 101 XID TransportDIB::MapToX(Display* display) { |
97 if (!x_shm_) { | 102 if (!x_shm_) { |
98 x_shm_ = x11_util::AttachSharedMemory(display, key_); | 103 x_shm_ = x11_util::AttachSharedMemory(display, key_); |
99 display_ = display; | 104 display_ = display; |
100 } | 105 } |
101 | 106 |
102 return x_shm_; | 107 return x_shm_; |
103 } | 108 } |
OLD | NEW |