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: ppapi/shared_impl/ppb_view_shared.cc

Issue 174213003: PPAPI: Use clang-format on ppapi/shared_impl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: remove DEPS Created 6 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
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 { 7 namespace {
8 8
9 bool IsRectNonempty(const PP_Rect& rect) { 9 bool IsRectNonempty(const PP_Rect& rect) {
10 return rect.size.width > 0 && rect.size.height > 0; 10 return rect.size.width > 0 && rect.size.height > 0;
11 } 11 }
12 12
13 } // namespace 13 } // namespace
14 14
15 namespace ppapi { 15 namespace ppapi {
16 16
17 ViewData::ViewData() { 17 ViewData::ViewData() {
18 // Assume POD. 18 // Assume POD.
19 memset(this, 0, sizeof(ViewData)); 19 memset(this, 0, sizeof(ViewData));
20 20
21 device_scale = 1.0f; 21 device_scale = 1.0f;
22 css_scale = 1.0f; 22 css_scale = 1.0f;
23 } 23 }
24 24
25 ViewData::~ViewData() { 25 ViewData::~ViewData() {}
26 }
27 26
28 bool ViewData::Equals(const ViewData& other) const { 27 bool ViewData::Equals(const ViewData& other) const {
29 return rect.point.x == other.rect.point.x && 28 return rect.point.x == other.rect.point.x &&
30 rect.point.y == other.rect.point.y && 29 rect.point.y == other.rect.point.y &&
31 rect.size.width == other.rect.size.width && 30 rect.size.width == other.rect.size.width &&
32 rect.size.height == other.rect.size.height && 31 rect.size.height == other.rect.size.height &&
33 is_fullscreen == other.is_fullscreen && 32 is_fullscreen == other.is_fullscreen &&
34 is_page_visible == other.is_page_visible && 33 is_page_visible == other.is_page_visible &&
35 clip_rect.point.x == other.clip_rect.point.x && 34 clip_rect.point.x == other.clip_rect.point.x &&
36 clip_rect.point.y == other.clip_rect.point.y && 35 clip_rect.point.y == other.clip_rect.point.y &&
37 clip_rect.size.width == other.clip_rect.size.width && 36 clip_rect.size.width == other.clip_rect.size.width &&
38 clip_rect.size.height == other.clip_rect.size.height && 37 clip_rect.size.height == other.clip_rect.size.height &&
39 device_scale == other.device_scale && 38 device_scale == other.device_scale && css_scale == other.css_scale;
40 css_scale == other.css_scale;
41 } 39 }
42 40
43 PPB_View_Shared::PPB_View_Shared(ResourceObjectType type, 41 PPB_View_Shared::PPB_View_Shared(ResourceObjectType type,
44 PP_Instance instance, 42 PP_Instance instance,
45 const ViewData& data) 43 const ViewData& data)
46 : Resource(type, instance), 44 : Resource(type, instance), data_(data) {}
47 data_(data) {
48 }
49 45
50 PPB_View_Shared::~PPB_View_Shared() { 46 PPB_View_Shared::~PPB_View_Shared() {}
51 }
52 47
53 thunk::PPB_View_API* PPB_View_Shared::AsPPB_View_API() { 48 thunk::PPB_View_API* PPB_View_Shared::AsPPB_View_API() { return this; }
54 return this;
55 }
56 49
57 const ViewData& PPB_View_Shared::GetData() const { 50 const ViewData& PPB_View_Shared::GetData() const { return data_; }
58 return data_;
59 }
60 51
61 PP_Bool PPB_View_Shared::GetRect(PP_Rect* viewport) const { 52 PP_Bool PPB_View_Shared::GetRect(PP_Rect* viewport) const {
62 if (!viewport) 53 if (!viewport)
63 return PP_FALSE; 54 return PP_FALSE;
64 *viewport = data_.rect; 55 *viewport = data_.rect;
65 return PP_TRUE; 56 return PP_TRUE;
66 } 57 }
67 58
68 PP_Bool PPB_View_Shared::IsFullscreen() const { 59 PP_Bool PPB_View_Shared::IsFullscreen() const {
69 return PP_FromBool(data_.is_fullscreen); 60 return PP_FromBool(data_.is_fullscreen);
70 } 61 }
71 62
72 PP_Bool PPB_View_Shared::IsVisible() const { 63 PP_Bool PPB_View_Shared::IsVisible() const {
73 return PP_FromBool(data_.is_page_visible && IsRectNonempty(data_.clip_rect)); 64 return PP_FromBool(data_.is_page_visible && IsRectNonempty(data_.clip_rect));
74 } 65 }
75 66
76 PP_Bool PPB_View_Shared::IsPageVisible() const { 67 PP_Bool PPB_View_Shared::IsPageVisible() const {
77 return PP_FromBool(data_.is_page_visible); 68 return PP_FromBool(data_.is_page_visible);
78 } 69 }
79 70
80 PP_Bool PPB_View_Shared::GetClipRect(PP_Rect* clip) const { 71 PP_Bool PPB_View_Shared::GetClipRect(PP_Rect* clip) const {
81 if (!clip) 72 if (!clip)
82 return PP_FALSE; 73 return PP_FALSE;
83 *clip = data_.clip_rect; 74 *clip = data_.clip_rect;
84 return PP_TRUE; 75 return PP_TRUE;
85 } 76 }
86 77
87 float PPB_View_Shared::GetDeviceScale() const { 78 float PPB_View_Shared::GetDeviceScale() const { return data_.device_scale; }
88 return data_.device_scale;
89 }
90 79
91 float PPB_View_Shared::GetCSSScale() const { 80 float PPB_View_Shared::GetCSSScale() const { return data_.css_scale; }
92 return data_.css_scale;
93 }
94 81
95 } // namespace ppapi 82 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppb_view_shared.h ('k') | ppapi/shared_impl/ppp_flash_browser_operations_shared.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698