m82: update core/surface_characterization.rs
#[cfg(feature = "gpu")]
use crate::gpu;
use crate::prelude::*;
-use crate::{ColorSpace, SurfaceProps};
+use crate::{ColorSpace, ColorType, ISize, SurfaceProps};
use skia_bindings as sb;
use skia_bindings::SkSurfaceCharacterization;
@@ -53,6 +53,24 @@ impl Handle<SkSurfaceCharacterization> {
};
characterization
}
+
+ #[cfg(feature = "gpu")]
+ pub fn with_backend_format(
+ &self,
+ color_type: ColorType,
+ backend_format: &gpu::BackendFormat,
+ ) -> Self {
+ let mut characterization = Self::default();
+ Self::from_native(unsafe {
+ self.native()
+ .createBackendFormat(color_type.into_native(), backend_format.native())
+ })
+ }
+
+ #[cfg(feature = "gl")]
+ pub fn with_fbo0(&self, uses_glfbo0: bool) -> Self {
+ Self::from_native(unsafe { self.native().createFBO0(uses_glfbo0) })
+ }
}
#[cfg(feature = "gpu")]
@@ -81,6 +99,10 @@ impl Handle<SkSurfaceCharacterization> {
self.native().fOrigin
}
+ pub fn dimensions(&self) -> ISize {
+ self.image_info().dimensions()
+ }
+
pub fn width(&self) -> i32 {
self.image_info().width()
}
