LibWeb: Remove ImageData's create_with_size() and use create() instead

Removes ImageData::create_with_size() and redirects previous usage to
ImageData::create().
This commit is contained in:
Kenneth Myhra 2024-03-23 21:59:12 +01:00 committed by Andreas Kling
commit 51847bbebf
Notes: sideshowbarker 2024-07-16 23:59:28 +09:00
5 changed files with 5 additions and 26 deletions

View file

@ -374,9 +374,9 @@ void CanvasRenderingContext2D::fill(Path2D& path, StringView fill_rule)
return fill_internal(transformed_path, parse_fill_rule(fill_rule));
}
JS::GCPtr<ImageData> CanvasRenderingContext2D::create_image_data(int width, int height) const
WebIDL::ExceptionOr<JS::NonnullGCPtr<ImageData>> CanvasRenderingContext2D::create_image_data(int width, int height) const
{
return ImageData::create_with_size(realm(), width, height);
return ImageData::create(realm(), width, height);
}
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-getimagedata
@ -392,7 +392,7 @@ WebIDL::ExceptionOr<JS::GCPtr<ImageData>> CanvasRenderingContext2D::get_image_da
// 3. Let imageData be a new ImageData object.
// 4. Initialize imageData given sw, sh, settings set to settings, and defaultColorSpace set to this's color space.
auto image_data = ImageData::create_with_size(realm(), width, height);
auto image_data = TRY(ImageData::create(realm(), width, height));
// NOTE: We don't attempt to create the underlying bitmap here; if it doesn't exist, it's like copying only transparent black pixels (which is a no-op).
if (!canvas_element().bitmap())