summaryrefslogtreecommitdiff
path: root/chromium/components/viz/common/viz_utils.h
blob: be7ea5e5bc54083e20e22d165d39485621015f43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_VIZ_COMMON_VIZ_UTILS_H_
#define COMPONENTS_VIZ_COMMON_VIZ_UTILS_H_

#include "components/viz/common/viz_common_export.h"

#include "build/build_config.h"

namespace gfx {
class Rect;
class RRectF;
class QuadF;
}  // namespace gfx

namespace viz {

VIZ_COMMON_EXPORT bool PreferRGB565ResourcesForDisplay();

#if defined(OS_ANDROID)
VIZ_COMMON_EXPORT bool AlwaysUseWideColorGamut();
#endif

// This takes a gfx::Rect and a clip region quad in the same space,
// and returns a quad with the same proportions in the space -0.5->0.5.
VIZ_COMMON_EXPORT bool GetScaledRegion(const gfx::Rect& rect,
                                       const gfx::QuadF* clip,
                                       gfx::QuadF* scaled_region);
// This takes a rounded rect and a rect that it lives in, and returns an
// equivalent rounded rect in the space -0.5->0.5.
VIZ_COMMON_EXPORT bool GetScaledRRectF(const gfx::Rect& space,
                                       const gfx::RRectF& rect,
                                       gfx::RRectF* scaled_rect);
// This takes a gfx::Rect and a clip region quad in the same space,
// and returns the proportional uv's in the space 0->1.
VIZ_COMMON_EXPORT bool GetScaledUVs(const gfx::Rect& rect,
                                    const gfx::QuadF* clip,
                                    float uvs[8]);

}  // namespace viz

#endif  // COMPONENTS_VIZ_COMMON_VIZ_UTILS_H_