Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 479d270

Browse files
authored
Revert "Cherry picks for image decoding in Impeller (#42362)"
This reverts commit c47096f.
1 parent 186bf0f commit 479d270

18 files changed

+193
-381
lines changed

impeller/renderer/backend/metal/render_pass_mtl.mm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,13 +383,10 @@ static bool Bind(PassBindingsCache& pass,
383383
}
384384

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

395392
return pass.SetTexture(stage, bind_index,

lib/ui/fixtures/ui_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,12 @@ void createPath() {
248248
external void _validatePath(Path path);
249249

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

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

258258
@pragma('vm:entry-point')
259259
void platformMessagePortResponseTest() async {

lib/ui/painting.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,12 +2105,9 @@ class Codec extends NativeFieldWrapperClass1 {
21052105
/// [FrameInfo.image] on the returned object.
21062106
Future<FrameInfo> getNextFrame() async {
21072107
final Completer<FrameInfo> completer = Completer<FrameInfo>.sync();
2108-
final String? error = _getNextFrame((_Image? image, int durationMilliseconds, String decodeError) {
2108+
final String? error = _getNextFrame((_Image? image, int durationMilliseconds) {
21092109
if (image == null) {
2110-
if (decodeError.isEmpty) {
2111-
decodeError = 'Codec failed to produce an image, possibly due to invalid image data.';
2112-
}
2113-
completer.completeError(Exception(decodeError));
2110+
completer.completeError(Exception('Codec failed to produce an image, possibly due to invalid image data.'));
21142111
} else {
21152112
completer.complete(FrameInfo._(
21162113
image: Image._(image, image.width, image.height),
@@ -2126,7 +2123,7 @@ class Codec extends NativeFieldWrapperClass1 {
21262123

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

21312128
/// Release the resources used by this object. The object is no longer usable
21322129
/// after this method is called.

lib/ui/painting/image_decoder.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,14 @@ std::unique_ptr<ImageDecoder> ImageDecoder::Make(
1616
const Settings& settings,
1717
const TaskRunners& runners,
1818
std::shared_ptr<fml::ConcurrentTaskRunner> concurrent_task_runner,
19-
fml::WeakPtr<IOManager> io_manager,
20-
const std::shared_ptr<fml::SyncSwitch>& gpu_disabled_switch) {
19+
fml::WeakPtr<IOManager> io_manager) {
2120
#if IMPELLER_SUPPORTS_RENDERING
2221
if (settings.enable_impeller) {
2322
return std::make_unique<ImageDecoderImpeller>(
2423
runners, //
2524
std::move(concurrent_task_runner), //
2625
std::move(io_manager), //
27-
settings.enable_wide_gamut, //
28-
gpu_disabled_switch);
26+
settings.enable_wide_gamut);
2927
}
3028
#endif // IMPELLER_SUPPORTS_RENDERING
3129
return std::make_unique<ImageDecoderSkia>(

lib/ui/painting/image_decoder.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@ class ImageDecoder {
2727
const Settings& settings,
2828
const TaskRunners& runners,
2929
std::shared_ptr<fml::ConcurrentTaskRunner> concurrent_task_runner,
30-
fml::WeakPtr<IOManager> io_manager,
31-
const std::shared_ptr<fml::SyncSwitch>& gpu_disabled_switch);
30+
fml::WeakPtr<IOManager> io_manager);
3231

3332
virtual ~ImageDecoder();
3433

35-
using ImageResult = std::function<void(sk_sp<DlImage>, std::string)>;
34+
using ImageResult = std::function<void(sk_sp<DlImage>)>;
3635

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

0 commit comments

Comments
 (0)