chromium/ui/gfx/geometry/size.h

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_GFX_GEOMETRY_SIZE_H_
#define UI_GFX_GEOMETRY_SIZE_H_

#include <algorithm>
#include <iosfwd>
#include <string>

#include "base/numerics/safe_math.h"
#include "build/build_config.h"
#include "ui/gfx/geometry/geometry_export.h"

#if BUILDFLAG(IS_WIN)
typedef struct tagSIZE SIZE;
#elif BUILDFLAG(IS_APPLE)
typedef struct CGSize CGSize;
#endif

namespace gfx {

// A size has width and height values.
class GEOMETRY_EXPORT Size {};

inline bool operator==(const Size& lhs, const Size& rhs) {}

inline bool operator!=(const Size& lhs, const Size& rhs) {}

inline Size operator+(Size lhs, const Size& rhs) {}

inline Size operator-(Size lhs, const Size& rhs) {}

// This is declared here for use in gtest-based unit tests but is defined in
// the //ui/gfx:test_support target. Depend on that to use this in your unit
// test. This should not be used in production code - call ToString() instead.
void PrintTo(const Size& size, ::std::ostream* os);

// Helper methods to scale a gfx::Size to a new gfx::Size.
GEOMETRY_EXPORT Size ScaleToCeiledSize(const Size& size,
                                       float x_scale,
                                       float y_scale);
GEOMETRY_EXPORT Size ScaleToCeiledSize(const Size& size, float scale);
GEOMETRY_EXPORT Size ScaleToFlooredSize(const Size& size,
                                        float x_scale,
                                        float y_scale);
GEOMETRY_EXPORT Size ScaleToFlooredSize(const Size& size, float scale);
GEOMETRY_EXPORT Size ScaleToRoundedSize(const Size& size,
                                        float x_scale,
                                        float y_scale);
GEOMETRY_EXPORT Size ScaleToRoundedSize(const Size& size, float scale);

inline Size TransposeSize(const Size& s) {}

}  // namespace gfx

#endif  // UI_GFX_GEOMETRY_SIZE_H_