mirror of
https://github.com/rive-app/rive-cpp.git
synced 2026-01-18 21:21:17 +01:00
Set up http and websocket servers in deploy_tests.py that allow us to communicate with the remote wasm app similarly to how we communicate with android & ios devices. Add a "-w" target to check_golds.sh that kicks tests off in the default browser. Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
/*
|
|
* Copyright 2022 Rive
|
|
*/
|
|
|
|
#include "gm.hpp"
|
|
#include "gmutils.hpp"
|
|
#include "rive/renderer.hpp"
|
|
#include "common/rand.hpp"
|
|
|
|
using namespace rivegm;
|
|
using namespace rive;
|
|
|
|
constexpr int W = 1000;
|
|
constexpr int H = 400;
|
|
constexpr int N = 9999;
|
|
|
|
class VeryComplexGradGM : public GM
|
|
{
|
|
public:
|
|
VeryComplexGradGM() : GM(W, H) {}
|
|
|
|
ColorInt clearColor() const override { return 0xff000000; }
|
|
|
|
void onDraw(rive::Renderer* renderer) override
|
|
{
|
|
Rand rand;
|
|
std::vector<ColorInt> colors(N);
|
|
std::vector<float> stops(N);
|
|
for (size_t i = 0; i < N; ++i)
|
|
{
|
|
colors[i] = rand.u32() | 0xff808080;
|
|
stops[i] = std::round(rand.f32() * W) / W;
|
|
}
|
|
std::sort(stops.begin(), stops.end());
|
|
|
|
Paint paint;
|
|
paint->shader(
|
|
TestingWindow::Get()->factory()->makeLinearGradient(0,
|
|
0,
|
|
W,
|
|
0,
|
|
colors.data(),
|
|
stops.data(),
|
|
N));
|
|
|
|
Path fullscreen = PathBuilder().addRect({0, 0, W, H}).detach();
|
|
|
|
renderer->drawPath(fullscreen, paint);
|
|
}
|
|
};
|
|
|
|
GMREGISTER(verycomplexgrad, return new VeryComplexGradGM())
|