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

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

Issue 10832428: Add a query function for the scaling feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test fixed Created 8 years, 4 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
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 view_scale_ = new_scale; 83 view_scale_ = new_scale;
84 view_size_dips_ = new_size_dips; 84 view_size_dips_ = new_size_dips;
85 view_size_ = SkISize::Make(ceilf(view_size_dips_.width() * view_scale_), 85 view_size_ = SkISize::Make(ceilf(view_size_dips_.width() * view_scale_),
86 ceilf(view_size_dips_.height() * view_scale_)); 86 ceilf(view_size_dips_.height() * view_scale_));
87 87
88 pp::Size pp_size = pp::Size(view_size_.width(), view_size_.height()); 88 pp::Size pp_size = pp::Size(view_size_.width(), view_size_.height());
89 graphics2d_ = pp::Graphics2D(instance_, pp_size, true); 89 graphics2d_ = pp::Graphics2D(instance_, pp_size, true);
90 90
91 // Ideally we would always let Graphics2D scale us, but the output quality 91 // Ideally we would always let Graphics2D scale us, but the output quality
92 // is lousy, so we don't. 92 // is lousy, so we don't.
93 pp::Graphics2DDev graphics2d_dev(graphics2d_); 93 pp::Graphics2D_Dev graphics2d_dev(graphics2d_);
94 graphics2d_dev.SetScale(1.0f / view_scale_); 94 graphics2d_dev.SetScale(1.0f / view_scale_);
95 95
96 bool result = instance_->BindGraphics(graphics2d_); 96 bool result = instance_->BindGraphics(graphics2d_);
97 97
98 // There is no good way to handle this error currently. 98 // There is no good way to handle this error currently.
99 DCHECK(result) << "Couldn't bind the device context."; 99 DCHECK(result) << "Couldn't bind the device context.";
100 } 100 }
101 101
102 pp::Rect pp_clip = view.GetClipRect(); 102 pp::Rect pp_clip = view.GetClipRect();
103 SkIRect new_clip = SkIRect::MakeLTRB(floorf(pp_clip.x() * view_scale_), 103 SkIRect new_clip = SkIRect::MakeLTRB(floorf(pp_clip.x() * view_scale_),
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 276
277 // If there is a buffer queued for rendering then render it now. 277 // If there is a buffer queued for rendering then render it now.
278 if (merge_buffer_ != NULL) { 278 if (merge_buffer_ != NULL) {
279 buffer = merge_buffer_; 279 buffer = merge_buffer_;
280 merge_buffer_ = NULL; 280 merge_buffer_ = NULL;
281 FlushBuffer(merge_clip_area_, buffer, merge_region_); 281 FlushBuffer(merge_clip_area_, buffer, merge_region_);
282 } 282 }
283 } 283 }
284 284
285 } // namespace remoting 285 } // namespace remoting
OLDNEW
« ppapi/cpp/dev/graphics_2d_dev.h ('K') | « ppapi/tests/test_graphics_2d.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698