mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-17 07:50:04 +00:00
LibGfx: Move Gfx::Painter::ScalingMode => Gfx::ScalingMode
This will allow users to avoid including Painter.h
This commit is contained in:
parent
5e059c80cd
commit
254d040ff4
Notes:
sideshowbarker
2024-07-17 05:23:40 +09:00
Author: https://github.com/awesomekling
Commit: 254d040ff4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/50
14 changed files with 67 additions and 51 deletions
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include <AK/Optional.h>
|
||||
#include <LibGfx/FontCascadeList.h>
|
||||
#include <LibGfx/Painter.h>
|
||||
#include <LibGfx/ScalingMode.h>
|
||||
#include <LibWeb/CSS/BackdropFilter.h>
|
||||
#include <LibWeb/CSS/CalculatedOr.h>
|
||||
#include <LibWeb/CSS/Clip.h>
|
||||
|
@ -319,19 +319,19 @@ struct BorderRadiusData {
|
|||
};
|
||||
|
||||
// FIXME: Find a better place for this helper.
|
||||
inline Gfx::Painter::ScalingMode to_gfx_scaling_mode(CSS::ImageRendering css_value, Gfx::IntRect source, Gfx::IntRect target)
|
||||
inline Gfx::ScalingMode to_gfx_scaling_mode(CSS::ImageRendering css_value, Gfx::IntRect source, Gfx::IntRect target)
|
||||
{
|
||||
switch (css_value) {
|
||||
case CSS::ImageRendering::Auto:
|
||||
case CSS::ImageRendering::HighQuality:
|
||||
case CSS::ImageRendering::Smooth:
|
||||
if (target.width() < source.width() || target.height() < source.height())
|
||||
return Gfx::Painter::ScalingMode::BoxSampling;
|
||||
return Gfx::Painter::ScalingMode::BilinearBlend;
|
||||
return Gfx::ScalingMode::BoxSampling;
|
||||
return Gfx::ScalingMode::BilinearBlend;
|
||||
case CSS::ImageRendering::CrispEdges:
|
||||
return Gfx::Painter::ScalingMode::NearestNeighbor;
|
||||
return Gfx::ScalingMode::NearestNeighbor;
|
||||
case CSS::ImageRendering::Pixelated:
|
||||
return Gfx::Painter::ScalingMode::SmoothPixels;
|
||||
return Gfx::ScalingMode::SmoothPixels;
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue