diff options
Diffstat (limited to 'libs/hwui/tests/common/TestUtils.h')
-rw-r--r-- | libs/hwui/tests/common/TestUtils.h | 75 |
1 files changed, 5 insertions, 70 deletions
diff --git a/libs/hwui/tests/common/TestUtils.h b/libs/hwui/tests/common/TestUtils.h index 2752ae9a8036..c5db861d4f48 100644 --- a/libs/hwui/tests/common/TestUtils.h +++ b/libs/hwui/tests/common/TestUtils.h @@ -16,21 +16,17 @@ #pragma once -#include <DeviceInfo.h> #include <DisplayList.h> #include <Matrix.h> #include <Properties.h> #include <Rect.h> #include <RenderNode.h> -#include <Snapshot.h> #include <hwui/Bitmap.h> #include <pipeline/skia/SkiaRecordingCanvas.h> +#include <private/hwui/DrawGlInfo.h> #include <renderstate/RenderState.h> #include <renderthread/RenderThread.h> -#include <RecordedOp.h> -#include <RecordingCanvas.h> - #include <memory> namespace android { @@ -60,18 +56,6 @@ namespace uirenderer { Properties::overrideRenderPipelineType(oldType); \ }; -/** - * Like gtests' TEST, but only runs with the OpenGL RenderPipelineType - */ -#define OPENGL_PIPELINE_TEST(test_case_name, test_name) \ - class test_case_name##_##test_name##_HwuiTest { \ - public: \ - static void doTheThing(); \ - }; \ - INNER_PIPELINE_TEST(test_case_name, test_name, OpenGL, \ - test_case_name##_##test_name##_HwuiTest::doTheThing()) \ - void test_case_name##_##test_name##_HwuiTest::doTheThing() - #define INNER_PIPELINE_RENDERTHREAD_TEST(test_case_name, test_name, pipeline) \ INNER_PIPELINE_TEST(test_case_name, test_name, pipeline, \ TestUtils::runOnRenderThread( \ @@ -86,7 +70,6 @@ namespace uirenderer { public: \ static void doTheThing(renderthread::RenderThread& renderThread); \ }; \ - INNER_PIPELINE_RENDERTHREAD_TEST(test_case_name, test_name, OpenGL); \ INNER_PIPELINE_RENDERTHREAD_TEST(test_case_name, test_name, SkiaGL); \ /* Temporarily disabling Vulkan until we can figure out a way to stub out the driver */ \ /* INNER_PIPELINE_RENDERTHREAD_TEST(test_case_name, test_name, SkiaVulkan); */ \ @@ -94,18 +77,6 @@ namespace uirenderer { renderthread::RenderThread& renderThread) /** - * Like RENDERTHREAD_TEST, but only runs with the OpenGL RenderPipelineType - */ -#define RENDERTHREAD_OPENGL_PIPELINE_TEST(test_case_name, test_name) \ - class test_case_name##_##test_name##_RenderThreadTest { \ - public: \ - static void doTheThing(renderthread::RenderThread& renderThread); \ - }; \ - INNER_PIPELINE_RENDERTHREAD_TEST(test_case_name, test_name, OpenGL); \ - void test_case_name##_##test_name##_RenderThreadTest::doTheThing( \ - renderthread::RenderThread& renderThread) - -/** * Like RENDERTHREAD_TEST, but only runs with the Skia RenderPipelineTypes */ #define RENDERTHREAD_SKIA_PIPELINE_TEST(test_case_name, test_name) \ @@ -169,14 +140,6 @@ public: return true; } - static std::unique_ptr<Snapshot> makeSnapshot(const Matrix4& transform, const Rect& clip) { - std::unique_ptr<Snapshot> snapshot(new Snapshot()); - // store clip first, so it isn't transformed - snapshot->setClip(clip.left, clip.top, clip.right, clip.bottom); - *(snapshot->transform) = transform; - return snapshot; - } - static sk_sp<Bitmap> createBitmap(int width, int height, SkColorType colorType = kN32_SkColorType) { SkImageInfo info = SkImageInfo::Make(width, height, colorType, kPremul_SkAlphaType); @@ -207,12 +170,6 @@ public: static sp<RenderNode> createNode( int left, int top, int right, int bottom, std::function<void(RenderProperties& props, Canvas& canvas)> setup) { -#if HWUI_NULL_GPU - // if RenderNodes are being sync'd/used, device info will be needed, since - // DeviceInfo::maxTextureSize() affects layer property - DeviceInfo::initialize(); -#endif - sp<RenderNode> node = new RenderNode(); RenderProperties& props = node->mutateStagingProperties(); props.setLeftTopRightBottom(left, top, right, bottom); @@ -230,12 +187,6 @@ public: static sp<RenderNode> createNode( int left, int top, int right, int bottom, std::function<void(RenderProperties& props, RecordingCanvasType& canvas)> setup) { -#if HWUI_NULL_GPU - // if RenderNodes are being sync'd/used, device info will be needed, since - // DeviceInfo::maxTextureSize() affects layer property - DeviceInfo::initialize(); -#endif - sp<RenderNode> node = new RenderNode(); RenderProperties& props = node->mutateStagingProperties(); props.setLeftTopRightBottom(left, top, right, bottom); @@ -261,11 +212,6 @@ public: std::function<void(RenderProperties& props, skiapipeline::SkiaRecordingCanvas& canvas)> setup, const char* name = nullptr, skiapipeline::SkiaDisplayList* displayList = nullptr) { -#if HWUI_NULL_GPU - // if RenderNodes are being sync'd/used, device info will be needed, since - // DeviceInfo::maxTextureSize() affects layer property - DeviceInfo::initialize(); -#endif sp<RenderNode> node = new RenderNode(); if (name) { node->setName(name); @@ -325,11 +271,6 @@ public: static SkColor interpolateColor(float fraction, SkColor start, SkColor end); - static void layoutTextUnscaled(const SkPaint& paint, const char* text, - std::vector<glyph_t>* outGlyphs, - std::vector<float>* outPositions, float* outTotalAdvance, - Rect* outBounds); - static void drawUtf8ToCanvas(Canvas* canvas, const char* text, const SkPaint& paint, float x, float y); @@ -365,16 +306,10 @@ private: } auto displayList = node->getDisplayList(); if (displayList) { - if (displayList->isSkiaDL()) { - for (auto&& childDr : static_cast<skiapipeline::SkiaDisplayList*>( - const_cast<DisplayList*>(displayList)) - ->mChildNodes) { - syncHierarchyPropertiesAndDisplayListImpl(childDr.getRenderNode()); - } - } else { - for (auto&& childOp : displayList->getChildren()) { - syncHierarchyPropertiesAndDisplayListImpl(childOp->renderNode); - } + for (auto&& childDr : static_cast<skiapipeline::SkiaDisplayList*>( + const_cast<DisplayList*>(displayList)) + ->mChildNodes) { + syncHierarchyPropertiesAndDisplayListImpl(childDr.getRenderNode()); } } } |