Project: skia Issues People Development process History Sign in
New issue
Advanced search Search tips
Issue 1959 SkBitmapSource returning 565 config?
Starred by 5 users Project Member Reported by reed@google.com, Jan 2 2014 Back to list
Status: Accepted
Owner:
Cc:
Area: Bitmap
Priority: Medium
Type: Defect



Sign in to add a comment
Running the fuzzer slide in SampleApp, I'm hitting an assert inside MagnifyImageFilter, complaining that the src-config is not 8888. Looking up the stack, it appears that SkBitmapSource is returning an 565 config into the d.a.g. Is this supported/correct?

#0	0x003d9bc5 in SkMagnifierImageFilter::onFilterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/effects/SkMagnifierImageFilter.cpp:284
#1	0x00283d22 in SkImageFilter::filterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/core/SkImageFilter.cpp:104
#2	0x003a1c97 in SkBlurImageFilter::onFilterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/effects/SkBlurImageFilter.cpp:140
#3	0x00283d22 in SkImageFilter::filterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/core/SkImageFilter.cpp:104
#4	0x003ca12e in (anonymous namespace)::SkSpecularLightingImageFilter::onFilterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/effects/SkLightingImageFilter.cpp:1021
#5	0x00283d22 in SkImageFilter::filterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/core/SkImageFilter.cpp:104
#6	0x003b7f66 in SkDisplacementMapEffect::onFilterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/effects/SkDisplacementMapEffect.cpp:190
#7	0x00283d22 in SkImageFilter::filterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/core/SkImageFilter.cpp:104
#8	0x003e242d in SkMergeImageFilter::onFilterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/effects/SkMergeImageFilter.cpp:129
#9	0x00283d22 in SkImageFilter::filterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/core/SkImageFilter.cpp:104
#10	0x003b7f66 in SkDisplacementMapEffect::onFilterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/effects/SkDisplacementMapEffect.cpp:190
#11	0x00283d22 in SkImageFilter::filterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/core/SkImageFilter.cpp:104
#12	0x003e2edb in SkErodeImageFilter::onFilterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/effects/SkMorphologyImageFilter.cpp:170
#13	0x00283d22 in SkImageFilter::filterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/core/SkImageFilter.cpp:104
#14	0x003f5d23 in SkTileImageFilter::onFilterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/effects/SkTileImageFilter.cpp:23
#15	0x00283d22 in SkImageFilter::filterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/core/SkImageFilter.cpp:104
#16	0x003f7bf9 in SkXfermodeImageFilter::onFilterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/effects/SkXfermodeImageFilter.cpp:55
#17	0x00283d22 in SkImageFilter::filterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/core/SkImageFilter.cpp:104
#18	0x003f5d23 in SkTileImageFilter::onFilterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/effects/SkTileImageFilter.cpp:23
#19	0x00283d22 in SkImageFilter::filterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/core/SkImageFilter.cpp:104
#20	0x003b36dd in SkComposeImageFilter::onFilterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/effects/SkComposeImageFilter.cpp:33
#21	0x00283d22 in SkImageFilter::filterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/core/SkImageFilter.cpp:104
#22	0x003af3fb in SkColorFilterImageFilter::onFilterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/effects/SkColorFilterImageFilter.cpp:105
#23	0x00283d22 in SkImageFilter::filterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/core/SkImageFilter.cpp:104
#24	0x003e7dce in SkOffsetImageFilter::onFilterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/effects/SkOffsetImageFilter.cpp:27
#25	0x00283d22 in SkImageFilter::filterImage(SkImageFilter::Proxy*, SkBitmap const&, SkMatrix const&, SkBitmap*, SkIPoint*) at /skia/trunk/src/core/SkImageFilter.cpp:104
#26	0x00244aa8 in SkCanvas::internalDrawDevice(SkBaseDevice*, int, int, SkPaint const*) at /skia/trunk/src/core/SkCanvas.cpp:1004
#27	0x00242eee in SkCanvas::internalRestore() at /skia/trunk/src/core/SkCanvas.cpp:922
#28	0x0024d034 in AutoDrawLooper::~AutoDrawLooper() at /skia/trunk/src/core/SkCanvas.cpp:369
#29	0x0024c517 in AutoDrawLooper::~AutoDrawLooper() at /skia/trunk/src/core/SkCanvas.cpp:367
#30	0x002450ae in SkCanvas::internalDrawBitmap(SkBitmap const&, SkMatrix const&, SkPaint const*) at /skia/trunk/src/core/SkCanvas.cpp:982
#31	0x00248c76 in SkCanvas::drawBitmap(SkBitmap const&, float, float, SkPaint const*) at /skia/trunk/src/core/SkCanvas.cpp:1732
#32	0x0004458a in drawClippedBitmap(SkCanvas*, int, int, SkPaint const&) at /skia/trunk/samplecode/SampleFilterFuzz.cpp:314
#33	0x0004427e in do_fuzz(SkCanvas*) at /skia/trunk/samplecode/SampleFilterFuzz.cpp:337
#34	0x00046f03 in ImageFilterFuzzView::onDrawContent(SkCanvas*) at /skia/trunk/samplecode/SampleFilterFuzz.cpp:363

 
Project Member Comment 1 by senorblanco@chromium.org, Jan 2 2014
Owner: sugoi@google.com
SkBitmapSource (without cropping) just returns its contained SkBitmap, so if that bitmap is 565, that's definitely what the downstream will receive. The two options I can think of are:

1) Prevent creation of an SkBitmapSource with a non-8888 SkBitmap. That'll be easiest, but it'll probably require creating a factory function, since SkBitmapSource only has constructors right now.

2) Ensure all filters can handle a 565 input. That's a bigger project, but it seems conceivable that any filter could return a 565 input, not just SkBitmapSource, so this would make the system more robust.

Maybe Alexis can take a look when he gets back.
Project Member Comment 2 by reed@google.com, Jan 2 2014
or #3) BitmapSource returns an upscaled-copy of the src in 8888 format.

Not sure I favor #3 over #1 (i.e. #1 is fine with me), but I don't think we'd get much milage out of #2, and that seems like a lot of extra code.
Project Member Comment 3 by hcm@google.com, Oct 13 2014
Labels: Area-Bitmap
Project Member Comment 4 by hcm@google.com, Dec 7 2015
Labels: Hotlist-Fixit
Project Member Comment 5 by caryclark@google.com, Dec 22 2015
Cc: caryclark@google.com
Alexis, what are your thoughts on this? Need help?
Project Member Comment 6 by reed@google.com, Jan 4 2016
1. prevent creation of non-8888
2. ensure all filters can handle 565
3. BitmapSource outputs 8888 (by upscaling if necessary)

For my money, I think #2 is not worth the complexity at all. 565 gets used less and less, and we are investigating removing some of the existing specializations around it as they may not be worth the complexity.

I think #3 is just a gentler version of #1, so that would be my vote.

thoughts?

Sign in to add a comment