Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: chrome/common/transport_dib_linux.cc

Issue 118420: Adds kind-of-live thumbnail generation for a potential tab switcher. This... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/transport_dib.h ('k') | chrome/common/transport_dib_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <errno.h> 5 #include <errno.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <sys/ipc.h> 7 #include <sys/ipc.h>
8 #include <sys/shm.h> 8 #include <sys/shm.h>
9 9
10 #include "base/gfx/size.h" 10 #include "base/gfx/size.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return NULL; 73 return NULL;
74 74
75 TransportDIB* dib = new TransportDIB; 75 TransportDIB* dib = new TransportDIB;
76 76
77 dib->address_ = address; 77 dib->address_ = address;
78 dib->size_ = shmst.shm_segsz; 78 dib->size_ = shmst.shm_segsz;
79 dib->key_ = shmkey; 79 dib->key_ = shmkey;
80 return dib; 80 return dib;
81 } 81 }
82 82
83 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) {
84 return new skia::PlatformCanvas(w, h, true,
85 reinterpret_cast<uint8_t*>(memory()));
86 }
87
83 void* TransportDIB::memory() const { 88 void* TransportDIB::memory() const {
84 DCHECK_NE(address_, kInvalidAddress); 89 DCHECK_NE(address_, kInvalidAddress);
85 return address_; 90 return address_;
86 } 91 }
87 92
88 TransportDIB::Id TransportDIB::id() const { 93 TransportDIB::Id TransportDIB::id() const {
89 return key_; 94 return key_;
90 } 95 }
91 96
92 TransportDIB::Handle TransportDIB::handle() const { 97 TransportDIB::Handle TransportDIB::handle() const {
93 return key_; 98 return key_;
94 } 99 }
95 100
96 XID TransportDIB::MapToX(Display* display) { 101 XID TransportDIB::MapToX(Display* display) {
97 if (!x_shm_) { 102 if (!x_shm_) {
98 x_shm_ = x11_util::AttachSharedMemory(display, key_); 103 x_shm_ = x11_util::AttachSharedMemory(display, key_);
99 display_ = display; 104 display_ = display;
100 } 105 }
101 106
102 return x_shm_; 107 return x_shm_;
103 } 108 }
OLDNEW
« no previous file with comments | « chrome/common/transport_dib.h ('k') | chrome/common/transport_dib_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698