Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit80bca7a

Browse files
csnewmandvc94ch
authored andcommitted
Simplify texture api
1 parent1516fa8 commit80bca7a

File tree

4 files changed

+145
-174
lines changed

4 files changed

+145
-174
lines changed

‎flutter-engine/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ license = "MIT"
1010

1111
[dependencies]
1212
flutter-engine-sys = {path ="../flutter-engine-sys" }
13-
gl ="0.14.0"
13+
gl ={version ="0.14.0",optional =true }
1414
image = {version ="0.22.4",optional =true,default_features =false }
1515
log ="0.4.8"
1616
parking_lot ="0.10.0"
1717
priority-queue ="0.7.0"
1818
serde = {version ="1.0.104",features = ["derive"] }
1919
serde_json ="1.0.44"
20+
21+
[features]
22+
gl-helpers = ["gl","image"]

‎flutter-engine/src/ffi.rs

Lines changed: 3 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
use flutter_engine_sys::{
2-
FlutterOpenGLTexture,FlutterPlatformMessage,FlutterPlatformMessageResponseHandle,
2+
FlutterPlatformMessage,FlutterPlatformMessageResponseHandle,
33
};
4-
use log::{error, trace};
4+
use log::error;
55
use std::borrow::Cow;
66
use std::ffi::{CStr,CString};
7-
use std::os::raw::c_void;
8-
use std::sync::atomic::{AtomicI64,Ordering};
97
use std::{mem, ptr};
108

119
#[derive(Debug)]
@@ -174,103 +172,4 @@ impl From<FlutterPointerMouseButtons> for flutter_engine_sys::FlutterPointerMous
174172
}
175173
}
176174
}
177-
}
178-
179-
pubtypeTextureId =i64;
180-
181-
#[derive(Clone,Debug)]
182-
pubstructExternalTexture{
183-
engine_ptr: flutter_engine_sys::FlutterEngine,
184-
texture_id:TextureId,
185-
}
186-
187-
unsafeimplSendforExternalTexture{}
188-
unsafeimplSyncforExternalTexture{}
189-
190-
implExternalTexture{
191-
pubfnnew(engine_ptr: flutter_engine_sys::FlutterEngine) ->Self{
192-
staticTEXTURE_ID:AtomicI64 =AtomicI64::new(1);
193-
let texture_id =TEXTURE_ID.fetch_add(1,Ordering::Relaxed);
194-
Self{
195-
engine_ptr,
196-
texture_id,
197-
}
198-
}
199-
200-
pubfnid(&self) ->TextureId{
201-
self.texture_id
202-
}
203-
204-
pubfnregister(&self){
205-
log::trace!("texture {}: register",self.texture_id);
206-
unsafe{
207-
flutter_engine_sys::FlutterEngineRegisterExternalTexture(
208-
self.engine_ptr,
209-
self.texture_id,
210-
);
211-
}
212-
}
213-
214-
pubfnmark_frame_available(&self){
215-
log::trace!("texture {}: marking frame available",self.texture_id);
216-
unsafe{
217-
flutter_engine_sys::FlutterEngineMarkExternalTextureFrameAvailable(
218-
self.engine_ptr,
219-
self.texture_id,
220-
);
221-
}
222-
}
223-
224-
pubfnunregister(&self){
225-
log::trace!("texture {}: unregister",self.texture_id);
226-
unsafe{
227-
flutter_engine_sys::FlutterEngineUnregisterExternalTexture(
228-
self.engine_ptr,
229-
self.texture_id,
230-
);
231-
}
232-
}
233-
}
234-
235-
typeDestructorType =Box<dynFnOnce()>;
236-
237-
pubstructExternalTextureFrame{
238-
pubtarget:u32,
239-
pubname:u32,
240-
pubformat:u32,
241-
pubdestruction_callback:Box<DestructorType>,
242-
}
243-
244-
implExternalTextureFrame{
245-
pubfnnew<F>(
246-
target:u32,
247-
name:u32,
248-
format:u32,
249-
destruction_callback:F,
250-
) ->ExternalTextureFrame
251-
where
252-
F:FnOnce() ->() +'static +Send,
253-
{
254-
ExternalTextureFrame{
255-
target,
256-
name,
257-
format,
258-
destruction_callback:Box::new(Box::new(destruction_callback)),
259-
}
260-
}
261-
262-
pub(crate)fninto_ffi(self,target:&mutFlutterOpenGLTexture){
263-
target.target =self.target;
264-
target.name =self.name;
265-
target.format =self.format;
266-
target.destruction_callback =Some(texture_destruction_callback);
267-
target.user_data =Box::into_raw(self.destruction_callback)as_;
268-
}
269-
}
270-
271-
unsafeextern"C"fntexture_destruction_callback(user_data:*mutc_void){
272-
trace!("texture_destruction_callback");
273-
let user_data = user_dataas*mutDestructorType;
274-
let user_data =Box::from_raw(user_data);
275-
user_data();
276-
}
175+
}

‎flutter-engine/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl FlutterEngine {
150150
_platform_runner_handler: platform_handler,
151151
platform_receiver: main_rx,
152152
platform_sender: main_tx,
153-
texture_registry:Default::default(),
153+
texture_registry:TextureRegistry::new(),
154154
assets,
155155
}),
156156
};
@@ -542,7 +542,7 @@ impl FlutterEngine {
542542
}
543543

544544
pubfncreate_texture(&self) ->Texture{
545-
Texture::new(self.clone())
545+
self.inner.texture_registry.create_texture(self.clone())
546546
}
547547
}
548548

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp