Flutter Engine
The Flutter Engine
SkBackingFit.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2023 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
9
11#include "src/base/SkMathPriv.h"
12
13#include <algorithm>
14
15namespace skgpu {
16
18 // Map 'value' to a larger multiple of 2. Values <= 'kMagicTol' will pop up to
19 // the next power of 2. Those above 'kMagicTol' will only go up half the floor power of 2.
20 auto adjust = [](int value) {
21 constexpr int kMinApproxSize = 16;
22 constexpr int kMagicTol = 1024;
23
24 value = std::max(kMinApproxSize, value);
25
26 if (SkIsPow2(value)) {
27 return value;
28 }
29
30 int ceilPow2 = SkNextPow2(value);
31 if (value <= kMagicTol) {
32 return ceilPow2;
33 }
34
35 int floorPow2 = ceilPow2 >> 1;
36 int mid = floorPow2 + (floorPow2 >> 1);
37
38 if (value <= mid) {
39 return mid;
40 }
41 return ceilPow2;
42 };
43
44 return {adjust(size.width()), adjust(size.height())};
45}
46
47} // namespace skgpu
static int SkNextPow2(int value)
Definition: SkMathPriv.h:272
constexpr bool SkIsPow2(T value)
Definition: SkMath.h:51
uint8_t value
static float max(float r, float g, float b)
Definition: hsl.cpp:49
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
Definition: GpuTools.h:21
SkISize GetApproxSize(SkISize size)
Definition: SkSize.h:16