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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 break; | 120 break; |
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, const SkIRect& clip_area) { |
131 const SkIRect& clip_area) { | |
132 bool view_changed = false; | 131 bool view_changed = false; |
133 | 132 |
134 // TODO(alexeypa): Prevent upscaling because the YUV-to-RGB conversion code | 133 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; | 134 view_changed = true; |
142 view_size_ = size; | 135 view_size_ = view_size; |
143 | 136 |
144 pp::Size pp_size = pp::Size(view_size_.width(), view_size_.height()); | 137 pp::Size pp_size = pp::Size(view_size_.width(), view_size_.height()); |
145 graphics2d_ = pp::Graphics2D(instance_, pp_size, true); | 138 graphics2d_ = pp::Graphics2D(instance_, pp_size, true); |
146 bool result = instance_->BindGraphics(graphics2d_); | 139 bool result = instance_->BindGraphics(graphics2d_); |
147 | 140 |
148 // There is no good way to handle this error currently. | 141 // There is no good way to handle this error currently. |
149 DCHECK(result) << "Couldn't bind the device context."; | 142 DCHECK(result) << "Couldn't bind the device context."; |
150 } | 143 } |
151 | 144 |
152 if (clip_area_ != clip_area) { | 145 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 | 348 // Resume painting for the buffer that was previoulsy postponed because of |
356 // pending flush. | 349 // pending flush. |
357 if (merge_buffer_ != NULL) { | 350 if (merge_buffer_ != NULL) { |
358 buffer = merge_buffer_; | 351 buffer = merge_buffer_; |
359 merge_buffer_ = NULL; | 352 merge_buffer_ = NULL; |
360 FlushBuffer(merge_clip_area_, buffer, merge_region_); | 353 FlushBuffer(merge_clip_area_, buffer, merge_region_); |
361 } | 354 } |
362 } | 355 } |
363 | 356 |
364 } // namespace remoting | 357 } // namespace remoting |
OLD | NEW |