Flutter Engine
The Flutter Engine
insets.cc
Go to the documentation of this file.
1// Copyright (c) 2009 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "insets.h"
6
7#include "base/string_utils.h"
8#include "vector2d.h"
9
10namespace gfx {
11
12std::string Insets::ToString() const {
13 // Print members in the same order of the constructor parameters.
14 return base::StringPrintf("%d,%d,%d,%d", top(), left(), bottom(), right());
15}
16
17Insets Insets::Offset(const gfx::Vector2d& vector) const {
18 return gfx::Insets(base::ClampAdd(top(), vector.y()),
19 base::ClampAdd(left(), vector.x()),
20 base::ClampSub(bottom(), vector.y()),
21 base::ClampSub(right(), vector.x()));
22}
23
24} // namespace gfx
constexpr int right() const
Definition: insets.h:48
constexpr int bottom() const
Definition: insets.h:47
std::string ToString() const
Definition: insets.cc:12
constexpr int top() const
Definition: insets.h:45
constexpr int left() const
Definition: insets.h:46
Insets Offset(const gfx::Vector2d &vector) const
Definition: insets.cc:17
constexpr int x() const
Definition: vector2d.h:27
constexpr int y() const
Definition: vector2d.h:30
std::string StringPrintf(const std::string &format, Args... args)
Definition: string_utils.h:18
Definition: insets.cc:10