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

Side by Side Diff: ppapi/shared_impl/ppb_view_shared.cc

Issue 12220082: IDL: Autogenerate thunk .cc file for PPB_View (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 10 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
« no previous file with comments | « ppapi/shared_impl/ppb_view_shared.h ('k') | ppapi/thunk/ppb_view_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ppapi/shared_impl/ppb_view_shared.h" 5 #include "ppapi/shared_impl/ppb_view_shared.h"
6 6
7 namespace {
8
9 bool IsRectNonempty(const PP_Rect& rect) {
10 return rect.size.width > 0 && rect.size.height > 0;
11 }
12
13 } // namespace
14
7 namespace ppapi { 15 namespace ppapi {
8 16
9 ViewData::ViewData() { 17 ViewData::ViewData() {
10 // Assume POD. 18 // Assume POD.
11 memset(this, 0, sizeof(ViewData)); 19 memset(this, 0, sizeof(ViewData));
12 20
13 device_scale = 1.0f; 21 device_scale = 1.0f;
14 css_scale = 1.0f; 22 css_scale = 1.0f;
15 } 23 }
16 24
(...skipping 26 matching lines...) Expand all
43 } 51 }
44 52
45 thunk::PPB_View_API* PPB_View_Shared::AsPPB_View_API() { 53 thunk::PPB_View_API* PPB_View_Shared::AsPPB_View_API() {
46 return this; 54 return this;
47 } 55 }
48 56
49 const ViewData& PPB_View_Shared::GetData() const { 57 const ViewData& PPB_View_Shared::GetData() const {
50 return data_; 58 return data_;
51 } 59 }
52 60
61 PP_Bool PPB_View_Shared::GetRect(PP_Rect* viewport) const {
62 if (!viewport)
63 return PP_FALSE;
64 *viewport = data_.rect;
65 return PP_TRUE;
66 }
67
68 PP_Bool PPB_View_Shared::IsFullscreen() const {
69 return PP_FromBool(data_.is_fullscreen);
70 }
71
72 PP_Bool PPB_View_Shared::IsVisible() const {
73 return PP_FromBool(data_.is_page_visible && IsRectNonempty(data_.clip_rect));
74 }
75
76 PP_Bool PPB_View_Shared::IsPageVisible() const {
77 return PP_FromBool(data_.is_page_visible);
78 }
79
80 PP_Bool PPB_View_Shared::GetClipRect(PP_Rect* clip) const {
81 if (!clip)
82 return PP_FALSE;
83 *clip = data_.clip_rect;
84 return PP_TRUE;
85 }
86
87 float PPB_View_Shared::GetDeviceScale() const {
88 return data_.device_scale;
89 }
90
91 float PPB_View_Shared::GetCSSScale() const {
92 return data_.css_scale;
93 }
94
53 } // namespace ppapi 95 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppb_view_shared.h ('k') | ppapi/thunk/ppb_view_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698