mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Ladybird: Account for backing store bitmap pitch
In the upcoming changes, Skia painter will be switched to Metal backend, so we can no longer assume `pitch = width * 4` while reading Gfx::Bitmap that wraps IOSurface populated by writing into MTLTexture that has padded scanlines.
This commit is contained in:
parent
c62cc915df
commit
8de9516272
Notes:
sideshowbarker
2024-07-17 05:00:08 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/8de9516272 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/294
2 changed files with 2 additions and 3 deletions
|
@ -1288,7 +1288,6 @@ static void copy_data_to_clipboard(StringView data, NSPasteboardType pasteboard_
|
|||
|
||||
static constexpr size_t BITS_PER_COMPONENT = 8;
|
||||
static constexpr size_t BITS_PER_PIXEL = 32;
|
||||
static constexpr size_t COMPONENTS_PER_PIXEL = 4;
|
||||
|
||||
auto* context = [[NSGraphicsContext currentContext] CGContext];
|
||||
CGContextSaveGState(context);
|
||||
|
@ -1309,7 +1308,7 @@ static void copy_data_to_clipboard(StringView data, NSPasteboardType pasteboard_
|
|||
bitmap_size.height(),
|
||||
BITS_PER_COMPONENT,
|
||||
BITS_PER_PIXEL,
|
||||
COMPONENTS_PER_PIXEL * bitmap.width(),
|
||||
bitmap.pitch(),
|
||||
CGColorSpaceCreateDeviceRGB(),
|
||||
kCGBitmapByteOrder32Little | kCGImageAlphaFirst,
|
||||
provider,
|
||||
|
|
|
@ -403,7 +403,7 @@ void WebContentView::paintEvent(QPaintEvent*)
|
|||
}
|
||||
|
||||
if (bitmap) {
|
||||
QImage q_image(bitmap->scanline_u8(0), bitmap->width(), bitmap->height(), QImage::Format_RGB32);
|
||||
QImage q_image(bitmap->scanline_u8(0), bitmap->width(), bitmap->height(), bitmap->pitch(), QImage::Format_RGB32);
|
||||
painter.drawImage(QPoint(0, 0), q_image, QRect(0, 0, bitmap_size.width(), bitmap_size.height()));
|
||||
|
||||
if (bitmap_size.width() < width()) {
|
||||
|
|
Loading…
Reference in a new issue