Commit 9333abd0 authored by Skia_Android Canary Bot's avatar Skia_Android Canary Bot
Browse files

Merge "skiaserve now retains the graphics context rather than creating a new...

Merge "skiaserve now retains the graphics context rather than creating a new one each request GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1693893002" into master-skia

https://skia.googlesource.com/skia/+/de8e54ccfd54db927b53cb86213ed7020a59d1e1

Change-Id: I7f9c455540f18271540ff2ecd1ddbb48bc764322
parents 4355c9c0 de8e54cc
###############################################################################
#
# THIS FILE IS AUTOGENERATED BY GYP_TO_ANDROID.PY. DO NOT EDIT.
#
# For bugs, please contact scroggo@google.com or djsollen@google.com
#
###############################################################################
###############################################################################
#
# This file contains the shared and static dependencies needed by any target
# that attempts to statically link Skia (i.e. libskia_static build target).
#
# This is a workaround for the fact that the build system does not add these
# transitive dependencies when it attempts to link libskia_static into another
# library.
#
###############################################################################
LOCAL_SHARED_LIBRARIES += \
liblog \
libGLESv2 \
libEGL \
libz \
libexpat \
libjpeg \
libpng \
libicuuc \
libicui18n \
libft2 \
libdng_sdk \
libpiex
LOCAL_STATIC_LIBRARIES += \
libgif \
libwebp-decode \
libwebp-encode \
libsfntly
......@@ -70,6 +70,8 @@ struct Request {
UploadContext* fUploadContext;
SkAutoTUnref<SkPicture> fPicture;
SkAutoTUnref<SkDebugCanvas> fDebugCanvas;
SkAutoTDelete<GrContextFactory> fContextFactory;
SkAutoTUnref<SkSurface> fSurface;
UrlDataManager fUrlDataManager;
};
......@@ -87,9 +89,6 @@ SkSurface* setupSurface(GrContextFactory* factory) {
&props);
SkASSERT(surface);
SkGLContext* gl = factory->getContextInfo(GrContextFactory::kNative_GLContextType,
GrContextFactory::kNone_GLContextOptions).fGLContext;
gl->makeCurrent();
return surface;
}
......@@ -112,15 +111,15 @@ SkData* writeCanvasToPng(SkCanvas* canvas) {
return png;
}
SkData* setupAndDrawToCanvasReturnPng(SkDebugCanvas* debugCanvas, int n) {
GrContextOptions grContextOpts;
SkAutoTDelete<GrContextFactory> factory(new GrContextFactory(grContextOpts));
SkAutoTUnref<SkSurface> surface(setupSurface(factory.get()));
SkASSERT(debugCanvas);
SkCanvas* canvas = surface->getCanvas();
debugCanvas->drawTo(canvas, n);
return writeCanvasToPng(canvas);
SkData* setupAndDrawToCanvasReturnPng(Request* request, int n) {
GrContextFactory* factory = request->fContextFactory;
SkGLContext* gl = factory->getContextInfo(GrContextFactory::kNative_GLContextType,
GrContextFactory::kNone_GLContextOptions).fGLContext;
gl->makeCurrent();
SkASSERT(request->fDebugCanvas);
SkCanvas* target = request->fSurface->getCanvas();
request->fDebugCanvas->drawTo(target, n);
return writeCanvasToPng(target);
}
SkSurface* setupCpuSurface() {
......@@ -287,7 +286,7 @@ public:
sscanf(commands[1].c_str(), "%d", &n);
}
SkAutoTUnref<SkData> data(setupAndDrawToCanvasReturnPng(request->fDebugCanvas, n));
SkAutoTUnref<SkData> data(setupAndDrawToCanvasReturnPng(request, n));
return SendData(connection, data, "image/png");
}
};
......@@ -337,6 +336,11 @@ public:
return MHD_NO;
}
// create surface
GrContextOptions grContextOpts;
request->fContextFactory.reset(new GrContextFactory(grContextOpts));
request->fSurface.reset(setupSurface(request->fContextFactory.get()));
// pour picture into debug canvas
request->fDebugCanvas.reset(new SkDebugCanvas(kImageWidth, kImageHeight));
request->fDebugCanvas->drawPicture(request->fPicture);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment