Commit d27d15e5 authored by kylechar's avatar kylechar Committed by Commit Bot

Apply clang-tidy fixes to graphics code

Run clang-tidy with analyzers enabled for Chromium and apply the
automated fixes to Chrome graphics code. Also fix linter errors that
were failing presubmit on upload in the same files.

Bug: none
Change-Id: I41a020c7eae44f40a08b2018cf8e49c3be9c710c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2563920Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Commit-Queue: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#831867}
parent 9c9b4b99
......@@ -12,7 +12,7 @@ namespace cc {
// TODO(khushalsagar): Find a better name?
struct CC_PAINT_EXPORT FrameMetadata {
FrameMetadata() {}
FrameMetadata() = default;
FrameMetadata(bool complete, base::TimeDelta duration)
: complete(complete), duration(duration) {}
......
......@@ -5,6 +5,8 @@
#ifndef CC_PAINT_IMAGE_PROVIDER_H_
#define CC_PAINT_IMAGE_PROVIDER_H_
#include <vector>
#include "base/callback.h"
#include "base/optional.h"
#include "cc/paint/decoded_draw_image.h"
......@@ -12,8 +14,6 @@
#include "cc/paint/paint_export.h"
#include "cc/paint/paint_op_buffer.h"
#include <vector>
namespace cc {
class PaintImage;
......@@ -36,7 +36,7 @@ class CC_PAINT_EXPORT ImageProvider {
ScopedResult& operator=(const ScopedResult&) = delete;
ScopedResult& operator=(ScopedResult&& other);
operator bool() const { return image_ || record_; }
explicit operator bool() const { return image_ || record_; }
const DecodedDrawImage& decoded_image() const { return image_; }
bool needs_unlock() const { return !destruction_callback_.is_null(); }
const PaintRecord* paint_record() {
......@@ -52,7 +52,7 @@ class CC_PAINT_EXPORT ImageProvider {
DestructionCallback destruction_callback_;
};
virtual ~ImageProvider() {}
virtual ~ImageProvider() = default;
// Returns either:
// 1. The DecodedDrawImage to use for this PaintImage. If no image is
......
......@@ -7,6 +7,8 @@
#include <cstdint>
#include <memory>
#include "cc/paint/paint_export.h"
#include "cc/paint/transfer_cache_entry.h"
......@@ -18,7 +20,7 @@ namespace cc {
// we need to figure out layering. crbug.com/777622
class CC_PAINT_EXPORT TransferCacheDeserializeHelper {
public:
virtual ~TransferCacheDeserializeHelper() {}
virtual ~TransferCacheDeserializeHelper() = default;
// Type safe access to an entry in the transfer cache. Returns null if the
// entry is missing or of the wrong type.
......
......@@ -32,7 +32,7 @@ enum class TransferCacheEntryType : uint32_t {
// into raw bytes that can be sent to the service.
class CC_PAINT_EXPORT ClientTransferCacheEntry {
public:
virtual ~ClientTransferCacheEntry() {}
virtual ~ClientTransferCacheEntry() = default;
// Returns the type of this entry. Combined with id, it should form a unique
// identifier.
......@@ -73,7 +73,7 @@ class CC_PAINT_EXPORT ServiceTransferCacheEntry {
// Returns true if the entry needs a GrContext during deserialization.
static bool UsesGrContext(TransferCacheEntryType type);
virtual ~ServiceTransferCacheEntry() {}
virtual ~ServiceTransferCacheEntry() = default;
// Returns the type of this entry.
virtual TransferCacheEntryType Type() const = 0;
......
......@@ -8,6 +8,7 @@
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <string>
#include "base/check.h"
......@@ -33,7 +34,7 @@ namespace viz {
// objects.
class VIZ_COMMON_EXPORT BeginFrameObserver {
public:
virtual ~BeginFrameObserver() {}
virtual ~BeginFrameObserver() = default;
// The |args| given to OnBeginFrame is guaranteed to have
// |args|.IsValid()==true. If |args|.frame_id.source_id did not change
......
......@@ -27,7 +27,7 @@ class VIZ_COMMON_EXPORT DelayBasedTimeSourceClient {
virtual void OnTimerTick() = 0;
protected:
virtual ~DelayBasedTimeSourceClient() {}
virtual ~DelayBasedTimeSourceClient() = default;
};
// This timer implements a time source that achieves the specified interval
......
......@@ -13,7 +13,7 @@ class ContextLostObserver {
virtual void OnContextLost() = 0;
protected:
virtual ~ContextLostObserver() {}
virtual ~ContextLostObserver() = default;
};
} // namespace viz
......
......@@ -23,7 +23,7 @@ struct VIZ_COMMON_EXPORT ReturnedResource {
bool lost)
: id(id), sync_token(sync_token), count(count), lost(lost) {}
ReturnedResource() {}
ReturnedResource() = default;
bool operator==(const ReturnedResource& other) const {
return id == other.id && sync_token == other.sync_token &&
......
......@@ -4,6 +4,8 @@
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
// ParentLocalSurfaceIdAllocator has 2 accessors which do not alter state:
......@@ -21,7 +23,7 @@ class ParentLocalSurfaceIdAllocatorTest : public testing::Test {
public:
ParentLocalSurfaceIdAllocatorTest() = default;
~ParentLocalSurfaceIdAllocatorTest() override {}
~ParentLocalSurfaceIdAllocatorTest() override = default;
ParentLocalSurfaceIdAllocator& allocator() { return *allocator_.get(); }
......
......@@ -4,7 +4,9 @@
#include <stddef.h>
#include <algorithm>
#include <limits>
#include <utility>
#include <vector>
#include "base/logging.h"
......@@ -121,10 +123,10 @@ TEST(DrawPolygonConstructionTest, NormalNormal) {
// More complicated shapes.
TEST(DrawPolygonConstructionTest, TestNormal) {
std::vector<gfx::Point3F> vertices;
vertices.push_back(gfx::Point3F(0.0f, 10.0f, 0.0f));
vertices.push_back(gfx::Point3F(0.0f, 0.0f, 0.0f));
vertices.push_back(gfx::Point3F(10.0f, 0.0f, 0.0f));
vertices.push_back(gfx::Point3F(10.0f, 10.0f, 0.0f));
vertices.emplace_back(0.0f, 10.0f, 0.0f);
vertices.emplace_back(0.0f, 0.0f, 0.0f);
vertices.emplace_back(10.0f, 0.0f, 0.0f);
vertices.emplace_back(10.0f, 10.0f, 0.0f);
CREATE_TEST_DRAW_FORWARD_POLYGON(polygon, vertices, 1);
EXPECT_NORMAL(polygon, 0.0f, 0.0f, 1.0f);
......@@ -132,12 +134,12 @@ TEST(DrawPolygonConstructionTest, TestNormal) {
TEST(DrawPolygonConstructionTest, ClippedNormal) {
std::vector<gfx::Point3F> vertices;
vertices.push_back(gfx::Point3F(0.1f, 10.0f, 0.0f));
vertices.push_back(gfx::Point3F(0.0f, 9.9f, 0.0f));
vertices.push_back(gfx::Point3F(0.0f, 10.0f, 0.0f));
vertices.push_back(gfx::Point3F(0.0f, 0.0f, 0.0f));
vertices.push_back(gfx::Point3F(10.0f, 0.0f, 0.0f));
vertices.push_back(gfx::Point3F(10.0f, 10.0f, 0.0f));
vertices.emplace_back(0.1f, 10.0f, 0.0f);
vertices.emplace_back(0.0f, 9.9f, 0.0f);
vertices.emplace_back(0.0f, 10.0f, 0.0f);
vertices.emplace_back(0.0f, 0.0f, 0.0f);
vertices.emplace_back(10.0f, 0.0f, 0.0f);
vertices.emplace_back(10.0f, 10.0f, 0.0f);
CREATE_TEST_DRAW_FORWARD_POLYGON(polygon, vertices, 1);
EXPECT_NORMAL(polygon, 0.0f, 0.0f, 1.0f);
......@@ -145,9 +147,9 @@ TEST(DrawPolygonConstructionTest, ClippedNormal) {
TEST(DrawPolygonConstructionTest, SlimTriangleNormal) {
std::vector<gfx::Point3F> vertices;
vertices.push_back(gfx::Point3F(0.0f, 0.0f, 0.0f));
vertices.push_back(gfx::Point3F(5000.0f, 0.0f, 0.0f));
vertices.push_back(gfx::Point3F(10000.0f, 1.0f, 0.0f));
vertices.emplace_back(0.0f, 0.0f, 0.0f);
vertices.emplace_back(5000.0f, 0.0f, 0.0f);
vertices.emplace_back(10000.0f, 1.0f, 0.0f);
CREATE_TEST_DRAW_FORWARD_POLYGON(polygon, vertices, 2);
EXPECT_NORMAL(polygon, 0.0f, 0.0f, 1.0f);
......@@ -158,9 +160,8 @@ TEST(DrawPolygonConstructionTest, ManyVertexNormal) {
std::vector<gfx::Point3F> vertices_d;
for (int i = 0; i < 100; i++) {
const double step = i * base::kPiDouble / 50;
vertices_c.push_back(gfx::Point3F(cos(step), sin(step), 0.0f));
vertices_d.push_back(
gfx::Point3F(cos(step) + 99.0f, sin(step) + 99.0f, 100.0f));
vertices_c.emplace_back(cos(step), sin(step), 0.0f);
vertices_d.emplace_back(cos(step) + 99.0f, sin(step) + 99.0f, 100.0f);
}
CREATE_TEST_DRAW_FORWARD_POLYGON(polygon_c, vertices_c, 3);
EXPECT_NORMAL(polygon_c, 0.0f, 0.0f, 1.0f);
......@@ -246,15 +247,15 @@ TEST(DrawPolygonConstructionTest, InvertZNormal) {
// compare in front.
TEST(DrawPolygonSplitTest, NearlyTouchingOrder) {
std::vector<gfx::Point3F> vertices_a;
vertices_a.push_back(gfx::Point3F(0.0f, 10.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(0.0f, 0.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(10.0f, 0.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(10.0f, 10.0f, 0.0f));
vertices_a.emplace_back(0.0f, 10.0f, 0.0f);
vertices_a.emplace_back(0.0f, 0.0f, 0.0f);
vertices_a.emplace_back(10.0f, 0.0f, 0.0f);
vertices_a.emplace_back(10.0f, 10.0f, 0.0f);
std::vector<gfx::Point3F> vertices_b;
vertices_b.push_back(gfx::Point3F(0.0f, 10.0f, -1.0f));
vertices_b.push_back(gfx::Point3F(0.0f, 0.0f, -1.0f));
vertices_b.push_back(gfx::Point3F(10.0f, 0.0f, -1.0f));
vertices_b.push_back(gfx::Point3F(10.0f, 10.0f, -1.0f));
vertices_b.emplace_back(0.0f, 10.0f, -1.0f);
vertices_b.emplace_back(0.0f, 0.0f, -1.0f);
vertices_b.emplace_back(10.0f, 0.0f, -1.0f);
vertices_b.emplace_back(10.0f, 10.0f, -1.0f);
gfx::Vector3dF normal(0.0f, 0.0f, 1.0f);
CREATE_NEW_DRAW_POLYGON(polygon_a, vertices_a, normal, 0);
......@@ -272,19 +273,19 @@ TEST(DrawPolygonSplitTest, NearlyTouchingOrder) {
// Two quads are definitely not touching and so no split should occur.
TEST(DrawPolygonSplitTest, NotClearlyInFront) {
std::vector<gfx::Point3F> vertices_a;
vertices_a.push_back(gfx::Point3F(87.2f, 1185.0f, 0.9f));
vertices_a.push_back(gfx::Point3F(288.3f, 1185.0f, -0.7f));
vertices_a.push_back(gfx::Point3F(288.3f, 1196.0f, -0.7f));
vertices_a.push_back(gfx::Point3F(87.2f, 1196.0f, 0.9f));
vertices_a.emplace_back(87.2f, 1185.0f, 0.9f);
vertices_a.emplace_back(288.3f, 1185.0f, -0.7f);
vertices_a.emplace_back(288.3f, 1196.0f, -0.7f);
vertices_a.emplace_back(87.2f, 1196.0f, 0.9f);
gfx::Vector3dF normal_a = gfx::CrossProduct(vertices_a[1] - vertices_a[0],
vertices_a[1] - vertices_a[2]);
normal_a.Scale(1.0f / normal_a.Length());
std::vector<gfx::Point3F> vertices_b;
vertices_b.push_back(gfx::Point3F(62.1f, 1034.7f, 1.0f));
vertices_b.push_back(gfx::Point3F(313.4f, 1035.3f, -1.0f));
vertices_b.push_back(gfx::Point3F(313.4f, 1196.0f, -1.0f));
vertices_b.push_back(gfx::Point3F(62.1f, 1196.0f, 1.0f));
vertices_b.emplace_back(62.1f, 1034.7f, 1.0f);
vertices_b.emplace_back(313.4f, 1035.3f, -1.0f);
vertices_b.emplace_back(313.4f, 1196.0f, -1.0f);
vertices_b.emplace_back(62.1f, 1196.0f, 1.0f);
gfx::Vector3dF normal_b = gfx::CrossProduct(vertices_b[1] - vertices_b[0],
vertices_b[1] - vertices_b[2]);
normal_b.Scale(1.0f / normal_b.Length());
......@@ -304,15 +305,15 @@ TEST(DrawPolygonSplitTest, NotClearlyInFront) {
// Two quads are definitely not touching and so no split should occur.
TEST(DrawPolygonSplitTest, NotTouchingNoSplit) {
std::vector<gfx::Point3F> vertices_a;
vertices_a.push_back(gfx::Point3F(0.0f, 10.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(0.0f, 0.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(10.0f, 0.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(10.0f, 10.0f, 0.0f));
vertices_a.emplace_back(0.0f, 10.0f, 0.0f);
vertices_a.emplace_back(0.0f, 0.0f, 0.0f);
vertices_a.emplace_back(10.0f, 0.0f, 0.0f);
vertices_a.emplace_back(10.0f, 10.0f, 0.0f);
std::vector<gfx::Point3F> vertices_b;
vertices_b.push_back(gfx::Point3F(5.0f, 10.0f, 5.0f));
vertices_b.push_back(gfx::Point3F(5.0f, 10.0f, 15.0f));
vertices_b.push_back(gfx::Point3F(5.0f, 0.0f, 15.0f));
vertices_b.push_back(gfx::Point3F(5.0f, 0.0f, 5.0f));
vertices_b.emplace_back(5.0f, 10.0f, 5.0f);
vertices_b.emplace_back(5.0f, 10.0f, 15.0f);
vertices_b.emplace_back(5.0f, 0.0f, 15.0f);
vertices_b.emplace_back(5.0f, 0.0f, 5.0f);
CREATE_NEW_DRAW_POLYGON(polygon_a, vertices_a,
gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0);
......@@ -333,15 +334,15 @@ TEST(DrawPolygonSplitTest, NotTouchingNoSplit) {
// should occur.
TEST(DrawPolygonSplitTest, BarelyTouchingNoSplit) {
std::vector<gfx::Point3F> vertices_a;
vertices_a.push_back(gfx::Point3F(0.0f, 10.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(0.0f, 0.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(10.0f, 0.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(10.0f, 10.0f, 0.0f));
vertices_a.emplace_back(0.0f, 10.0f, 0.0f);
vertices_a.emplace_back(0.0f, 0.0f, 0.0f);
vertices_a.emplace_back(10.0f, 0.0f, 0.0f);
vertices_a.emplace_back(10.0f, 10.0f, 0.0f);
std::vector<gfx::Point3F> vertices_b;
vertices_b.push_back(gfx::Point3F(5.0f, 10.0f, 0.0f));
vertices_b.push_back(gfx::Point3F(5.0f, 10.0f, -10.0f));
vertices_b.push_back(gfx::Point3F(5.0f, 0.0f, -10.0f));
vertices_b.push_back(gfx::Point3F(5.0f, 0.0f, 0.0f));
vertices_b.emplace_back(5.0f, 10.0f, 0.0f);
vertices_b.emplace_back(5.0f, 10.0f, -10.0f);
vertices_b.emplace_back(5.0f, 0.0f, -10.0f);
vertices_b.emplace_back(5.0f, 0.0f, 0.0f);
CREATE_NEW_DRAW_POLYGON(polygon_a, vertices_a,
gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0);
......@@ -360,16 +361,16 @@ TEST(DrawPolygonSplitTest, BarelyTouchingNoSplit) {
// One quad intersects a pent with an occluded side.
TEST(DrawPolygonSplitTest, SlimClip) {
std::vector<gfx::Point3F> vertices_a;
vertices_a.push_back(gfx::Point3F(0.0f, 10.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(0.0f, 0.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(10.0f, 0.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(10.0f, 10.0f, 0.0f));
vertices_a.emplace_back(0.0f, 10.0f, 0.0f);
vertices_a.emplace_back(0.0f, 0.0f, 0.0f);
vertices_a.emplace_back(10.0f, 0.0f, 0.0f);
vertices_a.emplace_back(10.0f, 10.0f, 0.0f);
std::vector<gfx::Point3F> vertices_b;
vertices_b.push_back(gfx::Point3F(9.0f, 9.0f, 5.000f));
vertices_b.push_back(gfx::Point3F(1.0f, 1.0f, 0.001f));
vertices_b.push_back(gfx::Point3F(1.0f, 1.0f, 0.000f));
vertices_b.push_back(gfx::Point3F(1.002f, 1.002f, -0.005f));
vertices_b.push_back(gfx::Point3F(9.0f, 9.0f, -4.000f));
vertices_b.emplace_back(9.0f, 9.0f, 5.000f);
vertices_b.emplace_back(1.0f, 1.0f, 0.001f);
vertices_b.emplace_back(1.0f, 1.0f, 0.000f);
vertices_b.emplace_back(1.002f, 1.002f, -0.005f);
vertices_b.emplace_back(9.0f, 9.0f, -4.000f);
CREATE_NEW_DRAW_POLYGON_PTR(polygon_a, vertices_a,
gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0);
......@@ -398,15 +399,15 @@ TEST(DrawPolygonSplitTest, SlimClip) {
// One quad intersects another and becomes two pieces.
TEST(DrawPolygonSplitTest, BasicSplit) {
std::vector<gfx::Point3F> vertices_a;
vertices_a.push_back(gfx::Point3F(0.0f, 10.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(0.0f, 0.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(10.0f, 0.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(10.0f, 10.0f, 0.0f));
vertices_a.emplace_back(0.0f, 10.0f, 0.0f);
vertices_a.emplace_back(0.0f, 0.0f, 0.0f);
vertices_a.emplace_back(10.0f, 0.0f, 0.0f);
vertices_a.emplace_back(10.0f, 10.0f, 0.0f);
std::vector<gfx::Point3F> vertices_b;
vertices_b.push_back(gfx::Point3F(5.0f, 10.0f, -5.0f));
vertices_b.push_back(gfx::Point3F(5.0f, 0.0f, -5.0f));
vertices_b.push_back(gfx::Point3F(5.0f, 0.0f, 5.0f));
vertices_b.push_back(gfx::Point3F(5.0f, 10.0f, 5.0f));
vertices_b.emplace_back(5.0f, 10.0f, -5.0f);
vertices_b.emplace_back(5.0f, 0.0f, -5.0f);
vertices_b.emplace_back(5.0f, 0.0f, 5.0f);
vertices_b.emplace_back(5.0f, 10.0f, 5.0f);
CREATE_NEW_DRAW_POLYGON_PTR(polygon_a, vertices_a,
gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0);
......@@ -424,15 +425,15 @@ TEST(DrawPolygonSplitTest, BasicSplit) {
EXPECT_TRUE(back_polygon != nullptr);
std::vector<gfx::Point3F> test_points_a;
test_points_a.push_back(gfx::Point3F(5.0f, 0.0f, 0.0f));
test_points_a.push_back(gfx::Point3F(5.0f, 0.0f, 5.0f));
test_points_a.push_back(gfx::Point3F(5.0f, 10.0f, 5.0f));
test_points_a.push_back(gfx::Point3F(5.0f, 10.0f, 0.0f));
test_points_a.emplace_back(5.0f, 0.0f, 0.0f);
test_points_a.emplace_back(5.0f, 0.0f, 5.0f);
test_points_a.emplace_back(5.0f, 10.0f, 5.0f);
test_points_a.emplace_back(5.0f, 10.0f, 0.0f);
std::vector<gfx::Point3F> test_points_b;
test_points_b.push_back(gfx::Point3F(5.0f, 10.0f, 0.0f));
test_points_b.push_back(gfx::Point3F(5.0f, 10.0f, -5.0f));
test_points_b.push_back(gfx::Point3F(5.0f, 0.0f, -5.0f));
test_points_b.push_back(gfx::Point3F(5.0f, 0.0f, 0.0f));
test_points_b.emplace_back(5.0f, 10.0f, 0.0f);
test_points_b.emplace_back(5.0f, 10.0f, -5.0f);
test_points_b.emplace_back(5.0f, 0.0f, -5.0f);
test_points_b.emplace_back(5.0f, 0.0f, 0.0f);
ValidatePoints(*front_polygon, test_points_a);
ValidatePoints(*back_polygon, test_points_b);
......@@ -444,15 +445,15 @@ TEST(DrawPolygonSplitTest, BasicSplit) {
// a pentagon as a result.
TEST(DrawPolygonSplitTest, AngledSplit) {
std::vector<gfx::Point3F> vertices_a;
vertices_a.push_back(gfx::Point3F(0.0f, 0.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(0.0f, 0.0f, 10.0f));
vertices_a.push_back(gfx::Point3F(10.0f, 0.0f, 10.0f));
vertices_a.push_back(gfx::Point3F(10.0f, 0.0f, 0.0f));
vertices_a.emplace_back(0.0f, 0.0f, 0.0f);
vertices_a.emplace_back(0.0f, 0.0f, 10.0f);
vertices_a.emplace_back(10.0f, 0.0f, 10.0f);
vertices_a.emplace_back(10.0f, 0.0f, 0.0f);
std::vector<gfx::Point3F> vertices_b;
vertices_b.push_back(gfx::Point3F(2.0f, 5.0f, 1.0f));
vertices_b.push_back(gfx::Point3F(2.0f, -5.0f, 1.0f));
vertices_b.push_back(gfx::Point3F(-1.0f, -5.0f, -2.0f));
vertices_b.push_back(gfx::Point3F(-1.0f, 5.0f, -2.0f));
vertices_b.emplace_back(2.0f, 5.0f, 1.0f);
vertices_b.emplace_back(2.0f, -5.0f, 1.0f);
vertices_b.emplace_back(-1.0f, -5.0f, -2.0f);
vertices_b.emplace_back(-1.0f, 5.0f, -2.0f);
CREATE_NEW_DRAW_POLYGON_PTR(polygon_a, vertices_a,
gfx::Vector3dF(0.0f, 1.0f, 0.0f), 0);
......@@ -470,15 +471,15 @@ TEST(DrawPolygonSplitTest, AngledSplit) {
EXPECT_TRUE(back_polygon != nullptr);
std::vector<gfx::Point3F> test_points_a;
test_points_a.push_back(gfx::Point3F(10.0f, 0.0f, 9.0f));
test_points_a.push_back(gfx::Point3F(10.0f, 0.0f, 0.0f));
test_points_a.push_back(gfx::Point3F(1.0f, 0.0f, 0.0f));
test_points_a.emplace_back(10.0f, 0.0f, 9.0f);
test_points_a.emplace_back(10.0f, 0.0f, 0.0f);
test_points_a.emplace_back(1.0f, 0.0f, 0.0f);
std::vector<gfx::Point3F> test_points_b;
test_points_b.push_back(gfx::Point3F(1.0f, 0.0f, 0.0f));
test_points_b.push_back(gfx::Point3F(0.0f, 0.0f, 0.0f));
test_points_b.push_back(gfx::Point3F(0.0f, 0.0f, 10.0f));
test_points_b.push_back(gfx::Point3F(10.0f, 0.0f, 10.0f));
test_points_b.push_back(gfx::Point3F(10.0f, 0.0f, 9.0f));
test_points_b.emplace_back(1.0f, 0.0f, 0.0f);
test_points_b.emplace_back(0.0f, 0.0f, 0.0f);
test_points_b.emplace_back(0.0f, 0.0f, 10.0f);
test_points_b.emplace_back(10.0f, 0.0f, 10.0f);
test_points_b.emplace_back(10.0f, 0.0f, 9.0f);
ValidatePointsWithinDeltaOf(*front_polygon, test_points_a, 1e-6f);
ValidatePointsWithinDeltaOf(*back_polygon, test_points_b, 1e-6f);
......@@ -493,23 +494,23 @@ TEST(DrawPolygonSplitTest, AngledSplit) {
// being present in the output polygons.
TEST(DrawPolygonSplitTest, AlmostCoplanarSplit) {
std::vector<gfx::Point3F> vertices_a;
vertices_a.push_back(gfx::Point3F(723.814758300781250f, 552.810119628906250f,
-206.656036376953125f));
vertices_a.push_back(gfx::Point3F(797.634155273437500f, 549.095703125000000f,
-209.802902221679688f));
vertices_a.push_back(gfx::Point3F(799.264648437500000f, 490.325805664062500f,
-172.261627197265625f));
vertices_a.push_back(gfx::Point3F(720.732421875000000f, 493.944458007812500f,
-168.700469970703125f));
vertices_a.emplace_back(723.814758300781250f, 552.810119628906250f,
-206.656036376953125f);
vertices_a.emplace_back(797.634155273437500f, 549.095703125000000f,
-209.802902221679688f);
vertices_a.emplace_back(799.264648437500000f, 490.325805664062500f,
-172.261627197265625f);
vertices_a.emplace_back(720.732421875000000f, 493.944458007812500f,
-168.700469970703125f);
std::vector<gfx::Point3F> vertices_b;
vertices_b.push_back(gfx::Point3F(720.631286621093750f, 487.595977783203125f,
-164.681198120117188f));
vertices_b.push_back(gfx::Point3F(799.672851562500000f, 484.059020996093750f,
-168.219161987304688f));
vertices_b.push_back(gfx::Point3F(801.565490722656250f, 416.416809082031250f,
-125.007690429687500f));
vertices_b.push_back(gfx::Point3F(717.096801757812500f, 419.792327880859375f,
-120.967689514160156f));
vertices_b.emplace_back(720.631286621093750f, 487.595977783203125f,
-164.681198120117188f);
vertices_b.emplace_back(799.672851562500000f, 484.059020996093750f,
-168.219161987304688f);
vertices_b.emplace_back(801.565490722656250f, 416.416809082031250f,
-125.007690429687500f);
vertices_b.emplace_back(717.096801757812500f, 419.792327880859375f,
-120.967689514160156f);
CREATE_NEW_DRAW_POLYGON_PTR(
splitting_polygon, vertices_a,
......@@ -541,15 +542,15 @@ TEST(DrawPolygonSplitTest, AlmostCoplanarSplit) {
// a pentagon as a result, and then cut the pentagon.
TEST(DrawPolygonSplitTest, DoubleSplit) {
std::vector<gfx::Point3F> vertices_a;
vertices_a.push_back(gfx::Point3F(0.0f, 0.0f, 0.0f));
vertices_a.push_back(gfx::Point3F(0.0f, 0.0f, 10.0f));
vertices_a.push_back(gfx::Point3F(10.0f, 0.0f, 10.0f));
vertices_a.push_back(gfx::Point3F(10.0f, 0.0f, 0.0f));
vertices_a.emplace_back(0.0f, 0.0f, 0.0f);
vertices_a.emplace_back(0.0f, 0.0f, 10.0f);
vertices_a.emplace_back(10.0f, 0.0f, 10.0f);
vertices_a.emplace_back(10.0f, 0.0f, 0.0f);
std::vector<gfx::Point3F> vertices_b;
vertices_b.push_back(gfx::Point3F(2.0f, 5.0f, 1.0f));
vertices_b.push_back(gfx::Point3F(2.0f, -5.0f, 1.0f));
vertices_b.push_back(gfx::Point3F(-1.0f, -5.0f, -2.0f));
vertices_b.push_back(gfx::Point3F(-1.0f, 5.0f, -2.0f));
vertices_b.emplace_back(2.0f, 5.0f, 1.0f);
vertices_b.emplace_back(2.0f, -5.0f, 1.0f);
vertices_b.emplace_back(-1.0f, -5.0f, -2.0f);
vertices_b.emplace_back(-1.0f, 5.0f, -2.0f);
CREATE_NEW_DRAW_POLYGON_PTR(polygon_a, vertices_a,
gfx::Vector3dF(0.0f, 1.0f, 0.0f), 0);
......@@ -573,9 +574,9 @@ TEST(DrawPolygonSplitTest, DoubleSplit) {
back_polygon->points();
std::vector<gfx::Point3F> vertices_c;
vertices_c.push_back(gfx::Point3F(0.0f, 0.0f, 10.0f));
vertices_c.push_back(gfx::Point3F(1.0f, -0.05f, 0.0f));
vertices_c.push_back(gfx::Point3F(10.0f, 0.05f, 9.0f));
vertices_c.emplace_back(0.0f, 0.0f, 10.0f);
vertices_c.emplace_back(1.0f, -0.05f, 0.0f);
vertices_c.emplace_back(10.0f, 0.05f, 9.0f);
CREATE_NEW_DRAW_POLYGON_PTR(polygon_c, vertices_c,
gfx::Vector3dF(0.005555f, -0.99997f, 0.005555f),
......@@ -602,9 +603,9 @@ TEST(DrawPolygonSplitTest, DoubleSplit) {
TEST(DrawPolygonTransformTest, TransformNormal) {
std::vector<gfx::Point3F> vertices_a;
vertices_a.push_back(gfx::Point3F(1.0f, 0.0f, 1.0f));
vertices_a.push_back(gfx::Point3F(-1.0f, 0.0f, -1.0f));
vertices_a.push_back(gfx::Point3F(0.0f, 1.0f, 0.0f));
vertices_a.emplace_back(1.0f, 0.0f, 1.0f);
vertices_a.emplace_back(-1.0f, 0.0f, -1.0f);
vertices_a.emplace_back(0.0f, 1.0f, 0.0f);
CREATE_NEW_DRAW_POLYGON(polygon_a, vertices_a,
gfx::Vector3dF(sqrt(2) / 2, 0.0f, -sqrt(2) / 2), 0);
EXPECT_NORMAL(polygon_a, sqrt(2) / 2, 0.0f, -sqrt(2) / 2);
......
......@@ -170,7 +170,7 @@ class VIZ_SERVICE_EXPORT OverlayProcessorInterface {
virtual void SetFrameSequenceNumber(uint64_t frame_sequence_number) {}
protected:
OverlayProcessorInterface() {}
OverlayProcessorInterface() = default;
private:
DISALLOW_COPY_AND_ASSIGN(OverlayProcessorInterface);
......
......@@ -13,7 +13,7 @@ namespace viz {
class SoftwareOutputDeviceClient {
public:
virtual ~SoftwareOutputDeviceClient() {}
virtual ~SoftwareOutputDeviceClient() = default;
// Specify the CALayer parameters used to display the content drawn by this
// device on macOS.
......
......@@ -15,9 +15,6 @@ SurfaceResourceHolder::SurfaceResourceHolder(
SurfaceResourceHolder::~SurfaceResourceHolder() = default;
SurfaceResourceHolder::ResourceRefs::ResourceRefs()
: refs_received_from_child(0), refs_holding_resource_alive(0) {}
void SurfaceResourceHolder::Reset() {
resource_id_info_map_.clear();
}
......
......@@ -6,6 +6,7 @@
#define COMPONENTS_VIZ_SERVICE_FRAME_SINKS_SURFACE_RESOURCE_HOLDER_H_
#include <unordered_map>
#include <vector>
#include "base/macros.h"
#include "components/viz/common/resources/resource_id.h"
......@@ -34,10 +35,8 @@ class VIZ_SERVICE_EXPORT SurfaceResourceHolder {
SurfaceResourceHolderClient* client_;
struct ResourceRefs {
ResourceRefs();
int refs_received_from_child;
int refs_holding_resource_alive;
int refs_received_from_child = 0;
int refs_holding_resource_alive = 0;
gpu::SyncToken sync_token;
};
// Keeps track of the number of users currently in flight for each resource
......
......@@ -15,7 +15,7 @@ class LatestLocalSurfaceIdLookupDelegate {
const FrameSinkId& frame_sink_id) const = 0;
protected:
virtual ~LatestLocalSurfaceIdLookupDelegate() {}
virtual ~LatestLocalSurfaceIdLookupDelegate() = default;
};
} // namespace viz
......
......@@ -364,7 +364,7 @@ void Surface::RecomputeActiveReferencedSurfaces() {
active_referenced_surfaces_.insert(surface->surface_id());
last_surface_id_for_range_.push_back(surface->surface_id());
} else {
last_surface_id_for_range_.push_back(SurfaceId());
last_surface_id_for_range_.emplace_back();
}
// The allocation group for the end of the SurfaceRange should always be
// referenced.
......
......@@ -9,7 +9,7 @@ namespace viz {
FakeSurfaceObserver::FakeSurfaceObserver(bool damage_display)
: damage_display_(damage_display) {}
FakeSurfaceObserver::~FakeSurfaceObserver() {}
FakeSurfaceObserver::~FakeSurfaceObserver() = default;
void FakeSurfaceObserver::Reset() {
last_ack_ = BeginFrameAck();
......
......@@ -44,7 +44,7 @@ class GpuMemoryBufferManager;
// synchronized using SyncTokens. See //docs/design/gpu_synchronization.md.
class GPU_EXPORT SharedImageInterface {
public:
virtual ~SharedImageInterface() {}
virtual ~SharedImageInterface() = default;
// Creates a shared image of requested |format|, |size| and |color_space|.
// |usage| is a combination of |SharedImageUsage| bits that describes which
......
......@@ -66,8 +66,8 @@ class GPU_GLES2_EXPORT SharedContextState
public:
using ContextLostCallback = base::OnceCallback<void(bool)>;
// TODO: Refactor code to have seperate constructor for GL and Vulkan and not
// initialize/use GL related info for vulkan and vice-versa.
// TODO(vikassoni): Refactor code to have seperate constructor for GL and
// Vulkan and not initialize/use GL related info for vulkan and vice-versa.
SharedContextState(
scoped_refptr<gl::GLShareGroup> share_group,
scoped_refptr<gl::GLSurface> surface,
......@@ -182,7 +182,7 @@ class GPU_GLES2_EXPORT SharedContextState
virtual void OnContextLost() = 0;
protected:
virtual ~ContextLostObserver() {}
virtual ~ContextLostObserver() = default;
};
void AddContextLostObserver(ContextLostObserver* obs);
void RemoveContextLostObserver(ContextLostObserver* obs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment