Implement Skia pipelines for OpenGL and Vulkan.
Implement Skia pipelines for OpenGL and Vulkan:
base SkiaPipeline, SkiaOpenGLPipeline and SkiaVulkanPipeline.
Write unit tests for SkiaPipeline.
Test: Built and run manually on angler-eng.
Change-Id: Ie02583426cb3547541ad9bf91700602a6163ff58
diff --git a/libs/hwui/tests/common/TestUtils.h b/libs/hwui/tests/common/TestUtils.h
index 0be5a3b..0ce598d 100644
--- a/libs/hwui/tests/common/TestUtils.h
+++ b/libs/hwui/tests/common/TestUtils.h
@@ -22,6 +22,7 @@
#include <Rect.h>
#include <RenderNode.h>
#include <hwui/Bitmap.h>
+#include <pipeline/skia/SkiaRecordingCanvas.h>
#include <renderstate/RenderState.h>
#include <renderthread/RenderThread.h>
#include <Snapshot.h>
@@ -196,6 +197,35 @@
node.setStagingDisplayList(canvas->finishRecording(), nullptr);
}
+ static sp<RenderNode> createSkiaNode(int left, int top, int right, int bottom,
+ 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);
+ }
+ RenderProperties& props = node->mutateStagingProperties();
+ props.setLeftTopRightBottom(left, top, right, bottom);
+ if (displayList) {
+ node->setStagingDisplayList(displayList, nullptr);
+ }
+ if (setup) {
+ std::unique_ptr<skiapipeline::SkiaRecordingCanvas> canvas(
+ new skiapipeline::SkiaRecordingCanvas(nullptr,
+ props.getWidth(), props.getHeight()));
+ setup(props, *canvas.get());
+ node->setStagingDisplayList(canvas->finishRecording(), nullptr);
+ }
+ node->setPropertyFieldsDirty(0xFFFFFFFF);
+ TestUtils::syncHierarchyPropertiesAndDisplayList(node);
+ return node;
+ }
+
/**
* Forces a sync of a tree of RenderNode, such that every descendant will have its staging
* properties and DisplayList moved to the render copies.