OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "remoting/client/x11_view.h" | 5 #include "remoting/client/x11_view.h" |
6 | 6 |
7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 #include <X11/Xutil.h> | 8 #include <X11/Xutil.h> |
9 #include <X11/extensions/Xrender.h> | 9 #include <X11/extensions/Xrender.h> |
10 #include <X11/extensions/Xcomposite.h> | 10 #include <X11/extensions/Xcomposite.h> |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "remoting/base/decoder_verbatim.h" | 13 #include "remoting/base/decoder_verbatim.h" |
| 14 #include "remoting/base/decoder_zlib.h" |
14 | 15 |
15 namespace remoting { | 16 namespace remoting { |
16 | 17 |
17 X11View::X11View() | 18 X11View::X11View() |
18 : display_(NULL), | 19 : display_(NULL), |
19 window_(0), | 20 window_(0), |
20 width_(0), | 21 width_(0), |
21 height_(0), | 22 height_(0), |
22 picture_(0) { | 23 picture_(0) { |
23 } | 24 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 picture_ = XRenderCreatePicture(display_, window_, pictformat, 0, NULL); | 168 picture_ = XRenderCreatePicture(display_, window_, pictformat, 0, NULL); |
168 CHECK(picture_) << "Backing picture not created"; | 169 CHECK(picture_) << "Backing picture not created"; |
169 } | 170 } |
170 | 171 |
171 void X11View::HandleBeginUpdateStream(HostMessage* msg) { | 172 void X11View::HandleBeginUpdateStream(HostMessage* msg) { |
172 scoped_ptr<HostMessage> deleter(msg); | 173 scoped_ptr<HostMessage> deleter(msg); |
173 | 174 |
174 // TODO(hclam): Use the information from the message to create the decoder. | 175 // TODO(hclam): Use the information from the message to create the decoder. |
175 // We lazily construct the decoder. | 176 // We lazily construct the decoder. |
176 if (!decoder_.get()) { | 177 if (!decoder_.get()) { |
177 decoder_.reset(new DecoderVerbatim()); | 178 decoder_.reset(new DecoderZlib()); |
178 } | 179 } |
179 | 180 |
180 // Tell the decoder to do start decoding. | 181 // Tell the decoder to do start decoding. |
181 decoder_->BeginDecode(frame_, &update_rects_, | 182 decoder_->BeginDecode(frame_, &update_rects_, |
182 NewRunnableMethod(this, &X11View::OnPartialDecodeDone), | 183 NewRunnableMethod(this, &X11View::OnPartialDecodeDone), |
183 NewRunnableMethod(this, &X11View::OnDecodeDone)); | 184 NewRunnableMethod(this, &X11View::OnDecodeDone)); |
184 } | 185 } |
185 | 186 |
186 void X11View::HandleUpdateStreamPacket(HostMessage* msg) { | 187 void X11View::HandleUpdateStreamPacket(HostMessage* msg) { |
187 decoder_->PartialDecode(msg); | 188 decoder_->PartialDecode(msg); |
(...skipping 25 matching lines...) Expand all Loading... |
213 XEvent event; | 214 XEvent event; |
214 event.type = Expose; | 215 event.type = Expose; |
215 XSendEvent(display_, static_cast<int>(window_), true, ExposureMask, &event); | 216 XSendEvent(display_, static_cast<int>(window_), true, ExposureMask, &event); |
216 } | 217 } |
217 | 218 |
218 void X11View::OnDecodeDone() { | 219 void X11View::OnDecodeDone() { |
219 // Since we do synchronous decoding here there's nothing in this method. | 220 // Since we do synchronous decoding here there's nothing in this method. |
220 } | 221 } |
221 | 222 |
222 } // namespace remoting | 223 } // namespace remoting |
OLD | NEW |