Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/plugin/pepper_view.h" | 5 #include "remoting/client/plugin/pepper_view.h" |
| 6 | 6 |
| 7 #include <functional> | 7 #include <functional> |
| 8 | 8 |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 | 121 |
| 122 case protocol::ConnectionToHost::FAILED: | 122 case protocol::ConnectionToHost::FAILED: |
| 123 instance_->SetConnectionState( | 123 instance_->SetConnectionState( |
| 124 ChromotingInstance::STATE_FAILED, | 124 ChromotingInstance::STATE_FAILED, |
| 125 ConvertConnectionError(error)); | 125 ConvertConnectionError(error)); |
| 126 break; | 126 break; |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 | 129 |
| 130 void PepperView::SetView(const SkISize& view_size, | 130 void PepperView::SetView(const SkISize& view_size, |
| 131 const SkIRect& clip_area) { | 131 const SkIRect& clip_area) { |
|
alexeypa (please no reviews)
2012/03/02 19:59:04
nit: I know you didn't write this but... :-) this
Wez
2012/03/02 22:15:31
Done.
| |
| 132 bool view_changed = false; | 132 bool view_changed = false; |
| 133 | 133 |
| 134 // TODO(alexeypa): Prevent upscaling because the YUV-to-RGB conversion code | 134 if (view_size_ != view_size) { |
| 135 // currently does not support upscaling. Once it does, this code be removed. | |
| 136 SkISize size = SkISize::Make( | |
| 137 std::min(view_size.width(), source_size_.width()), | |
| 138 std::min(view_size.height(), source_size_.height())); | |
| 139 | |
| 140 if (view_size_ != size) { | |
| 141 view_changed = true; | 135 view_changed = true; |
| 142 view_size_ = size; | 136 view_size_ = view_size; |
| 143 | 137 |
| 144 pp::Size pp_size = pp::Size(view_size_.width(), view_size_.height()); | 138 pp::Size pp_size = pp::Size(view_size_.width(), view_size_.height()); |
| 145 graphics2d_ = pp::Graphics2D(instance_, pp_size, true); | 139 graphics2d_ = pp::Graphics2D(instance_, pp_size, true); |
| 146 bool result = instance_->BindGraphics(graphics2d_); | 140 bool result = instance_->BindGraphics(graphics2d_); |
| 147 | 141 |
| 148 // There is no good way to handle this error currently. | 142 // There is no good way to handle this error currently. |
| 149 DCHECK(result) << "Couldn't bind the device context."; | 143 DCHECK(result) << "Couldn't bind the device context."; |
| 150 } | 144 } |
| 151 | 145 |
| 152 if (clip_area_ != clip_area) { | 146 if (clip_area_ != clip_area) { |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 355 // Resume painting for the buffer that was previoulsy postponed because of | 349 // Resume painting for the buffer that was previoulsy postponed because of |
| 356 // pending flush. | 350 // pending flush. |
| 357 if (merge_buffer_ != NULL) { | 351 if (merge_buffer_ != NULL) { |
| 358 buffer = merge_buffer_; | 352 buffer = merge_buffer_; |
| 359 merge_buffer_ = NULL; | 353 merge_buffer_ = NULL; |
| 360 FlushBuffer(merge_clip_area_, buffer, merge_region_); | 354 FlushBuffer(merge_clip_area_, buffer, merge_region_); |
| 361 } | 355 } |
| 362 } | 356 } |
| 363 | 357 |
| 364 } // namespace remoting | 358 } // namespace remoting |
| OLD | NEW |