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 "app/surface/transport_dib.h" | 5 #include "app/surface/transport_dib.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 // static | 53 // static |
54 TransportDIB* TransportDIB::CreateWithHandle(Handle handle) { | 54 TransportDIB* TransportDIB::CreateWithHandle(Handle handle) { |
55 return new TransportDIB(handle); | 55 return new TransportDIB(handle); |
56 } | 56 } |
57 | 57 |
58 // static | 58 // static |
59 bool TransportDIB::is_valid(Handle dib) { | 59 bool TransportDIB::is_valid(Handle dib) { |
60 return dib != NULL; | 60 return dib != NULL; |
61 } | 61 } |
62 | 62 |
63 // static | |
64 TransportDIB::Id TransportDIB::InvalidId() { | |
65 return Id(DefaultHandleValue(), 0); | |
brettw
2011/03/17 03:31:00
It seems like this should just use the default con
| |
66 } | |
67 | |
63 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { | 68 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { |
64 // This DIB already mapped the file into this process, but PlatformCanvas | 69 // This DIB already mapped the file into this process, but PlatformCanvas |
65 // will map it again. | 70 // will map it again. |
66 DCHECK(!memory()) << "Mapped file twice in the same process."; | 71 DCHECK(!memory()) << "Mapped file twice in the same process."; |
67 | 72 |
68 scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas); | 73 scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas); |
69 if (!canvas->initialize(w, h, true, handle())) | 74 if (!canvas->initialize(w, h, true, handle())) |
70 return NULL; | 75 return NULL; |
71 return canvas.release(); | 76 return canvas.release(); |
72 } | 77 } |
(...skipping 23 matching lines...) Expand all Loading... | |
96 return shared_memory_.memory(); | 101 return shared_memory_.memory(); |
97 } | 102 } |
98 | 103 |
99 TransportDIB::Handle TransportDIB::handle() const { | 104 TransportDIB::Handle TransportDIB::handle() const { |
100 return shared_memory_.handle(); | 105 return shared_memory_.handle(); |
101 } | 106 } |
102 | 107 |
103 TransportDIB::Id TransportDIB::id() const { | 108 TransportDIB::Id TransportDIB::id() const { |
104 return Id(handle(), sequence_num_); | 109 return Id(handle(), sequence_num_); |
105 } | 110 } |
OLD | NEW |