Image FilterMode broken ?

81 views
Skip to first unread message

Marouane MANAA

unread,
Oct 13, 2021, 10:32:22 AM10/13/21
to skia-d...@googlegroups.com
Hello,

I'm new to Skia and i'm trying to draw a simple image using linear filtering.

SkPaint paint;
paint.setAntiAlias(true);
SkSamplingOptions options(SkFilterMode::kLinear);
canvas->drawImage(image, 100, 100, {}, &paint);

When i trace the app using apitrace i can't locate any GL_LINEAR flag but only GL_NEAREST.

Does anyone have an idea about this.

Thank you all.

Greg Daniel

unread,
Oct 13, 2021, 10:42:58 AM10/13/21
to skia-discuss
If the image is aligned on pixel boundaries and no scaling is happening, we will drop down to just using NEAREST because it is equivalent to LINEAR. You can try translating where the image is drawn slightly to see if you now see the Linear.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/CALkdRMsbeYPyFBSGMMnhsa80UxdDY%2B%2BHGLmypKGGjSPyFw5v1w%40mail.gmail.com.

Brian Osman

unread,
Oct 13, 2021, 10:43:09 AM10/13/21
to skia-d...@googlegroups.com
It is possible that Skia is detecting the fact that you're drawing 1:1 (texels : pixels), and turning the linear filtering into nearest-neighbor. What happens if you call:

  canvas->scale(1.1, 1.1);

... before drawImage?

On Wed, Oct 13, 2021 at 10:32 AM Marouane MANAA <manaa.m...@gmail.com> wrote:
--

Marouane MANAA

unread,
Oct 13, 2021, 10:56:11 AM10/13/21
to skia-d...@googlegroups.com
After scaling, the texture filter is GL_LINEAR.

I need to draw more attention Skia smart moves :)

Thank you all.


Reply all
Reply to author
Forward
0 new messages