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

Commit 8eb5909

Browse files
author
Jonah Williams
authored
[Impeller] remove image upload workarounds. (#47209)
Testing locally I cant see any impact from this. Its possible the problem this "fixed" was instead fixed by affinity changes and now its no longer necessary. See #43493 .
1 parent e2d006d commit 8eb5909

1 file changed

Lines changed: 3 additions & 43 deletions

File tree

lib/ui/painting/image_decoder_impeller.cc

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@
1010
#include "flutter/fml/make_copyable.h"
1111
#include "flutter/fml/trace_event.h"
1212
#include "flutter/impeller/core/allocator.h"
13-
#include "flutter/impeller/core/texture.h"
1413
#include "flutter/impeller/display_list/dl_image_impeller.h"
1514
#include "flutter/impeller/renderer/command_buffer.h"
1615
#include "flutter/impeller/renderer/context.h"
17-
#include "flutter/lib/ui/painting/image_decoder_skia.h"
1816
#include "impeller/base/strings.h"
1917
#include "impeller/display_list/skia_conversions.h"
2018
#include "impeller/geometry/size.h"
19+
2120
#include "third_party/skia/include/core/SkAlphaType.h"
2221
#include "third_party/skia/include/core/SkBitmap.h"
2322
#include "third_party/skia/include/core/SkColorSpace.h"
@@ -32,42 +31,6 @@
3231

3332
namespace flutter {
3433

35-
class MallocDeviceBuffer : public impeller::DeviceBuffer {
36-
public:
37-
explicit MallocDeviceBuffer(impeller::DeviceBufferDescriptor desc)
38-
: impeller::DeviceBuffer(desc) {
39-
data_ = static_cast<uint8_t*>(malloc(desc.size));
40-
}
41-
42-
~MallocDeviceBuffer() override { free(data_); }
43-
44-
bool SetLabel(const std::string& label) override { return true; }
45-
46-
bool SetLabel(const std::string& label, impeller::Range range) override {
47-
return true;
48-
}
49-
50-
uint8_t* OnGetContents() const override { return data_; }
51-
52-
bool OnCopyHostBuffer(const uint8_t* source,
53-
impeller::Range source_range,
54-
size_t offset) override {
55-
memcpy(data_ + offset, source + source_range.offset, source_range.length);
56-
return true;
57-
}
58-
59-
private:
60-
uint8_t* data_;
61-
62-
FML_DISALLOW_COPY_AND_ASSIGN(MallocDeviceBuffer);
63-
};
64-
65-
#ifdef FML_OS_ANDROID
66-
static constexpr bool kShouldUseMallocDeviceBuffer = true;
67-
#else
68-
static constexpr bool kShouldUseMallocDeviceBuffer = false;
69-
#endif // FML_OS_ANDROID
70-
7134
namespace {
7235
/**
7336
* Loads the gamut as a set of three points (triangle).
@@ -522,8 +485,7 @@ void ImageDecoderImpeller::Decode(fml::RefPtr<ImageDescriptor> descriptor,
522485
gpu_disabled_switch]() {
523486
sk_sp<DlImage> image;
524487
std::string decode_error;
525-
if (!kShouldUseMallocDeviceBuffer &&
526-
context->GetCapabilities()->SupportsBufferToTextureBlits()) {
488+
if (context->GetCapabilities()->SupportsBufferToTextureBlits()) {
527489
std::tie(image, decode_error) = UploadTextureToPrivate(
528490
context, bitmap_result.device_buffer, bitmap_result.image_info,
529491
bitmap_result.sk_bitmap, gpu_disabled_switch);
@@ -567,9 +529,7 @@ bool ImpellerAllocator::allocPixelRef(SkBitmap* bitmap) {
567529
(bitmap->width() * bitmap->bytesPerPixel());
568530

569531
std::shared_ptr<impeller::DeviceBuffer> device_buffer =
570-
kShouldUseMallocDeviceBuffer
571-
? std::make_shared<MallocDeviceBuffer>(descriptor)
572-
: allocator_->CreateBuffer(descriptor);
532+
allocator_->CreateBuffer(descriptor);
573533

574534
struct ImpellerPixelRef final : public SkPixelRef {
575535
ImpellerPixelRef(int w, int h, void* s, size_t r)

0 commit comments

Comments
 (0)