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

Side by Side Diff: cc/surfaces/surface_info.h

Issue 2848223003: Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: c Created 3 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CC_SURFACES_SURFACE_INFO_H_ 5 #ifndef CC_SURFACES_SURFACE_INFO_H_
6 #define CC_SURFACES_SURFACE_INFO_H_ 6 #define CC_SURFACES_SURFACE_INFO_H_
7 7
8 #include "cc/surfaces/surface_id.h" 8 #include "cc/surfaces/surface_id.h"
9 #include "ui/gfx/geometry/size.h" 9 #include "ui/gfx/geometry/size.h"
10 10
(...skipping 11 matching lines...) Expand all
22 class SurfaceInfo { 22 class SurfaceInfo {
23 public: 23 public:
24 SurfaceInfo() = default; 24 SurfaceInfo() = default;
25 SurfaceInfo(const SurfaceId& id, 25 SurfaceInfo(const SurfaceId& id,
26 float device_scale_factor, 26 float device_scale_factor,
27 const gfx::Size& size_in_pixels) 27 const gfx::Size& size_in_pixels)
28 : id_(id), 28 : id_(id),
29 device_scale_factor_(device_scale_factor), 29 device_scale_factor_(device_scale_factor),
30 size_in_pixels_(size_in_pixels) {} 30 size_in_pixels_(size_in_pixels) {}
31 31
32 bool is_valid() const { 32 bool is_valid() const { return id_.is_valid(); }
Fady Samuel 2017/05/08 20:21:19 Why?
Saman Sami 2017/05/08 20:40:32 I need to fix some tests that clash with the origi
33 return id_.is_valid() && device_scale_factor_ != 0 &&
34 !size_in_pixels_.IsEmpty();
35 }
36 33
37 bool operator==(const SurfaceInfo& info) const { 34 bool operator==(const SurfaceInfo& info) const {
38 return id_ == info.id() && 35 return id_ == info.id() &&
39 device_scale_factor_ == info.device_scale_factor() && 36 device_scale_factor_ == info.device_scale_factor() &&
40 size_in_pixels_ == info.size_in_pixels(); 37 size_in_pixels_ == info.size_in_pixels();
41 } 38 }
42 39
43 bool operator!=(const SurfaceInfo& info) const { return !(*this == info); } 40 bool operator!=(const SurfaceInfo& info) const { return !(*this == info); }
44 41
45 const SurfaceId& id() const { return id_; } 42 const SurfaceId& id() const { return id_; }
46 float device_scale_factor() const { return device_scale_factor_; } 43 float device_scale_factor() const { return device_scale_factor_; }
47 const gfx::Size& size_in_pixels() const { return size_in_pixels_; } 44 const gfx::Size& size_in_pixels() const { return size_in_pixels_; }
48 45
49 private: 46 private:
50 friend struct mojo::StructTraits<mojom::SurfaceInfoDataView, SurfaceInfo>; 47 friend struct mojo::StructTraits<mojom::SurfaceInfoDataView, SurfaceInfo>;
51 friend struct IPC::ParamTraits<SurfaceInfo>; 48 friend struct IPC::ParamTraits<SurfaceInfo>;
52 49
53 SurfaceId id_; 50 SurfaceId id_;
54 float device_scale_factor_ = 1.f; 51 float device_scale_factor_ = 1.f;
55 gfx::Size size_in_pixels_; 52 gfx::Size size_in_pixels_;
56 }; 53 };
57 54
58 } // namespace cc 55 } // namespace cc
59 56
60 #endif // CC_SURFACES_SURFACE_INFO_H_ 57 #endif // CC_SURFACES_SURFACE_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698