diff options
author | John Reck <jreck@google.com> | 2018-12-10 17:06:22 -0800 |
---|---|---|
committer | John Reck <jreck@google.com> | 2019-01-22 13:13:06 -0800 |
commit | 5cca8f250cd287d311b9e7b560a6c10fb909c6bc (patch) | |
tree | 4de1ddaf1ac87b697327ac65cf2daf85d04989b5 /libs/hwui/renderthread/RenderProxy.cpp | |
parent | 6f19cbdd2f285a7d54ce7694488e307bbe26bfc9 (diff) |
Add continuous SKP capture test api
Bug: 122856066
Test: PictureCaptureDemo
Change-Id: Iaf3a4bc1c8a2c18c7dff635c5f1cf726b331f8bf
Diffstat (limited to 'libs/hwui/renderthread/RenderProxy.cpp')
-rw-r--r-- | libs/hwui/renderthread/RenderProxy.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp index aa6af23d8ed3..ab59af71d344 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -21,6 +21,7 @@ #include "Properties.h" #include "Readback.h" #include "Rect.h" +#include "WebViewFunctorManager.h" #include "pipeline/skia/SkiaOpenGLPipeline.h" #include "pipeline/skia/VectorDrawableAtlas.h" #include "renderstate/RenderState.h" @@ -30,7 +31,6 @@ #include "renderthread/RenderThread.h" #include "utils/Macros.h" #include "utils/TimeUtils.h" -#include "WebViewFunctorManager.h" #include <ui/GraphicBuffer.h> @@ -147,9 +147,7 @@ void RenderProxy::invokeFunctor(Functor* functor, bool waitForCompletion) { void RenderProxy::destroyFunctor(int functor) { ATRACE_CALL(); RenderThread& thread = RenderThread::getInstance(); - thread.queue().post([=]() { - WebViewFunctorManager::instance().destroyFunctor(functor); - }); + thread.queue().post([=]() { WebViewFunctorManager::instance().destroyFunctor(functor); }); } DeferredLayerUpdater* RenderProxy::createTextureLayer() { @@ -164,9 +162,9 @@ void RenderProxy::buildLayer(RenderNode* node) { bool RenderProxy::copyLayerInto(DeferredLayerUpdater* layer, SkBitmap& bitmap) { auto& thread = RenderThread::getInstance(); - return thread.queue().runSync( - [&]() -> bool { return thread.readback().copyLayerInto(layer, &bitmap) - == CopyResult::Success; }); + return thread.queue().runSync([&]() -> bool { + return thread.readback().copyLayerInto(layer, &bitmap) == CopyResult::Success; + }); } void RenderProxy::pushLayerUpdate(DeferredLayerUpdater* layer) { @@ -204,9 +202,8 @@ void RenderProxy::fence() { } int RenderProxy::maxTextureSize() { - static int maxTextureSize = RenderThread::getInstance().queue().runSync([]() { - return DeviceInfo::get()->maxTextureSize(); - }); + static int maxTextureSize = RenderThread::getInstance().queue().runSync( + []() { return DeviceInfo::get()->maxTextureSize(); }); return maxTextureSize; } @@ -281,6 +278,12 @@ void RenderProxy::setContentDrawBounds(int left, int top, int right, int bottom) mDrawFrameTask.setContentDrawBounds(left, top, right, bottom); } +void RenderProxy::setPictureCapturedCallback( + const std::function<void(sk_sp<SkPicture>&&)>& callback) { + mRenderThread.queue().post( + [ this, cb = callback ]() { mContext->setPictureCapturedCallback(cb); }); +} + void RenderProxy::setFrameCallback(std::function<void(int64_t)>&& callback) { mDrawFrameTask.setFrameCallback(std::move(callback)); } @@ -302,9 +305,7 @@ void RenderProxy::removeFrameMetricsObserver(FrameMetricsObserver* observerPtr) } void RenderProxy::setForceDark(bool enable) { - mRenderThread.queue().post([this, enable]() { - mContext->setForceDark(enable); - }); + mRenderThread.queue().post([this, enable]() { mContext->setForceDark(enable); }); } int RenderProxy::copySurfaceInto(sp<Surface>& surface, int left, int top, int right, int bottom, @@ -348,9 +349,8 @@ int RenderProxy::copyHWBitmapInto(Bitmap* hwBitmap, SkBitmap* bitmap) { // TODO: fix everything that hits this. We should never be triggering a readback ourselves. return (int)thread.readback().copyHWBitmapInto(hwBitmap, bitmap); } else { - return thread.queue().runSync([&]() -> int { - return (int)thread.readback().copyHWBitmapInto(hwBitmap, bitmap); - }); + return thread.queue().runSync( + [&]() -> int { return (int)thread.readback().copyHWBitmapInto(hwBitmap, bitmap); }); } } |