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 "chrome/common/transport_dib.h" | 5 #include "chrome/common/transport_dib.h" |
6 | 6 |
7 #include <unistd.h> | 7 #include <unistd.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 | 9 |
10 #include "base/eintr_wrapper.h" | 10 #include "base/eintr_wrapper.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 delete dib; | 45 delete dib; |
46 HANDLE_EINTR(close(handle.fd)); | 46 HANDLE_EINTR(close(handle.fd)); |
47 return false; | 47 return false; |
48 } | 48 } |
49 | 49 |
50 dib->size_ = st.st_size; | 50 dib->size_ = st.st_size; |
51 | 51 |
52 return dib; | 52 return dib; |
53 } | 53 } |
54 | 54 |
| 55 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { |
| 56 return new skia::PlatformCanvas(w, h, true, |
| 57 reinterpret_cast<uint8_t*>(dib->memory())); |
| 58 } |
| 59 |
55 void* TransportDIB::memory() const { | 60 void* TransportDIB::memory() const { |
56 return shared_memory_.memory(); | 61 return shared_memory_.memory(); |
57 } | 62 } |
58 | 63 |
59 TransportDIB::Id TransportDIB::id() const { | 64 TransportDIB::Id TransportDIB::id() const { |
60 return shared_memory_.id(); | 65 return shared_memory_.id(); |
61 } | 66 } |
62 | 67 |
63 TransportDIB::Handle TransportDIB::handle() const { | 68 TransportDIB::Handle TransportDIB::handle() const { |
64 return shared_memory_.handle(); | 69 return shared_memory_.handle(); |
65 } | 70 } |
OLD | NEW |