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

Side by Side Diff: remoting/client/plugin/pepper_view.cc

Issue 8985007: Refactoring of the client-side input pipeline and scaling dimension management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "ppapi/cpp/completion_callback.h" 9 #include "ppapi/cpp/completion_callback.h"
10 #include "ppapi/cpp/graphics_2d.h" 10 #include "ppapi/cpp/graphics_2d.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 << plugin_size.width() << " x " << plugin_size.height(); 283 << plugin_size.width() << " x " << plugin_size.height();
284 backing_store_.reset( 284 backing_store_.reset(
285 new pp::ImageData(instance_, pp::ImageData::GetNativeImageDataFormat(), 285 new pp::ImageData(instance_, pp::ImageData::GetNativeImageDataFormat(),
286 pp_size, false)); 286 pp_size, false));
287 DCHECK(backing_store_.get() && !backing_store_->is_null()) 287 DCHECK(backing_store_.get() && !backing_store_->is_null())
288 << "Not enough memory for backing store."; 288 << "Not enough memory for backing store.";
289 } 289 }
290 return true; 290 return true;
291 } 291 }
292 292
293 double PepperView::GetHorizontalScaleRatio() const { 293 SkISize PepperView::GetViewDimensions() const {
294 if (instance_->DoScaling()) { 294 return plugin_size_;
295 DCHECK(!host_size_.isEmpty());
296 return 1.0 * plugin_size_.width() / host_size_.width();
297 }
298 return 1.0;
299 } 295 }
300 296
301 double PepperView::GetVerticalScaleRatio() const { 297 SkISize PepperView::GetHostDimensions() const {
302 if (instance_->DoScaling()) { 298 return host_size_;
303 DCHECK(!host_size_.isEmpty());
304 return 1.0 * plugin_size_.height() / host_size_.height();
305 }
306 return 1.0;
307 } 299 }
308 300
309 void PepperView::AllocateFrame(media::VideoFrame::Format format, 301 void PepperView::AllocateFrame(media::VideoFrame::Format format,
310 const SkISize& size, 302 const SkISize& size,
311 scoped_refptr<media::VideoFrame>* frame_out, 303 scoped_refptr<media::VideoFrame>* frame_out,
312 const base::Closure& done) { 304 const base::Closure& done) {
313 DCHECK(context_->main_message_loop()->BelongsToCurrentThread()); 305 DCHECK(context_->main_message_loop()->BelongsToCurrentThread());
314 306
315 *frame_out = media::VideoFrame::CreateFrame( 307 *frame_out = media::VideoFrame::CreateFrame(
316 media::VideoFrame::RGB32, size.width(), size.height(), 308 media::VideoFrame::RGB32, size.width(), size.height(),
(...skipping 26 matching lines...) Expand all
343 (base::Time::Now() - paint_start).InMilliseconds()); 335 (base::Time::Now() - paint_start).InMilliseconds());
344 336
345 // If the last flush failed because there was already another one in progress 337 // If the last flush failed because there was already another one in progress
346 // then we perform the flush now. 338 // then we perform the flush now.
347 if (flush_blocked_) 339 if (flush_blocked_)
348 FlushGraphics(base::Time::Now()); 340 FlushGraphics(base::Time::Now());
349 return; 341 return;
350 } 342 }
351 343
352 } // namespace remoting 344 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698