OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/surface/transport_dib.h" | 5 #include "ui/gfx/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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 bool TransportDIB::is_valid_id(TransportDIB::Id id) { | 64 bool TransportDIB::is_valid_id(TransportDIB::Id id) { |
65 return is_valid_handle(id.handle); | 65 return is_valid_handle(id.handle); |
66 } | 66 } |
67 | 67 |
68 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { | 68 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { |
69 // This DIB already mapped the file into this process, but PlatformCanvas | 69 // This DIB already mapped the file into this process, but PlatformCanvas |
70 // will map it again. | 70 // will map it again. |
71 DCHECK(!memory()) << "Mapped file twice in the same process."; | 71 DCHECK(!memory()) << "Mapped file twice in the same process."; |
72 | 72 |
73 scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas); | 73 scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas); |
74 if (!canvas->initialize(w, h, true, handle())) | 74 if (!canvas->initialize( |
| 75 w, h, |
| 76 skia::PlatformDevice::FLAGS_OPAQUE | |
| 77 skia::PlatformDevice::FLAGS_INITIALIZED, |
| 78 handle())) |
75 return NULL; | 79 return NULL; |
76 return canvas.release(); | 80 return canvas.release(); |
77 } | 81 } |
78 | 82 |
79 bool TransportDIB::Map() { | 83 bool TransportDIB::Map() { |
80 if (!is_valid_handle(handle())) | 84 if (!is_valid_handle(handle())) |
81 return false; | 85 return false; |
82 if (memory()) | 86 if (memory()) |
83 return true; | 87 return true; |
84 | 88 |
(...skipping 16 matching lines...) Expand all Loading... |
101 return shared_memory_.memory(); | 105 return shared_memory_.memory(); |
102 } | 106 } |
103 | 107 |
104 TransportDIB::Handle TransportDIB::handle() const { | 108 TransportDIB::Handle TransportDIB::handle() const { |
105 return shared_memory_.handle(); | 109 return shared_memory_.handle(); |
106 } | 110 } |
107 | 111 |
108 TransportDIB::Id TransportDIB::id() const { | 112 TransportDIB::Id TransportDIB::id() const { |
109 return Id(handle(), sequence_num_); | 113 return Id(handle(), sequence_num_); |
110 } | 114 } |
OLD | NEW |