Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d24154d authored by John Reck's avatar John Reck Committed by Android (Google) Code Review
Browse files

Merge "Fix issue preventing launcher from unblocking UI thread" into main

parents cbf158df a3a0c9d2
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
 */

#include "SkiaRecordingCanvas.h"
#include "hwui/Paint.h"

#include <SkBlendMode.h>
#include <SkData.h>
#include <SkDrawable.h>
@@ -24,12 +24,15 @@
#include <SkMatrix.h>
#include <SkPaint.h>
#include <SkPoint.h>
#include <SkRRect.h>
#include <SkRect.h>
#include <SkRefCnt.h>
#include <SkRRect.h>
#include <SkSamplingOptions.h>
#include <SkTypes.h>
#include <src/image/SkImage_Base.h>

#include "CanvasTransform.h"
#include "hwui/Paint.h"
#ifdef __ANDROID__ // Layoutlib does not support Layers
#include "Layer.h"
#include "LayerDrawable.h"
@@ -243,9 +246,17 @@ void SkiaRecordingCanvas::onFilterPaint(android::Paint& paint) {
    //  It's better than nothing, though
    SkImage* image = shader ? shader->isAImage(nullptr, nullptr) : nullptr;
    if (image) {
        // This could be a hardware bitmap, in which case the type will be kLazy and attempting
        // to pin the image will fail. This will incorrectly block us from releasing the UI
        // thread, hurting performance.
        // Inspect the type directly to handle this, as we know that if it's not kRasterPinnable
        // then it isn't a mutable bitmap.
        auto ib = as_IB(image);
        if (ib->type() == SkImage_Base::Type::kRasterPinnable) {
            mDisplayList->mMutableImages.push_back(image);
        }
    }
}

void SkiaRecordingCanvas::drawBitmap(Bitmap& bitmap, float left, float top, const Paint* paint) {
    auto payload = DrawImagePayload(bitmap);