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 <limits> | 5 #include <limits> |
6 #include <windows.h> | 6 #include <windows.h> |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
10 #include "chrome/common/transport_dib.h" | 10 #include "chrome/common/transport_dib.h" |
| 11 #include "skia/ext/platform_canvas.h" |
11 | 12 |
12 TransportDIB::TransportDIB() { | 13 TransportDIB::TransportDIB() { |
13 } | 14 } |
14 | 15 |
15 TransportDIB::~TransportDIB() { | 16 TransportDIB::~TransportDIB() { |
16 } | 17 } |
17 | 18 |
18 TransportDIB::TransportDIB(HANDLE handle) | 19 TransportDIB::TransportDIB(HANDLE handle) |
19 : shared_memory_(handle, false /* read write */) { | 20 : shared_memory_(handle, false /* read write */) { |
20 } | 21 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 53 |
53 // There doesn't seem to be any way to find the size of the shared memory | 54 // There doesn't seem to be any way to find the size of the shared memory |
54 // region! GetFileSize indicates that the handle is invalid. Thus, we | 55 // region! GetFileSize indicates that the handle is invalid. Thus, we |
55 // conservatively set the size to the maximum and hope that the renderer | 56 // conservatively set the size to the maximum and hope that the renderer |
56 // isn't about to ask us to read off the end of the array. | 57 // isn't about to ask us to read off the end of the array. |
57 dib->size_ = std::numeric_limits<size_t>::max(); | 58 dib->size_ = std::numeric_limits<size_t>::max(); |
58 | 59 |
59 return dib; | 60 return dib; |
60 } | 61 } |
61 | 62 |
| 63 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { |
| 64 return new skia::PlatformCanvas(w, h, true, handle()); |
| 65 } |
| 66 |
62 void* TransportDIB::memory() const { | 67 void* TransportDIB::memory() const { |
63 return shared_memory_.memory(); | 68 return shared_memory_.memory(); |
64 } | 69 } |
65 | 70 |
66 TransportDIB::Handle TransportDIB::handle() const { | 71 TransportDIB::Handle TransportDIB::handle() const { |
67 return shared_memory_.handle(); | 72 return shared_memory_.handle(); |
68 } | 73 } |
69 | 74 |
70 TransportDIB::Id TransportDIB::id() const { | 75 TransportDIB::Id TransportDIB::id() const { |
71 return Id(shared_memory_.handle(), sequence_num_); | 76 return Id(shared_memory_.handle(), sequence_num_); |
72 } | 77 } |
OLD | NEW |