| 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 <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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 return NULL; | 44 return NULL; |
| 45 return dib.release(); | 45 return dib.release(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 // static | 48 // static |
| 49 TransportDIB* TransportDIB::CreateWithHandle(Handle handle) { | 49 TransportDIB* TransportDIB::CreateWithHandle(Handle handle) { |
| 50 return new TransportDIB(handle); | 50 return new TransportDIB(handle); |
| 51 } | 51 } |
| 52 | 52 |
| 53 // static | 53 // static |
| 54 TransportDIB::Id TransportDIB::InvalidId() { |
| 55 return -1; |
| 56 } |
| 57 |
| 58 // static |
| 54 bool TransportDIB::is_valid(Handle dib) { | 59 bool TransportDIB::is_valid(Handle dib) { |
| 55 return dib.fd >= 0; | 60 return dib.fd >= 0; |
| 56 } | 61 } |
| 57 | 62 |
| 58 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { | 63 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { |
| 59 if (!memory() && !Map()) | 64 if (!memory() && !Map()) |
| 60 return NULL; | 65 return NULL; |
| 61 scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas); | 66 scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas); |
| 62 if (!canvas->initialize(w, h, true, reinterpret_cast<uint8_t*>(memory()))) | 67 if (!canvas->initialize(w, h, true, reinterpret_cast<uint8_t*>(memory()))) |
| 63 return NULL; | 68 return NULL; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 84 return shared_memory_.memory(); | 89 return shared_memory_.memory(); |
| 85 } | 90 } |
| 86 | 91 |
| 87 TransportDIB::Id TransportDIB::id() const { | 92 TransportDIB::Id TransportDIB::id() const { |
| 88 return shared_memory_.id(); | 93 return shared_memory_.id(); |
| 89 } | 94 } |
| 90 | 95 |
| 91 TransportDIB::Handle TransportDIB::handle() const { | 96 TransportDIB::Handle TransportDIB::handle() const { |
| 92 return shared_memory_.handle(); | 97 return shared_memory_.handle(); |
| 93 } | 98 } |
| OLD | NEW |