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

Commit fc4d0494 authored by Ana Krulec's avatar Ana Krulec Committed by Android (Google) Code Review
Browse files

Merge "Adding additional annotation to Skia Recorder"

parents a3f1edda 6eab17ad
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -154,6 +154,9 @@ struct LayerSettings {
    int backgroundBlurRadius = 0;

    std::vector<BlurRegion> blurRegions;

    // Name associated with the layer for debugging purposes.
    std::string name;
};

// Keep in sync with custom comparison function in
+22 −0
Original line number Diff line number Diff line
@@ -477,10 +477,23 @@ status_t SkiaGLRenderEngine::drawLayers(const DisplaySettings& display,
                                                                mGrContext.get());

    SkCanvas* canvas = mCapture.tryCapture(surface.get());
    if (canvas == nullptr) {
        ALOGE("Cannot acquire canvas from Skia.");
        return BAD_VALUE;
    }
    // Clear the entire canvas with a transparent black to prevent ghost images.
    canvas->clear(SK_ColorTRANSPARENT);
    canvas->save();

    if (mCapture.isCaptureRunning()) {
        // Record display settings when capture is running.
        std::stringstream displaySettings;
        PrintTo(display, &displaySettings);
        // Store the DisplaySettings in additional information.
        canvas->drawAnnotation(SkRect::MakeEmpty(), "DisplaySettings",
                               SkData::MakeWithCString(displaySettings.str().c_str()));
    }

    // Before doing any drawing, let's make sure that we'll start at the origin of the display.
    // Some displays don't start at 0,0 for example when we're mirroring the screen. Also, virtual
    // displays might have different scaling when compared to the physical screen.
@@ -511,6 +524,15 @@ status_t SkiaGLRenderEngine::drawLayers(const DisplaySettings& display,
    for (const auto& layer : layers) {
        canvas->save();

        if (mCapture.isCaptureRunning()) {
            // Record the name of the layer if the capture is running.
            std::stringstream layerSettings;
            PrintTo(*layer, &layerSettings);
            // Store the LayerSettings in additional information.
            canvas->drawAnnotation(SkRect::MakeEmpty(), layer->name.c_str(),
                                   SkData::MakeWithCString(layerSettings.str().c_str()));
        }

        // Layers have a local transform that should be applied to them
        canvas->concat(getSkM44(layer->geometry.positionTransform).asM33());

+2 −0
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ public:
    SkCanvas* tryCapture(SkSurface* surface);
    // Called at the end of every frame.
    void endCapture();
    // Returns whether the capture is running.
    bool isCaptureRunning() { return mCaptureRunning; }

private:
    // Performs the first-frame work of a multi frame SKP capture. Returns true if successful.
+2 −0
Original line number Diff line number Diff line
@@ -656,6 +656,8 @@ std::optional<compositionengine::LayerFE::LayerSettings> Layer::prepareClientCom
        layerSettings.backgroundBlurRadius = getBackgroundBlurRadius();
        layerSettings.blurRegions = getBlurRegions();
    }
    // Record the name of the layer for debugging further down the stack.
    layerSettings.name = getName();
    return layerSettings;
}