File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ pub const FILTER_OPTIONS: &'static [&'static str] = &["robidouxfast",
131131
132132
133133
134-
134+ /// Not for external use
135135#[ repr( C ) ]
136136#[ derive( Clone , Debug , PartialEq ) ]
137137pub struct BitmapBgra {
@@ -237,11 +237,19 @@ impl BitmapBgra {
237237 Ok ( ( ) )
238238 }
239239
240+ pub fn is_pointer_null ( & self ) -> bool {
241+ self . pixels . is_null ( )
242+ }
243+
240244 /// Call normalize_alpha first; this function does not skip unused alpha bytes, only unused whole pixels.
241245 /// Otherwise Bgr32 may be non-deterministic
242- pub fn short_hash_pixels ( & self ) -> u64 {
246+ pub unsafe fn short_hash_pixels ( & self ) -> u64 {
243247 use std:: hash:: Hasher ;
244248
249+ if self . is_pointer_null ( ) {
250+ panic ! ( "BitmapBgra::short_hash_pixels called on invalid pointer" ) ;
251+ }
252+
245253 let width_bytes = self . w as usize * self . fmt . bytes ( ) ;
246254
247255 let mut hash = :: twox_hash:: XxHash :: with_seed ( 0x8ed1_2ad9_483d_28a0 ) ;
You can’t perform that action at this time.
0 commit comments