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

Commit 00bec72f authored by Kevin Lubick's avatar Kevin Lubick
Browse files

[native] Migrate SkSurface creation to SkSurfaces factories

Follow-up to http://review.skia.org/687639

Change-Id: I1cf13748fa8d15b1370cebe3b13d4c8bd5b61293
parent b37a8981
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@

#include <SkImage.h>
#include <include/gpu/ganesh/SkImageGanesh.h>
#include <include/gpu/ganesh/SkSurfaceGanesh.h>

#include "ColorSpaces.h"
#include "log/log_main.h"
@@ -137,7 +138,7 @@ sk_sp<SkSurface> AutoBackendTexture::getOrCreateSurface(ui::Dataspace dataspace,
    LOG_ALWAYS_FATAL_IF(!mIsOutputBuffer, "You can't generate a SkSurface for a read-only texture");
    if (!mSurface.get() || mDataspace != dataspace) {
        sk_sp<SkSurface> surface =
                SkSurface::MakeFromBackendTexture(context, mBackendTexture,
                SkSurfaces::WrapBackendTexture(context, mBackendTexture,
                                               kTopLeft_GrSurfaceOrigin, 0, mColorType,
                                               toSkColorSpace(dataspace), nullptr,
                                               releaseSurfaceProc, this);
+3 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <SkSize.h>
#include <SkString.h>
#include <SkSurface.h>
#include <include/gpu/ganesh/SkSurfaceGanesh.h>
#include "include/gpu/GpuTypes.h" // from Skia
#include <log/log.h>
#include <utils/Trace.h>
@@ -45,7 +46,7 @@ sk_sp<SkImage> GaussianBlurFilter::generate(GrRecordingContext* context, const u
    // Create blur surface with the bit depth and colorspace of the original surface
    SkImageInfo scaledInfo = input->imageInfo().makeWH(std::ceil(blurRect.width() * kInputScale),
                                                       std::ceil(blurRect.height() * kInputScale));
    sk_sp<SkSurface> surface = SkSurface::MakeRenderTarget(context,
    sk_sp<SkSurface> surface = SkSurfaces::RenderTarget(context,
                                                        skgpu::Budgeted::kNo, scaledInfo);

    SkPaint paint;
+2 −1
Original line number Diff line number Diff line
@@ -148,7 +148,8 @@ auto RefreshRateOverlay::SevenSegmentDrawer::draw(int displayFps, int renderFps,
        LOG_ALWAYS_FATAL_IF(bufferStatus != OK, "RefreshRateOverlay: Buffer failed to allocate: %d",
                            bufferStatus);

        sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(bufferWidth, bufferHeight);
        sk_sp<SkSurface> surface = SkSurfaces::Raster(
                SkImageInfo::MakeN32Premul(bufferWidth, bufferHeight));
        SkCanvas* canvas = surface->getCanvas();
        canvas->setMatrix(canvasTransform);