cache whole luma color filter
We're caching the runtime effect, but luma filter has no uniforms, so we can cache the whole filter. Change-Id: I7c4b37a35928b9bc804e921f99bb1eccaf13e7a5 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372294 Commit-Queue: Brian Osman <brianosman@google.com> Auto-Submit: Mike Klein <mtklein@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
a50940da6d
commit
a8448470e8
@ -10,7 +10,7 @@
|
||||
#include "include/effects/SkRuntimeEffect.h"
|
||||
|
||||
sk_sp<SkColorFilter> SkLumaColorFilter::Make() {
|
||||
static SkRuntimeEffect* effect = []{
|
||||
static SkColorFilter* filter = []{
|
||||
const char* code =
|
||||
"uniform shader input;"
|
||||
"half4 main() {"
|
||||
@ -18,9 +18,9 @@ sk_sp<SkColorFilter> SkLumaColorFilter::Make() {
|
||||
"}";
|
||||
auto [effect, err] = SkRuntimeEffect::Make(SkString{code}, SkRuntimeEffect::Options{});
|
||||
SkASSERT(effect && err.isEmpty());
|
||||
return effect.release();
|
||||
}();
|
||||
|
||||
sk_sp<SkColorFilter> input = nullptr;
|
||||
return effect->makeColorFilter(SkData::MakeEmpty(), &input, 1);
|
||||
return effect->makeColorFilter(SkData::MakeEmpty(), &input, 1).release();
|
||||
}();
|
||||
return sk_ref_sp(filter);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user