Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions impeller/renderer/backend/metal/render_pass_mtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,13 @@ static bool Bind(PassBindingsCache& pass,
}

if (texture.NeedsMipmapGeneration()) {
// TODO(127697): generate mips when the GPU is available on iOS.
#if !FML_OS_IOS
VALIDATION_LOG
<< "Texture at binding index " << bind_index
<< " has a mip count > 1, but the mipmap has not been generated.";
return false;
#endif // !FML_OS_IOS
}

return pass.SetTexture(stage, bind_index,
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/fixtures/ui_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,12 @@ void createPath() {
external void _validatePath(Path path);

@pragma('vm:entry-point')
void frameCallback(Object? image, int durationMilliseconds) {
validateFrameCallback(image, durationMilliseconds);
void frameCallback(Object? image, int durationMilliseconds, String decodeError) {
validateFrameCallback(image, durationMilliseconds, decodeError);
}

@pragma('vm:external-name', 'ValidateFrameCallback')
external void validateFrameCallback(Object? image, int durationMilliseconds);
external void validateFrameCallback(Object? image, int durationMilliseconds, String decodeError);

@pragma('vm:entry-point')
void platformMessagePortResponseTest() async {
Expand Down
9 changes: 6 additions & 3 deletions lib/ui/painting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2105,9 +2105,12 @@ class Codec extends NativeFieldWrapperClass1 {
/// [FrameInfo.image] on the returned object.
Future<FrameInfo> getNextFrame() async {
final Completer<FrameInfo> completer = Completer<FrameInfo>.sync();
final String? error = _getNextFrame((_Image? image, int durationMilliseconds) {
final String? error = _getNextFrame((_Image? image, int durationMilliseconds, String decodeError) {
if (image == null) {
completer.completeError(Exception('Codec failed to produce an image, possibly due to invalid image data.'));
if (decodeError.isEmpty) {
decodeError = 'Codec failed to produce an image, possibly due to invalid image data.';
}
completer.completeError(Exception(decodeError));
} else {
completer.complete(FrameInfo._(
image: Image._(image, image.width, image.height),
Expand All @@ -2123,7 +2126,7 @@ class Codec extends NativeFieldWrapperClass1 {

/// Returns an error message on failure, null on success.
@Native<Handle Function(Pointer<Void>, Handle)>(symbol: 'Codec::getNextFrame')
external String? _getNextFrame(void Function(_Image?, int) callback);
external String? _getNextFrame(void Function(_Image?, int, String) callback);

/// Release the resources used by this object. The object is no longer usable
/// after this method is called.
Expand Down
6 changes: 4 additions & 2 deletions lib/ui/painting/image_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ std::unique_ptr<ImageDecoder> ImageDecoder::Make(
const Settings& settings,
const TaskRunners& runners,
std::shared_ptr<fml::ConcurrentTaskRunner> concurrent_task_runner,
fml::WeakPtr<IOManager> io_manager) {
fml::WeakPtr<IOManager> io_manager,
const std::shared_ptr<fml::SyncSwitch>& gpu_disabled_switch) {
#if IMPELLER_SUPPORTS_RENDERING
if (settings.enable_impeller) {
return std::make_unique<ImageDecoderImpeller>(
runners, //
std::move(concurrent_task_runner), //
std::move(io_manager), //
settings.enable_wide_gamut);
settings.enable_wide_gamut, //
gpu_disabled_switch);
}
#endif // IMPELLER_SUPPORTS_RENDERING
return std::make_unique<ImageDecoderSkia>(
Expand Down
5 changes: 3 additions & 2 deletions lib/ui/painting/image_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ class ImageDecoder {
const Settings& settings,
const TaskRunners& runners,
std::shared_ptr<fml::ConcurrentTaskRunner> concurrent_task_runner,
fml::WeakPtr<IOManager> io_manager);
fml::WeakPtr<IOManager> io_manager,
const std::shared_ptr<fml::SyncSwitch>& gpu_disabled_switch);

virtual ~ImageDecoder();

using ImageResult = std::function<void(sk_sp<DlImage>)>;
using ImageResult = std::function<void(sk_sp<DlImage>, std::string)>;

// Takes an image descriptor and returns a handle to a texture resident on the
// GPU. All image decompression and resizes are done on a worker thread
Expand Down
Loading