From 5a8d5034a161fb9c881b60780141c7aad2913c7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kornel=20Lesin=CC=81ski?= <kornel@geekhood.net>
Date: Tue, 5 May 2020 18:09:43 +0100
Subject: [PATCH] Inline all the things

---
 src/error.rs     |  1 +
 src/ext.rs       | 17 +++++++++++++++
 src/flags.rs     |  1 +
 src/profile.rs   | 55 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/transform.rs | 14 ++++++++++++
 5 files changed, 88 insertions(+)

diff --git a/src/error.rs b/src/error.rs
index d20605f..8e8a39d 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -10,6 +10,7 @@ pub enum Error {
 }
 
 impl Error {
+    #[inline]
     pub(crate) unsafe fn if_null<T>(handle: *mut <T as ForeignType>::CType) -> LCMSResult<T> where T: ForeignType {
         if !handle.is_null() {
             Ok(T::from_ptr(handle))
diff --git a/src/ext.rs b/src/ext.rs
index 77f22c3..dbbbdf7 100644
--- a/src/ext.rs
+++ b/src/ext.rs
@@ -11,10 +11,12 @@ pub trait ColorSpaceSignatureExt: Sized + Copy {
 }
 
 impl ColorSpaceSignatureExt for ColorSpaceSignature {
+    #[inline]
     fn channels(self) -> u32 {
         unsafe { ffi::cmsChannelsOf(self) }
     }
 
+    #[inline]
     fn pixel_format(self) -> PixelFormat {
         unsafe { mem::transmute(ffi::_cmsLCMScolorSpace(self) as u32) }
     }
@@ -34,6 +36,7 @@ pub trait CIEXYZExt: Sized {
 }
 
 impl CIEXYZExt for CIEXYZ {
+    #[inline]
     fn adapt_to_illuminant(&self, source_white_point: &CIEXYZ, illuminant: &CIEXYZ) -> Option<CIEXYZ> {
         let mut res = CIEXYZ{X:0.,Y:0.,Z:0.};
         let ok = unsafe {
@@ -46,12 +49,14 @@ impl CIEXYZExt for CIEXYZ {
         }
     }
 
+    #[inline]
     fn to_lab(&self, white_point: &CIEXYZ) -> CIELab {
         let mut out = CIELab::default();
         unsafe { ffi::cmsXYZ2Lab(white_point, &mut out, self) }
         out
     }
 
+    #[inline]
     fn from_encoded(icc: &[u16; 3]) -> Self {
         let mut out = Self::default();
         unsafe {
@@ -68,6 +73,7 @@ pub trait CIExzYExt: Sized {
 }
 
 impl CIExzYExt for CIExyY {
+    #[inline]
     fn temp(&self) -> Option<f64> {
         let mut out = 0.;
         if 0 != unsafe { ffi::cmsTempFromWhitePoint(&mut out, self) } {
@@ -137,42 +143,51 @@ pub trait CIELabExt: Sized {
 }
 
 impl CIELabExt for CIELab {
+    #[inline]
     fn cie2000_delta_e(&self, other: &CIELab, kl: f64, kc: f64, kh: f64) -> f64 {
         unsafe { ffi::cmsCIE2000DeltaE(self, other, kl, kc, kh) }
     }
 
+    #[inline]
     fn cie94_delta_e(&self, other: &CIELab) -> f64 {
         unsafe { ffi::cmsCIE94DeltaE(self, other) }
     }
 
+    #[inline]
     fn bfd_delta_e(&self, other: &CIELab) -> f64 {
         unsafe { ffi::cmsBFDdeltaE(self, other) }
     }
 
+    #[inline]
     fn delta_e(&self, other: &CIELab) -> f64 {
         unsafe { ffi::cmsDeltaE(self, other) }
     }
 
+    #[inline]
     fn cmc_delta_e(&self, other: &CIELab, k: f64, c: f64) -> f64 {
         unsafe { ffi::cmsCMCdeltaE(self, other, k, c) }
     }
 
+    #[inline]
     fn desaturate(&mut self, amin: f64, amax: f64, bmin: f64, bmax: f64) -> bool {
         unsafe { 0 != ffi::cmsDesaturateLab(self, amax, amin, bmax, bmin) }
     }
 
+    #[inline]
     fn encoded(&self) -> [u16; 3] {
         let mut out = [0u16; 3];
         unsafe { ffi::cmsFloat2LabEncoded(out.as_mut_ptr(), self) }
         out
     }
 
+    #[inline]
     fn encoded_v2(&self) -> [u16; 3] {
         let mut out = [0u16; 3];
         unsafe { ffi::cmsFloat2LabEncodedV2(out.as_mut_ptr(), self) }
         out
     }
 
+    #[inline]
     fn from_encoded(icc: &[u16; 3]) -> Self {
         let mut out = Self::default();
         unsafe {
@@ -181,6 +196,7 @@ impl CIELabExt for CIELab {
         out
     }
 
+    #[inline]
     fn from_encoded_v2(icc: &[u16; 3]) -> Self {
         let mut out = Self::default();
         unsafe {
@@ -189,6 +205,7 @@ impl CIELabExt for CIELab {
         out
     }
 
+    #[inline]
     fn to_xyz(&self, white_point: &CIEXYZ) -> CIEXYZ {
         let mut out = CIEXYZ::default();
         unsafe { ffi::cmsLab2XYZ(white_point, &mut out, self) }
diff --git a/src/flags.rs b/src/flags.rs
index d33b1f5..38200a0 100644
--- a/src/flags.rs
+++ b/src/flags.rs
@@ -89,6 +89,7 @@ impl Default for Flags {
     /// Default flags
     ///
     /// By default allows non-thread-safe cache, which improves performance, but limits transforms to use by one thread only.
+    #[inline]
     fn default() -> Self {
         Flags(0, AllowCache)
     }
diff --git a/src/profile.rs b/src/profile.rs
index 681991c..10391f3 100644
--- a/src/profile.rs
+++ b/src/profile.rs
@@ -22,16 +22,19 @@ unsafe impl<'a, C: Send> Send for Profile<C> {}
 /// Using this transform you can color correct your bitmaps.
 impl Profile<GlobalContext> {
     /// Parse ICC profile from the in-memory array
+    #[inline]
     pub fn new_icc(data: &[u8]) -> LCMSResult<Self> {
         Self::new_icc_context(GlobalContext::new(), data)
     }
 
     /// Load ICC profile file from disk
+    #[inline]
     pub fn new_file<P: AsRef<Path>>(path: P) -> io::Result<Self> {
         Self::new_file_context(GlobalContext::new(), path)
     }
 
     /// Create an ICC virtual profile for sRGB space. sRGB is a standard RGB color space created cooperatively by HP and Microsoft in 1996 for use on monitors, printers, and the Internet.
+    #[inline]
     pub fn new_srgb() -> Self {
         Self::new_srgb_context(GlobalContext::new())
     }
@@ -48,6 +51,7 @@ impl Profile<GlobalContext> {
     ///   8. BlueTRCTag
     ///   9. Chromatic adaptation Tag
     ///   10. ChromaticityTag
+    #[inline]
     pub fn new_rgb(white_point: &CIExyY,
                    primaries: &CIExyYTRIPLE,
                    transfer_function: &[&ToneCurve])
@@ -60,16 +64,19 @@ impl Profile<GlobalContext> {
     ///   1. ProfileDescriptionTag
     ///   2. MediaWhitePointTag
     ///   3. GrayTRCTag
+    #[inline]
     pub fn new_gray(white_point: &CIExyY, curve: &ToneCurve) -> LCMSResult<Self> {
         Self::new_gray_context(GlobalContext::new(), white_point, curve)
     }
 
     /// Creates a XYZ  XYZ identity, marking it as v4 ICC profile.  WhitePoint used in Absolute colorimetric intent  is D50.
+    #[inline]
     pub fn new_xyz() -> Self {
         Self::new_handle(unsafe { ffi::cmsCreateXYZProfile() }).unwrap()
     }
 
     /// Creates a fake NULL profile. This profile return 1 channel as always 0. Is useful only for gamut checking tricks.
+    #[inline]
     pub fn new_null() -> Self {
         Self::new_handle(unsafe { ffi::cmsCreateNULLProfile() }).unwrap()
     }
@@ -77,6 +84,7 @@ impl Profile<GlobalContext> {
     /// Creates an empty profile object, ready to be populated by the programmer.
     ///
     /// WARNING: The obtained profile without adding any information is not directly useable.
+    #[inline]
     pub fn new_placeholder() -> Self {
         Self::new_handle(unsafe { ffi::cmsCreateProfilePlaceholder(ptr::null_mut()) }).unwrap()
     }
@@ -89,6 +97,7 @@ impl Profile<GlobalContext> {
 
     /// Generates a device-link profile from a given color transform. This profile can then be used by any other function accepting profile handle.
     /// Depending on the specified version number, the implementation of the devicelink may vary. Accepted versions are in range 1.0…4.3
+    #[inline]
     pub fn new_device_link<F, T>(transform: &Transform<F, T>, version: f64, flags: Flags) -> LCMSResult<Self> {
         Self::new_handle(unsafe { ffi::cmsTransform2DeviceLink(transform.handle, version, flags.bits()) })
     }
@@ -111,20 +120,24 @@ impl<Ctx: Context> Profile<Ctx> {
     }
 
     /// Gets the device class signature from profile header.
+    #[inline]
     pub fn device_class(&self) -> ProfileClassSignature {
         unsafe { ffi::cmsGetDeviceClass(self.handle) }
     }
 
     /// Sets the device class signature in profile header.
+    #[inline]
     pub fn set_device_class(&mut self, cls: ProfileClassSignature) {
         unsafe { ffi::cmsSetDeviceClass(self.handle, cls) }
     }
 
     /// Returns the profile ICC version in the same format as it is stored in the header.
+    #[inline]
     pub fn encoded_icc_version(&self) -> u32 {
         unsafe { ffi::cmsGetEncodedICCversion(self.handle) }
     }
 
+    #[inline]
     pub fn set_encoded_icc_version(&self, v: u32) {
         unsafe { ffi::cmsSetEncodedICCversion(self.handle, v) }
     }
@@ -136,6 +149,7 @@ impl<Ctx: Context> Profile<Ctx> {
     ///  * `Glossy`
     ///  * `Matte`
 
+    #[inline]
     pub fn header_attributes(&self) -> u64 {
         let mut flags = 0;
         unsafe {
@@ -145,12 +159,14 @@ impl<Ctx: Context> Profile<Ctx> {
     }
 
     /// Sets the attribute flags in the profile header.
+    #[inline]
     pub fn set_header_attributes(&mut self, flags: u64) {
         unsafe {
             ffi::cmsSetHeaderAttributes(self.handle, flags);
         }
     }
 
+    #[inline]
     pub fn header_creator(&self) -> u32 {
         unsafe { ffi::cmsGetHeaderCreator(self.handle) }
     }
@@ -159,11 +175,13 @@ impl<Ctx: Context> Profile<Ctx> {
     ///
     /// The profile flags field does contain flags to indicate various hints for the CMM such as distributed processing and caching options.
     /// The least-significant 16 bits are reserved for the ICC. Flags in bit positions 0 and 1 shall be used as indicated in Table 7 of LCMS PDF.
+    #[inline]
     pub fn header_flags(&self) -> u32 {
         unsafe { ffi::cmsGetHeaderFlags(self.handle) }
     }
 
     /// Sets header flags of given ICC profile object. Valid flags are defined in Table 7 of LCMS PDF.
+    #[inline]
     pub fn set_header_flags(&mut self, flags: u32) {
         unsafe { ffi::cmsSetHeaderFlags(self.handle, flags); }
     }
@@ -171,6 +189,7 @@ impl<Ctx: Context> Profile<Ctx> {
     /// Returns the manufacturer signature as described in the header.
     ///
     /// This funcionality is widely superseded by the manufaturer tag. Of use only in elder profiles.
+    #[inline]
     pub fn header_manufacturer(&self) -> u32 {
         unsafe { ffi::cmsGetHeaderManufacturer(self.handle) }
     }
@@ -179,6 +198,7 @@ impl<Ctx: Context> Profile<Ctx> {
     ///
     /// This funcionality is widely superseded by the manufaturer tag. Of use only in elder profiles.
     #[deprecated(note = "This funcionality is widely superseded by the manufaturer tag")]
+    #[inline]
     pub fn set_header_manufacturer(&mut self, m: u32) {
         unsafe { ffi::cmsSetHeaderManufacturer(self.handle, m) }
     }
@@ -186,6 +206,7 @@ impl<Ctx: Context> Profile<Ctx> {
     /// Returns the model signature as described in the header.
     ///
     /// This funcionality is widely superseded by the model tag. Of use only in elder profiles.
+    #[inline]
     pub fn header_model(&self) -> u32 {
         unsafe { ffi::cmsGetHeaderModel(self.handle) }
     }
@@ -194,6 +215,7 @@ impl<Ctx: Context> Profile<Ctx> {
     ///
     /// This funcionality is widely superseded by the model tag. Of use only in elder profiles.
     #[deprecated(note = "This funcionality is widely superseded by the model tag")]
+    #[inline]
     pub fn set_header_model(&mut self, model: u32) {
         unsafe {
             ffi::cmsSetHeaderModel(self.handle, model);
@@ -207,20 +229,24 @@ impl<Ctx: Context> Profile<Ctx> {
     /// In a sequence of more than two profiles, it applies to the combination of this profile and the next profile in the sequence and not to the entire sequence.
     /// Typically, the user or application will set the rendering intent dynamically at runtime or embedding time.
     /// Therefore, this flag may not have any meaning until the profile is used in some context, e.g. in a Devicelink or an embedded source profile.”
+    #[inline]
     pub fn header_rendering_intent(&self) -> Intent {
         unsafe { ffi::cmsGetHeaderRenderingIntent(self.handle) }
     }
 
+    #[inline]
     pub fn set_header_rendering_intent(&mut self, intent: Intent) {
         unsafe { ffi::cmsSetHeaderRenderingIntent(self.handle, intent) }
     }
 
     /// Gets the profile connection space used by the given profile, using the ICC convention.
+    #[inline]
     pub fn pcs(&self) -> ColorSpaceSignature {
         unsafe { ffi::cmsGetPCS(self.handle) }
     }
 
     /// Sets the profile connection space signature in profile header, using ICC convention.
+    #[inline]
     pub fn set_pcs(&mut self, pcs: ColorSpaceSignature) {
         unsafe { ffi::cmsSetPCS(self.handle, pcs) }
     }
@@ -259,23 +285,27 @@ impl<Ctx: Context> Profile<Ctx> {
     }
 
     /// Returns the profile ICC version. The version is decoded to readable floating point format.
+    #[inline]
     pub fn version(&self) -> f64 {
         unsafe { ffi::cmsGetProfileVersion(self.handle) }
     }
 
     /// Sets the ICC version in profile header. The version is given to this function as a float n.m
+    #[inline]
     pub fn set_version(&mut self, ver: f64) {
         unsafe {
             ffi::cmsSetProfileVersion(self.handle, ver);
         }
     }
 
+    #[inline]
     pub fn tag_signatures(&self) -> Vec<TagSignature> {
         unsafe {
             (0..ffi::cmsGetTagCount(self.handle)).map(|n| ffi::cmsGetTagSignature(self.handle, n as u32)).collect()
         }
     }
 
+    #[inline]
     pub fn detect_black_point(&self, intent: Intent) -> Option<CIEXYZ> {
         unsafe {
             let mut b = Default::default();
@@ -287,6 +317,7 @@ impl<Ctx: Context> Profile<Ctx> {
         }
     }
 
+    #[inline]
     pub fn detect_destination_black_point(&self, intent: Intent) -> Option<CIEXYZ> {
         unsafe {
             let mut b = Default::default();
@@ -298,11 +329,13 @@ impl<Ctx: Context> Profile<Ctx> {
         }
     }
 
+    #[inline]
     pub fn detect_tac(&self) -> f64 {
         unsafe { ffi::cmsDetectTAC(self.handle) }
     }
 
     /// Gets the color space used by the given profile, using the ICC convention.
+    #[inline]
     pub fn color_space(&self) -> ColorSpaceSignature {
         unsafe {
             let v = ffi::cmsGetColorSpace(self.handle);
@@ -311,30 +344,37 @@ impl<Ctx: Context> Profile<Ctx> {
     }
 
     /// Sets the profile connection space signature in profile header, using ICC convention.
+    #[inline]
     pub fn set_color_space(&mut self, sig: ColorSpaceSignature) {
         unsafe { ffi::cmsSetColorSpace(self.handle, sig) }
     }
 
+    #[inline]
     pub fn is_clut(&self, intent: Intent, used_direction: u32) -> bool {
         unsafe { ffi::cmsIsCLUT(self.handle, intent, used_direction) != 0 }
     }
 
+    #[inline]
     pub fn is_intent_supported(&self, intent: Intent, used_direction: u32) -> bool {
         unsafe { ffi::cmsIsIntentSupported(self.handle, intent, used_direction) != 0 }
     }
 
+    #[inline]
     pub fn is_matrix_shaper(&self) -> bool {
         unsafe { ffi::cmsIsMatrixShaper(self.handle) != 0 }
     }
 
+    #[inline]
     pub fn has_tag(&self, sig: TagSignature) -> bool {
         unsafe { ffi::cmsIsTag(self.handle, sig) != 0 }
     }
 
+    #[inline]
     pub fn read_tag(&self, sig: TagSignature) -> Tag<'_> {
         unsafe { Tag::new(sig, ffi::cmsReadTag(self.handle, sig) as *const u8) }
     }
 
+    #[inline]
     pub fn write_tag(&mut self, sig: TagSignature, tag: Tag<'_>) -> bool {
         unsafe {
             ffi::cmsWriteTag(self.handle, sig, tag.data_for_signature(sig) as *const _) != 0
@@ -342,6 +382,7 @@ impl<Ctx: Context> Profile<Ctx> {
     }
 
     /// Retrieves the Profile ID stored in the profile header.
+    #[inline]
     pub fn profile_id(&self) -> ffi::ProfileID {
         let mut id = ffi::ProfileID::default();
         unsafe {
@@ -351,12 +392,14 @@ impl<Ctx: Context> Profile<Ctx> {
     }
 
     /// Computes a MD5 checksum and stores it as Profile ID in the profile header.
+    #[inline]
     pub fn set_default_profile_id(&mut self) {
         unsafe {
             ffi::cmsMD5computeID(self.handle);
         }
     }
 
+    #[inline]
     pub fn set_profile_id(&mut self, id: ffi::ProfileID) {
         unsafe {
             ffi::cmsSetHeaderProfileID(self.handle, &id as *const ffi::ProfileID as *mut _);
@@ -366,22 +409,26 @@ impl<Ctx: Context> Profile<Ctx> {
 
 /// Per-context functions that can be used with a `ThreadContext`
 impl<Ctx: Context> Profile<Ctx> {
+    #[inline]
     pub fn new_icc_context(context: impl AsRef<Ctx>, data: &[u8]) -> LCMSResult<Self> {
         Self::new_handle(unsafe {
             ffi::cmsOpenProfileFromMemTHR(context.as_ref().as_ptr(), data.as_ptr() as *const c_void, data.len() as u32)
         })
     }
 
+    #[inline]
     pub fn new_file_context<P: AsRef<Path>>(context: impl AsRef<Ctx>, path: P) -> io::Result<Self> {
         let mut buf = Vec::new();
         File::open(path)?.read_to_end(&mut buf)?;
         Self::new_icc_context(context, &buf).map_err(|_| io::ErrorKind::Other.into())
     }
 
+    #[inline]
     pub fn new_srgb_context(context: impl AsRef<Ctx>) -> Self {
         Self::new_handle(unsafe { ffi::cmsCreate_sRGBProfileTHR(context.as_ref().as_ptr()) }).unwrap()
     }
 
+    #[inline]
     pub fn new_rgb_context(context: impl AsRef<Ctx>, white_point: &CIExyY,
                    primaries: &CIExyYTRIPLE,
                    transfer_function: &[&ToneCurve])
@@ -398,12 +445,14 @@ impl<Ctx: Context> Profile<Ctx> {
         })
     }
 
+    #[inline]
     pub fn new_gray_context(context: impl AsRef<Ctx>, white_point: &CIExyY, curve: &ToneCurve) -> LCMSResult<Self> {
         Self::new_handle(unsafe { ffi::cmsCreateGrayProfileTHR(context.as_ref().as_ptr(), white_point, curve.as_ptr()) })
     }
 
     /// This is a devicelink operating in the target colorspace with as many transfer functions as components.
     /// Number of tone curves must be sufficient for the color space.
+    #[inline]
     pub unsafe fn new_linearization_device_link_context(context: impl AsRef<Ctx>, color_space: ColorSpaceSignature, curves: &[ToneCurveRef]) -> LCMSResult<Self> {
         let v: Vec<_> = curves.iter().map(|c| c.as_ptr() as *const _).collect();
         Self::new_handle(ffi::cmsCreateLinearizationDeviceLinkTHR(context.as_ref().as_ptr(), color_space, v.as_ptr()))
@@ -420,6 +469,7 @@ impl<Ctx: Context> Profile<Ctx> {
     /// TempSrc: Source white point temperature
     /// TempDest: Destination white point temperature.
     /// To prevent white point adjustment, set Temp to None
+    #[inline]
     pub fn new_bchsw_abstract_context(context: impl AsRef<Ctx>, lut_points: usize, bright: f64, contrast: f64, hue: f64, saturation: f64,
                                       temp_src_dst: Option<(u32, u32)>) -> LCMSResult<Self> {
         let (temp_src, temp_dest) = temp_src_dst.unwrap_or((0,0));
@@ -428,6 +478,7 @@ impl<Ctx: Context> Profile<Ctx> {
         })
     }
 
+    #[inline]
     fn new_handle(handle: ffi::HPROFILE) -> LCMSResult<Self> {
         if handle.is_null() {
             return Err(Error::ObjectCreationError);
@@ -440,16 +491,19 @@ impl<Ctx: Context> Profile<Ctx> {
 
     /// This is a devicelink operating in CMYK for ink-limiting. Currently only cmsSigCmykData is supported.
     /// Limit: Amount of ink limiting in % (0..400%)
+    #[inline]
     pub fn ink_limiting_context(context: impl AsRef<Ctx>, color_space: ColorSpaceSignature, limit: f64) -> LCMSResult<Self> {
         Self::new_handle(unsafe { ffi::cmsCreateInkLimitingDeviceLinkTHR(context.as_ref().as_ptr(), color_space, limit) })
     }
 
     /// Creates a XYZ  XYZ identity, marking it as v4 ICC profile.  WhitePoint used in Absolute colorimetric intent  is D50.
+    #[inline]
     pub fn new_xyz_context(context: impl AsRef<Ctx>) -> Self {
         Self::new_handle(unsafe { ffi::cmsCreateXYZProfileTHR(context.as_ref().as_ptr()) }).unwrap()
     }
 
     /// Creates a fake NULL profile. This profile return 1 channel as always 0. Is useful only for gamut checking tricks.
+    #[inline]
     pub fn new_null_context(context: impl AsRef<Ctx>) -> Self {
         Self::new_handle(unsafe { ffi::cmsCreateNULLProfileTHR(context.as_ref().as_ptr()) }).unwrap()
     }
@@ -462,6 +516,7 @@ impl<Ctx: Context> Profile<Ctx> {
     }
 
     /// Creates a Lab  Lab identity, marking it as v4 ICC profile.
+    #[inline]
     pub fn new_lab4_context(context: impl AsRef<Ctx>, white_point: &CIExyY) -> LCMSResult<Self> {
         Self::new_handle(unsafe { ffi::cmsCreateLab4ProfileTHR(context.as_ref().as_ptr(), white_point) })
     }
diff --git a/src/transform.rs b/src/transform.rs
index c1d0a82..b1630d1 100644
--- a/src/transform.rs
+++ b/src/transform.rs
@@ -57,6 +57,7 @@ impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone> Transform<
     ///  * Intent: Rendering intent
     ///
     ///  See documentation of these types for more detail.
+    #[inline]
     pub fn new(input: &Profile,
                in_format: PixelFormat,
                output: &Profile,
@@ -66,6 +67,7 @@ impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone> Transform<
     }
 
     /// Non-thread-safe
+    #[inline]
     pub fn new_flags<Fl: CacheFlag>(input: &Profile,
                      in_format: PixelFormat,
                      output: &Profile,
@@ -85,6 +87,7 @@ impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone> Transform<
     ///
     ///  * `FLAGS_GAMUTCHECK`: Color out of gamut are flagged to a fixed color defined by the function cmsSetAlarmCodes
     ///  * `FLAGS_SOFTPROOFING`: does emulate the Proofing device.
+    #[inline]
     pub fn new_proofing(input: &Profile, in_format: PixelFormat,
                         output: &Profile, out_format: PixelFormat,
                         proofing: &Profile, intent: Intent, proofng_intent: Intent,
@@ -97,12 +100,14 @@ impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone> Transform<
     ///
     /// User passes in an array of handles to open profiles. The returned color transform do "smelt" all profiles in a single devicelink.
     /// Color spaces must be paired with the exception of Lab/XYZ, which can be interchanged.
+    #[inline]
     pub fn new_multiprofile(profiles: &[&Profile], in_format: PixelFormat, out_format: PixelFormat, intent: Intent, flags: Flags) -> LCMSResult<Self> {
         Self::new_multiprofile_context(GlobalContext::new(), profiles, in_format, out_format, intent, flags)
     }
 }
 
 impl<PixelFormat: Copy + Clone, Ctx: Context, C> Transform<PixelFormat, PixelFormat, Ctx, C> {
+    #[inline]
     pub fn transform_in_place(&self, srcdst: &mut [PixelFormat]) {
         let size = srcdst.len();
         assert!(size < std::u32::MAX as usize);
@@ -119,6 +124,7 @@ impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone, Ctx: Conte
     // Same as `new()`, but allows specifying thread-safe context (enables `Send`)
     //
     // For `Sync`, see `new_flags_context` and `Flags::NO_CACHE`
+    #[inline]
     pub fn new_context(context: impl AsRef<Ctx>, input: &Profile<Ctx>, in_format: PixelFormat,
                        output: &Profile<Ctx>, out_format: PixelFormat, intent: Intent) -> LCMSResult<Self> {
         Self::new_flags_context(context, input, in_format, output, out_format, intent, Flags::default())
@@ -126,6 +132,7 @@ impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone, Ctx: Conte
 }
 
 impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone, Ctx: Context, Fl: CacheFlag> Transform<InputPixelFormat, OutputPixelFormat, Ctx, Fl> {
+    #[inline]
     fn new_handle(handle: ffi::HTRANSFORM, in_format: PixelFormat, out_format: PixelFormat) -> LCMSResult<Self> {
         if handle.is_null() {
             Err(Error::ObjectCreationError)
@@ -140,6 +147,7 @@ impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone, Ctx: Conte
         }
     }
 
+    #[inline]
     fn check_format<Z>(format: PixelFormat, input: bool) -> PhantomData<Z> {
         assert!(!format.planar(), "Planar not supported");
         assert_eq!(format.bytes_per_pixel(),
@@ -165,14 +173,17 @@ impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone, Ctx: Conte
         }
     }
 
+    #[inline]
     pub fn input_format(&self) -> PixelFormat {
         unsafe { ffi::cmsGetTransformInputFormat(self.handle) as PixelFormat }
     }
 
+    #[inline]
     pub fn output_format(&self) -> PixelFormat {
         unsafe { ffi::cmsGetTransformOutputFormat(self.handle) as PixelFormat }
     }
 
+    #[inline]
     pub fn new_flags_context(context: impl AsRef<Ctx>, input: &Profile<Ctx>, in_format: PixelFormat,
                              output: &Profile<Ctx>, out_format: PixelFormat,
                              intent: Intent, flags: Flags<Fl>)
@@ -186,6 +197,7 @@ impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone, Ctx: Conte
                          in_format, out_format)
     }
 
+    #[inline]
     pub fn new_proofing_context(context: impl AsRef<Ctx>, input: &Profile<Ctx>, in_format: PixelFormat,
                         output: &Profile<Ctx>, out_format: PixelFormat,
                         proofing: &Profile<Ctx>, intent: Intent, proofng_intent: Intent,
@@ -199,6 +211,7 @@ impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone, Ctx: Conte
                          in_format, out_format)
     }
 
+    #[inline]
     fn new_multiprofile_context(context: impl AsRef<Ctx>, profiles: &[&Profile],
                                 in_format: PixelFormat, out_format: PixelFormat, intent: Intent, flags: Flags<Fl>) -> LCMSResult<Self> {
         let mut handles: Vec<_> = profiles.iter().map(|p| p.handle).collect();
@@ -216,6 +229,7 @@ impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone, C> Transfo
     /// Adaptation state for absolute colorimetric intent, on all but cmsCreateExtendedTransform.
     ///
     /// See `ThreadContext::adaptation_state()`
+    #[inline]
     pub fn global_adaptation_state() -> f64 {
         unsafe { ffi::cmsSetAdaptationState(-1.) }
     }
-- 
GitLab