remove overdrawcolorfilter_runtime
SkOverdrawColorFilter is already implemented in an identical way to overdrawcolorfilter_runtime, so it's kind of just testing two copies of the same thing. Change-Id: I8d3b28649ae1c686633ba8e8e1017e8dc5100b3d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308192 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
2bc83187bf
commit
0abd7276b8
@ -17,26 +17,6 @@
|
|||||||
#include "include/core/SkString.h"
|
#include "include/core/SkString.h"
|
||||||
#include "include/core/SkTypes.h"
|
#include "include/core/SkTypes.h"
|
||||||
#include "include/effects/SkOverdrawColorFilter.h"
|
#include "include/effects/SkOverdrawColorFilter.h"
|
||||||
#include "include/effects/SkRuntimeEffect.h"
|
|
||||||
|
|
||||||
static const char* code = R"(
|
|
||||||
uniform half4 color0;
|
|
||||||
uniform half4 color1;
|
|
||||||
uniform half4 color2;
|
|
||||||
uniform half4 color3;
|
|
||||||
uniform half4 color4;
|
|
||||||
uniform half4 color5;
|
|
||||||
|
|
||||||
void main(inout half4 color) {
|
|
||||||
half alpha = 255.0 * color.a;
|
|
||||||
color = alpha < 0.5 ? color0
|
|
||||||
: alpha < 1.5 ? color1
|
|
||||||
: alpha < 2.5 ? color2
|
|
||||||
: alpha < 3.5 ? color3
|
|
||||||
: alpha < 4.5 ? color4
|
|
||||||
: color5;
|
|
||||||
}
|
|
||||||
)";
|
|
||||||
|
|
||||||
static inline void set_bitmap(SkBitmap* bitmap, uint8_t alpha) {
|
static inline void set_bitmap(SkBitmap* bitmap, uint8_t alpha) {
|
||||||
for (int y = 0; y < bitmap->height(); y++) {
|
for (int y = 0; y < bitmap->height(); y++) {
|
||||||
@ -50,13 +30,8 @@ static inline void set_bitmap(SkBitmap* bitmap, uint8_t alpha) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct OverdrawColorFilter : public skiagm::GM {
|
struct OverdrawColorFilter : public skiagm::GM {
|
||||||
bool fRuntime;
|
|
||||||
|
|
||||||
OverdrawColorFilter(bool runtime) : fRuntime(runtime) {}
|
|
||||||
|
|
||||||
SkString onShortName() override {
|
SkString onShortName() override {
|
||||||
return SkString{fRuntime ? "overdrawcolorfilter_runtime"
|
return SkString{"overdrawcolorfilter"};
|
||||||
: "overdrawcolorfilter"};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SkISize onISize() override { return {200, 400}; }
|
SkISize onISize() override { return {200, 400}; }
|
||||||
@ -67,25 +42,7 @@ struct OverdrawColorFilter : public skiagm::GM {
|
|||||||
};
|
};
|
||||||
|
|
||||||
SkPaint paint;
|
SkPaint paint;
|
||||||
if (fRuntime) {
|
paint.setColorFilter(SkOverdrawColorFilter::MakeWithSkColors(colors));
|
||||||
auto [effect, err] = SkRuntimeEffect::Make(SkString{code});
|
|
||||||
if (effect) {
|
|
||||||
|
|
||||||
SkRGBA4f<kPremul_SkAlphaType> uniforms[SK_ARRAY_COUNT(colors)];
|
|
||||||
for (int i = 0; i < (int)SK_ARRAY_COUNT(colors); i++) {
|
|
||||||
uniforms[i] = SkColor4f::FromColor(colors[i]).premul();
|
|
||||||
}
|
|
||||||
|
|
||||||
paint.setColorFilter(
|
|
||||||
effect->makeColorFilter(SkData::MakeWithCopy(uniforms, sizeof(uniforms))));
|
|
||||||
} else {
|
|
||||||
SkDebugf("SkRuntimeEffect error: %s\n", err.c_str());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
paint.setColorFilter(SkOverdrawColorFilter::MakeWithSkColors(colors));
|
|
||||||
}
|
|
||||||
|
|
||||||
SkASSERT(paint.getColorFilter());
|
|
||||||
|
|
||||||
SkImageInfo info = SkImageInfo::MakeA8(100, 100);
|
SkImageInfo info = SkImageInfo::MakeA8(100, 100);
|
||||||
SkBitmap bitmap;
|
SkBitmap bitmap;
|
||||||
@ -107,5 +64,4 @@ struct OverdrawColorFilter : public skiagm::GM {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
DEF_GM(return new OverdrawColorFilter(false);)
|
DEF_GM(return new OverdrawColorFilter;)
|
||||||
DEF_GM(return new OverdrawColorFilter( true);)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user