skia2/tools/viewer/SkSLSlide.h
Brian Osman 90263a14b5 Revert "Spruce up SkSL slide with a much nicer editor"
This reverts commit 88c5af7ecd.

Reason for revert: Various input bugs in the new editor make it somewhat unusable.

Original change's description:
> Spruce up SkSL slide with a much nicer editor
>
> Pulls in a new GitHub repo that implements a syntax-highlighting code
> editor ImGui widget.
>
> Change-Id: I968e5eb827c226259eaaad2996eeaad9de592e37
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491444
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

Change-Id: Ifa5bc87327785d107956201c4d866c7259006ec2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492359
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-01-07 15:56:16 +00:00

62 lines
1.5 KiB
C++

/*
* Copyright 2019 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkSLSlide_DEFINED
#define SkSLSlide_DEFINED
#include "include/core/SkM44.h"
#include "include/effects/SkRuntimeEffect.h"
#include "tools/viewer/Slide.h"
class SkSLSlide : public Slide {
public:
SkSLSlide();
// TODO: We need a way for primarily interactive slides to always be as large as the window
SkISize getDimensions() const override { return SkISize::MakeEmpty(); }
void draw(SkCanvas* canvas) override;
bool animate(double nanos) override;
void resize(SkScalar winWidth, SkScalar winHeight) override {
fResolution = { winWidth, winHeight, 1.0f };
}
void load(SkScalar winWidth, SkScalar winHeight) override;
void unload() override;
bool onMouse(SkScalar x, SkScalar y, skui::InputState state,
skui::ModifierKey modifiers) override { return true; }
private:
bool rebuild();
SkString fSkSL;
bool fCodeIsDirty;
sk_sp<SkRuntimeEffect> fEffect;
SkAutoTMalloc<char> fInputs;
SkTArray<sk_sp<SkShader>> fChildren;
float fSeconds = 0.0f;
enum Geometry {
kFill,
kCircle,
kRoundRect,
kCapsule,
kText,
};
int fGeometry = kFill;
SkV3 fResolution = { 1, 1, 1 };
SkV4 fMousePos;
int fTraceCoord[2] = {64, 64};
bool fShadertoyUniforms = true;
// Named shaders that can be selected as inputs
SkTArray<std::pair<const char*, sk_sp<SkShader>>> fShaders;
};
#endif