mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-24 18:28:57 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
46
Libraries/LibMedia/Subsampling.h
Normal file
46
Libraries/LibMedia/Subsampling.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Gregory Bertilson <zaggy1024@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibGfx/Size.h>
|
||||
|
||||
namespace Media {
|
||||
|
||||
struct Subsampling {
|
||||
public:
|
||||
Subsampling(bool x, bool y)
|
||||
: m_x(x)
|
||||
, m_y(y)
|
||||
{
|
||||
}
|
||||
|
||||
Subsampling() = default;
|
||||
|
||||
bool x() const { return m_x; }
|
||||
bool y() const { return m_y; }
|
||||
|
||||
static u32 subsampled_size(bool subsampled, u32 size)
|
||||
{
|
||||
u32 subsampled_as_int = static_cast<u32>(subsampled);
|
||||
return (size + subsampled_as_int) >> subsampled_as_int;
|
||||
}
|
||||
|
||||
template<Integral T>
|
||||
Gfx::Size<T> subsampled_size(Gfx::Size<T> size) const
|
||||
{
|
||||
return {
|
||||
subsampled_size(x(), size.width()),
|
||||
subsampled_size(y(), size.height())
|
||||
};
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_x = false;
|
||||
bool m_y = false;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue