mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
Everywhere: Avoid large rebuilds when editing (Immutable)Bitmap headers
This reduces the number of recompiled files as follow: - Bitmap.h: 1309 -> 101 - ImmutableBitmap.h: 1218 -> 75
This commit is contained in:
parent
40f089a043
commit
28ba610f32
Notes:
github-actions[bot]
2025-11-28 17:35:14 +00:00
Author: https://github.com/InvalidUsernameException
Commit: 28ba610f32
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6911
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/Psychpsyo
Reviewed-by: https://github.com/gmta
66 changed files with 140 additions and 59 deletions
|
|
@ -62,6 +62,11 @@ inline StorageFormat determine_storage_format(BitmapFormat format)
|
|||
}
|
||||
}
|
||||
|
||||
enum class MaskKind {
|
||||
Alpha,
|
||||
Luminance
|
||||
};
|
||||
|
||||
struct BackingStore;
|
||||
|
||||
class Bitmap : public AtomicRefCounted<Bitmap> {
|
||||
|
|
@ -82,11 +87,6 @@ public:
|
|||
|
||||
[[nodiscard]] ShareableBitmap to_shareable_bitmap() const;
|
||||
|
||||
enum class MaskKind {
|
||||
Alpha,
|
||||
Luminance
|
||||
};
|
||||
|
||||
void apply_mask(Gfx::Bitmap const& mask, MaskKind);
|
||||
|
||||
~Bitmap();
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ set(SOURCES
|
|||
ImageFormats/WebPWriter.cpp
|
||||
ImageFormats/WebPWriterLossless.cpp
|
||||
ImmutableBitmap.cpp
|
||||
PaintStyle.cpp
|
||||
Painter.cpp
|
||||
PainterSkia.cpp
|
||||
PaintingSurface.cpp
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibGfx/Cursor.h>
|
||||
#include <LibGfx/ShareableBitmap.h>
|
||||
#include <LibIPC/Decoder.h>
|
||||
#include <LibIPC/Encoder.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <LibGfx/Filter.h>
|
||||
#include <LibGfx/FilterImpl.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibGfx/SkiaUtils.h>
|
||||
#include <core/SkBlendMode.h>
|
||||
#include <core/SkColorFilter.h>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <LibGfx/Color.h>
|
||||
#include <LibGfx/CompositingAndBlendingOperator.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
#include <LibGfx/ScalingMode.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ using FloatQuad = Quad<float>;
|
|||
|
||||
enum class BitmapFormat;
|
||||
enum class ColorRole;
|
||||
enum class MaskKind;
|
||||
enum class TextAlignment;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@
|
|||
|
||||
namespace Gfx {
|
||||
|
||||
class Bitmap;
|
||||
|
||||
struct ImageFrameDescriptor {
|
||||
NonnullRefPtr<Bitmap> image;
|
||||
int duration { 0 };
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include <AK/AtomicRefCounted.h>
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Color.h>
|
||||
#include <LibGfx/ColorSpace.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
|
|
|
|||
29
Libraries/LibGfx/PaintStyle.cpp
Normal file
29
Libraries/LibGfx/PaintStyle.cpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2023, MacDue <macdue@dueutil.tech>
|
||||
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibGfx/PaintStyle.h>
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
CanvasPatternPaintStyle::CanvasPatternPaintStyle(RefPtr<ImmutableBitmap> image, Repetition repetition)
|
||||
: m_image(move(image))
|
||||
, m_repetition(repetition)
|
||||
{
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<CanvasPatternPaintStyle>> CanvasPatternPaintStyle::create(RefPtr<ImmutableBitmap> image, Repetition repetition)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) CanvasPatternPaintStyle(move(image), repetition));
|
||||
}
|
||||
|
||||
RefPtr<ImmutableBitmap> CanvasPatternPaintStyle::image() const
|
||||
{
|
||||
return m_image;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -10,11 +10,11 @@
|
|||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGfx/Color.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/Gradients.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
|
||||
namespace Gfx {
|
||||
|
|
@ -89,22 +89,15 @@ public:
|
|||
NoRepeat
|
||||
};
|
||||
|
||||
static ErrorOr<NonnullRefPtr<CanvasPatternPaintStyle>> create(RefPtr<ImmutableBitmap> image, Repetition repetition)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) CanvasPatternPaintStyle(image, repetition));
|
||||
}
|
||||
static ErrorOr<NonnullRefPtr<CanvasPatternPaintStyle>> create(RefPtr<ImmutableBitmap> image, Repetition repetition);
|
||||
|
||||
RefPtr<ImmutableBitmap> image() const { return m_image; }
|
||||
RefPtr<ImmutableBitmap> image() const;
|
||||
Repetition repetition() const { return m_repetition; }
|
||||
Optional<AffineTransform> const& transform() const { return m_transform; }
|
||||
void set_transform(AffineTransform const& transform) { m_transform = transform; }
|
||||
|
||||
private:
|
||||
CanvasPatternPaintStyle(RefPtr<ImmutableBitmap> image, Repetition repetition)
|
||||
: m_image(image)
|
||||
, m_repetition(repetition)
|
||||
{
|
||||
}
|
||||
CanvasPatternPaintStyle(RefPtr<ImmutableBitmap> image, Repetition repetition);
|
||||
|
||||
RefPtr<ImmutableBitmap> m_image;
|
||||
Repetition m_repetition { Repetition::Repeat };
|
||||
|
|
|
|||
|
|
@ -13,11 +13,26 @@
|
|||
|
||||
namespace Gfx {
|
||||
|
||||
ShareableBitmap::ShareableBitmap() = default;
|
||||
|
||||
ShareableBitmap::ShareableBitmap(NonnullRefPtr<Bitmap> bitmap, Tag)
|
||||
: m_bitmap(move(bitmap))
|
||||
{
|
||||
}
|
||||
|
||||
ShareableBitmap::~ShareableBitmap() = default;
|
||||
|
||||
ShareableBitmap::ShareableBitmap(ShareableBitmap const&) = default;
|
||||
ShareableBitmap::ShareableBitmap(ShareableBitmap&&) = default;
|
||||
|
||||
ShareableBitmap& ShareableBitmap::operator=(ShareableBitmap const&) = default;
|
||||
ShareableBitmap& ShareableBitmap::operator=(ShareableBitmap&&) = default;
|
||||
|
||||
bool ShareableBitmap::is_valid() const { return m_bitmap; }
|
||||
|
||||
Bitmap const* ShareableBitmap::bitmap() const { return m_bitmap; }
|
||||
Bitmap* ShareableBitmap::bitmap() { return m_bitmap; }
|
||||
|
||||
}
|
||||
|
||||
namespace IPC {
|
||||
|
|
|
|||
|
|
@ -7,22 +7,30 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/RefPtr.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibIPC/Forward.h>
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
class ShareableBitmap {
|
||||
public:
|
||||
ShareableBitmap() = default;
|
||||
ShareableBitmap();
|
||||
|
||||
enum Tag { ConstructWithKnownGoodBitmap };
|
||||
ShareableBitmap(NonnullRefPtr<Gfx::Bitmap>, Tag);
|
||||
|
||||
bool is_valid() const { return m_bitmap; }
|
||||
~ShareableBitmap();
|
||||
|
||||
Bitmap const* bitmap() const { return m_bitmap; }
|
||||
Bitmap* bitmap() { return m_bitmap; }
|
||||
ShareableBitmap(ShareableBitmap const&);
|
||||
ShareableBitmap(ShareableBitmap&&);
|
||||
|
||||
ShareableBitmap& operator=(ShareableBitmap const&);
|
||||
ShareableBitmap& operator=(ShareableBitmap&&);
|
||||
|
||||
bool is_valid() const;
|
||||
|
||||
Bitmap const* bitmap() const;
|
||||
Bitmap* bitmap();
|
||||
|
||||
private:
|
||||
friend class Bitmap;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/PainterSkia.h>
|
||||
#include <LibGfx/VectorGraphic.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/RefCounted.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/Painter.h>
|
||||
#include <LibGfx/Size.h>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
#include <AK/Queue.h>
|
||||
#include <AK/Time.h>
|
||||
#include <LibCore/Forward.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibMedia/DecoderError.h>
|
||||
#include <LibMedia/Export.h>
|
||||
#include <LibMedia/Forward.h>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibURL/Parser.h>
|
||||
#include <LibWeb/CSS/CSSMarginRule.h>
|
||||
#include <LibWeb/CSS/CSSStyleDeclaration.h>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "CursorStyleValue.h"
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Painter.h>
|
||||
#include <LibWeb/CSS/Sizing.h>
|
||||
#include <LibWeb/CSS/StyleValues/AbstractImageStyleValue.h>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibWeb/CSS/ComputedValues.h>
|
||||
#include <LibWeb/CSS/Fetch.h>
|
||||
#include <LibWeb/CSS/StyleValues/ImageStyleValue.h>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
#include <AK/IterationDecision.h>
|
||||
#include <AK/NumericLimits.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibJS/Runtime/NativeFunction.h>
|
||||
#include <LibUnicode/CharacterTypes.h>
|
||||
#include <LibUnicode/Locale.h>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <LibGC/Heap.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibJS/Runtime/Realm.h>
|
||||
#include <LibWeb/HTML/AnimatedBitmapDecodedImageData.h>
|
||||
#include <LibWeb/Painting/DisplayListRecorder.h>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibWeb/HTML/DecodedImageData.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibWeb/HTML/Canvas/CanvasDrawImage.h>
|
||||
#include <LibWeb/HTML/ImageBitmap.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/MemoryStream.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ImageFormats/JPEGWriter.h>
|
||||
#include <LibGfx/ImageFormats/PNGWriter.h>
|
||||
#include <LibWeb/HTML/Canvas/SerializeBitmap.h>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibWeb/Bindings/CanvasPatternPrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/HTML/CanvasPattern.h>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@
|
|||
*/
|
||||
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/CompositingAndBlendingOperator.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibGfx/PainterSkia.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
#include <LibJS/Runtime/TypedArray.h>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibWeb/HTML/DataTransfer.h>
|
||||
#include <LibWeb/HTML/DragDataStore.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#include <AK/RefCounted.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/Point.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include <AK/Base64.h>
|
||||
#include <AK/Checked.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
||||
#include <LibWeb/Bindings/HTMLCanvasElementPrototype.h>
|
||||
#include <LibWeb/CSS/ComputedProperties.h>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <LibCore/Timer.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibWeb/ARIA/Roles.h>
|
||||
#include <LibWeb/Bindings/HTMLImageElementPrototype.h>
|
||||
#include <LibWeb/CSS/ComputedProperties.h>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
#include <AK/OwnPtr.h>
|
||||
#include <LibGC/Function.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/DocumentLoadEventDelayer.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibJS/Runtime/Date.h>
|
||||
#include <LibJS/Runtime/NativeFunction.h>
|
||||
#include <LibJS/Runtime/RegExpObject.h>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibTextCodec/Decoder.h>
|
||||
#include <LibURL/URL.h>
|
||||
#include <LibWeb/Bindings/HTMLLinkElementPrototype.h>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibWeb/Bindings/HTMLObjectElementPrototype.h>
|
||||
#include <LibWeb/CSS/ComputedProperties.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibWeb/Bindings/ImageBitmapPrototype.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/Bindings/Serializable.h>
|
||||
|
|
@ -70,7 +70,7 @@ private:
|
|||
WebIDL::UnsignedLong m_width = 0;
|
||||
WebIDL::UnsignedLong m_height = 0;
|
||||
|
||||
RefPtr<Gfx::Bitmap> m_bitmap { nullptr };
|
||||
RefPtr<Gfx::Bitmap> m_bitmap;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/Tuple.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibWeb/Bindings/OffscreenCanvasPrototype.h>
|
||||
#include <LibWeb/HTML/Canvas/SerializeBitmap.h>
|
||||
#include <LibWeb/HTML/OffscreenCanvas.h>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/Bindings/Transferable.h>
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibWeb/Bindings/PrincipalHostDefined.h>
|
||||
#include <LibWeb/Fetch/Fetching/Fetching.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/FetchAlgorithms.h>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/QuickSort.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/SkiaBackendContext.h>
|
||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
#include <AK/Utf8View.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGC/Function.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibGfx/ScalingMode.h>
|
||||
#include <LibJS/Runtime/Array.h>
|
||||
#include <LibJS/Runtime/TypedArray.h>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibWeb/Layout/ImageBox.h>
|
||||
#include <LibWeb/Layout/ImageProvider.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibWeb/CSS/ComputedProperties.h>
|
||||
#include <LibWeb/CSS/ComputedValues.h>
|
||||
#include <LibWeb/CSS/Enums.h>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibUnicode/CharacterTypes.h>
|
||||
#include <LibUnicode/Segmenter.h>
|
||||
#include <LibWeb/CSS/VisualViewport.h>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/Timer.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/PaintingSurface.h>
|
||||
#include <LibWeb/HTML/TraversableNavigable.h>
|
||||
#include <LibWeb/Painting/BackingStoreManager.h>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/AtomicRefCounted.h>
|
||||
#include <LibWeb/Export.h>
|
||||
#include <LibWeb/Painting/BorderRadiiData.h>
|
||||
#include <LibWeb/Painting/ScrollFrame.h>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
#include <AK/SegmentedVector.h>
|
||||
#include <LibGfx/Color.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibGfx/PaintStyle.h>
|
||||
#include <LibWeb/CSS/Enums.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
|
|
|||
|
|
@ -445,7 +445,7 @@ struct ApplyTransform {
|
|||
struct ApplyMaskBitmap {
|
||||
Gfx::IntPoint origin;
|
||||
NonnullRefPtr<Gfx::ImmutableBitmap const> bitmap;
|
||||
Gfx::Bitmap::MaskKind kind;
|
||||
Gfx::MaskKind kind;
|
||||
|
||||
void translate_by(Gfx::IntPoint const& offset)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1019,7 +1019,7 @@ void DisplayListPlayerSkia::apply_mask_bitmap(ApplyMaskBitmap const& command)
|
|||
auto& cached_runtime_effects = this->cached_runtime_effects();
|
||||
|
||||
sk_sp<SkRuntimeEffect> effect;
|
||||
if (command.kind == Gfx::Bitmap::MaskKind::Luminance) {
|
||||
if (command.kind == Gfx::MaskKind::Luminance) {
|
||||
char const* sksl_shader = R"(
|
||||
uniform shader mask_image;
|
||||
half4 main(float2 coord) {
|
||||
|
|
@ -1032,7 +1032,7 @@ void DisplayListPlayerSkia::apply_mask_bitmap(ApplyMaskBitmap const& command)
|
|||
cached_runtime_effects.luminance_mask = compile_effect(sksl_shader);
|
||||
}
|
||||
effect = cached_runtime_effects.luminance_mask;
|
||||
} else if (command.kind == Gfx::Bitmap::MaskKind::Alpha) {
|
||||
} else if (command.kind == Gfx::MaskKind::Alpha) {
|
||||
char const* sksl_shader = R"(
|
||||
uniform shader mask_image;
|
||||
half4 main(float2 coord) {
|
||||
|
|
|
|||
|
|
@ -455,7 +455,7 @@ void DisplayListRecorder::apply_transform(Gfx::FloatPoint origin, Gfx::FloatMatr
|
|||
});
|
||||
}
|
||||
|
||||
void DisplayListRecorder::apply_mask_bitmap(Gfx::IntPoint origin, Gfx::ImmutableBitmap const& bitmap, Gfx::Bitmap::MaskKind kind)
|
||||
void DisplayListRecorder::apply_mask_bitmap(Gfx::IntPoint origin, Gfx::ImmutableBitmap const& bitmap, Gfx::MaskKind kind)
|
||||
{
|
||||
APPEND(ApplyMaskBitmap {
|
||||
.origin = origin,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
#include <AK/Vector.h>
|
||||
#include <LibGfx/Color.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibGfx/LineStyle.h>
|
||||
#include <LibGfx/PaintStyle.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
|
|
@ -140,7 +139,7 @@ public:
|
|||
void apply_compositing_and_blending_operator(Gfx::CompositingAndBlendingOperator compositing_and_blending_operator);
|
||||
void apply_filter(Gfx::Filter filter);
|
||||
void apply_transform(Gfx::FloatPoint origin, Gfx::FloatMatrix4x4);
|
||||
void apply_mask_bitmap(Gfx::IntPoint origin, Gfx::ImmutableBitmap const&, Gfx::Bitmap::MaskKind);
|
||||
void apply_mask_bitmap(Gfx::IntPoint origin, Gfx::ImmutableBitmap const&, Gfx::MaskKind);
|
||||
|
||||
DisplayListRecorder(DisplayList&);
|
||||
~DisplayListRecorder();
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibWeb/CSS/StyleValues/EdgeStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/PositionStyleValue.h>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <AK/GenericShorthands.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <LibGfx/Font/Font.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibUnicode/CharacterTypes.h>
|
||||
#include <LibWeb/CSS/SystemColor.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
|
|
@ -1433,6 +1434,11 @@ Optional<CSSPixelRect> PaintableBox::get_masking_area() const
|
|||
return absolute_border_box_rect();
|
||||
}
|
||||
|
||||
RefPtr<Gfx::ImmutableBitmap> PaintableBox::calculate_mask(DisplayListRecordingContext&, CSSPixelRect const&) const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/css-transforms-1/#reference-box
|
||||
CSSPixelRect PaintableBox::transform_reference_box() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.h>
|
||||
#include <LibWeb/Export.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
|
@ -44,8 +43,8 @@ public:
|
|||
void invalidate_stacking_context();
|
||||
|
||||
virtual Optional<CSSPixelRect> get_masking_area() const;
|
||||
virtual Optional<Gfx::Bitmap::MaskKind> get_mask_type() const { return {}; }
|
||||
virtual RefPtr<Gfx::ImmutableBitmap> calculate_mask(DisplayListRecordingContext&, CSSPixelRect const&) const { return {}; }
|
||||
virtual Optional<Gfx::MaskKind> get_mask_type() const { return {}; }
|
||||
virtual RefPtr<Gfx::ImmutableBitmap> calculate_mask(DisplayListRecordingContext&, CSSPixelRect const&) const;
|
||||
|
||||
Layout::NodeWithStyleAndBoxModelMetrics const& layout_node_with_style_and_box_metrics() const { return as<Layout::NodeWithStyleAndBoxModelMetrics const>(layout_node()); }
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
virtual GC::Ptr<DOM::Node const> dom_node_of_svg() const override { return dom_node(); }
|
||||
virtual Optional<CSSPixelRect> get_masking_area() const override { return get_masking_area_of_svg(); }
|
||||
virtual Optional<Gfx::Bitmap::MaskKind> get_mask_type() const override { return get_mask_type_of_svg(); }
|
||||
virtual Optional<Gfx::MaskKind> get_mask_type() const override { return get_mask_type_of_svg(); }
|
||||
virtual RefPtr<Gfx::ImmutableBitmap> calculate_mask(DisplayListRecordingContext& paint_context, CSSPixelRect const& masking_area) const override { return calculate_mask_of_svg(paint_context, masking_area); }
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
virtual GC::Ptr<DOM::Node const> dom_node_of_svg() const override { return dom_node(); }
|
||||
virtual Optional<CSSPixelRect> get_masking_area() const override { return get_masking_area_of_svg(); }
|
||||
virtual Optional<Gfx::Bitmap::MaskKind> get_mask_type() const override { return get_mask_type_of_svg(); }
|
||||
virtual Optional<Gfx::MaskKind> get_mask_type() const override { return get_mask_type_of_svg(); }
|
||||
virtual RefPtr<Gfx::ImmutableBitmap> calculate_mask(DisplayListRecordingContext& paint_context, CSSPixelRect const& masking_area) const override { return calculate_mask_of_svg(paint_context, masking_area); }
|
||||
|
||||
void set_computed_transforms(ComputedTransforms computed_transforms)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibWeb/Layout/ImageBox.h>
|
||||
#include <LibWeb/Layout/SVGClipBox.h>
|
||||
#include <LibWeb/Layout/SVGMaskBox.h>
|
||||
|
|
@ -51,25 +52,25 @@ Optional<CSSPixelRect> SVGMaskable::get_masking_area_of_svg() const
|
|||
return masking_area;
|
||||
}
|
||||
|
||||
static Gfx::Bitmap::MaskKind mask_type_to_gfx_mask_kind(CSS::MaskType mask_type)
|
||||
static Gfx::MaskKind mask_type_to_gfx_mask_kind(CSS::MaskType mask_type)
|
||||
{
|
||||
switch (mask_type) {
|
||||
case CSS::MaskType::Alpha:
|
||||
return Gfx::Bitmap::MaskKind::Alpha;
|
||||
return Gfx::MaskKind::Alpha;
|
||||
case CSS::MaskType::Luminance:
|
||||
return Gfx::Bitmap::MaskKind::Luminance;
|
||||
return Gfx::MaskKind::Luminance;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
Optional<Gfx::Bitmap::MaskKind> SVGMaskable::get_mask_type_of_svg() const
|
||||
Optional<Gfx::MaskKind> SVGMaskable::get_mask_type_of_svg() const
|
||||
{
|
||||
auto const& graphics_element = as<SVG::SVGGraphicsElement const>(*dom_node_of_svg());
|
||||
if (auto* mask_box = get_mask_box(graphics_element))
|
||||
return mask_type_to_gfx_mask_kind(mask_box->computed_values().mask_type());
|
||||
if (get_clip_box(graphics_element))
|
||||
return Gfx::Bitmap::MaskKind::Alpha;
|
||||
return Gfx::MaskKind::Alpha;
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
@ -113,7 +114,7 @@ RefPtr<Gfx::ImmutableBitmap> SVGMaskable::calculate_mask_of_svg(DisplayListRecor
|
|||
auto clip_bitmap = paint_mask_or_clip(clip_paintable);
|
||||
// Combine the clip-path with the mask (if present).
|
||||
if (mask_bitmap && clip_bitmap)
|
||||
mask_bitmap->apply_mask(*clip_bitmap, Gfx::Bitmap::MaskKind::Alpha);
|
||||
mask_bitmap->apply_mask(*clip_bitmap, Gfx::MaskKind::Alpha);
|
||||
if (!mask_bitmap)
|
||||
mask_bitmap = clip_bitmap;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public:
|
|||
virtual GC::Ptr<DOM::Node const> dom_node_of_svg() const = 0;
|
||||
|
||||
Optional<CSSPixelRect> get_masking_area_of_svg() const;
|
||||
Optional<Gfx::Bitmap::MaskKind> get_mask_type_of_svg() const;
|
||||
Optional<Gfx::MaskKind> get_mask_type_of_svg() const;
|
||||
RefPtr<Gfx::ImmutableBitmap> calculate_mask_of_svg(DisplayListRecordingContext&, CSSPixelRect const& masking_area) const;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibWeb/Layout/ImageBox.h>
|
||||
#include <LibWeb/Painting/Blending.h>
|
||||
#include <LibWeb/Painting/DisplayListRecorder.h>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/Array.h>
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibMedia/Sinks/DisplayingVideoSink.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/HTMLMediaElement.h>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibWeb/Geometry/DOMMatrix.h>
|
||||
#include <LibWeb/Geometry/DOMPoint.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibJS/Runtime/Realm.h>
|
||||
#include <LibWeb/CSS/CSSKeyframesRule.h>
|
||||
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/Tuple.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/Bindings/ViewTransitionPrototype.h>
|
||||
#include <LibWeb/CSS/Enums.h>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <LibGC/Ptr.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/WebGL/Types.h>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ extern "C" {
|
|||
#include <GLES2/gl2ext_angle.h>
|
||||
}
|
||||
|
||||
#include <LibGfx/ImmutableBitmap.h>
|
||||
#include <LibGfx/SkiaUtils.h>
|
||||
#include <LibWeb/HTML/HTMLCanvasElement.h>
|
||||
#include <LibWeb/HTML/HTMLImageElement.h>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <LibGC/Ptr.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/WebGL/Types.h>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <AK/JsonObjectSerializer.h>
|
||||
#include <AK/JsonValue.h>
|
||||
#include <LibCore/Timer.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ShareableBitmap.h>
|
||||
#include <LibJS/Console.h>
|
||||
#include <LibJS/Runtime/ConsoleObject.h>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue