Skip to content

Commit e970fe8

Browse files
committed
rename front2 -> middle
1 parent 45b790a commit e970fe8

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/backends/cg.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub struct CGImpl<D, W> {
107107
observer: Retained<Observer>,
108108
color_space: CFRetained<CGColorSpace>,
109109
front: Buffer,
110-
front2: Option<Buffer>,
110+
middle: Option<Buffer>,
111111
back: Buffer,
112112
window_handle: W,
113113
_display: PhantomData<D>,
@@ -256,7 +256,7 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for CGImpl<
256256
color_space,
257257
front: Buffer::new(&properties),
258258
// TODO: Allow configuring amount of buffers?
259-
front2: Some(Buffer::new(&properties)),
259+
middle: Some(Buffer::new(&properties)),
260260
back: Buffer::new(&properties),
261261
_display: PhantomData,
262262
window_handle: window_src,
@@ -289,8 +289,8 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for CGImpl<
289289
);
290290
self.back = Buffer::new(&properties);
291291
// Keep a second buffer if it was there before.
292-
if self.front2.is_some() {
293-
self.front2 = Some(Buffer::new(&properties));
292+
if self.middle.is_some() {
293+
self.middle = Some(Buffer::new(&properties));
294294
}
295295
self.front = Buffer::new(&properties);
296296

@@ -323,7 +323,7 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for CGImpl<
323323

324324
Ok(BufferImpl {
325325
front: &mut self.front,
326-
front2: &mut self.front2,
326+
middle: &mut self.middle,
327327
back: &mut self.back,
328328
layer: &mut self.layer,
329329
})
@@ -335,12 +335,12 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for CGImpl<
335335
/// This is triple-buffered because that's what QuartzCore / the compositor seems to require:
336336
/// - The front buffer is what's currently assigned to `CALayer.contents`, and was submitted to the
337337
/// compositor in the previous iteration of the run loop.
338-
/// - The front2 / middle buffer is what the compositor is currently drawing from.
338+
/// - The middle buffer is what the compositor is currently drawing from (assuming a 1 frame delay).
339339
/// - The back buffer is what we'll be drawing into.
340340
#[derive(Debug)]
341341
pub struct BufferImpl<'a> {
342342
front: &'a mut Buffer,
343-
front2: &'a mut Option<Buffer>,
343+
middle: &'a mut Option<Buffer>,
344344
back: &'a mut Buffer,
345345
layer: &'a mut SendCALayer,
346346
}
@@ -392,27 +392,27 @@ impl BufferInterface for BufferImpl<'_> {
392392
// Would be prettier with https://github.com/rust-lang/rfcs/pull/3466.
393393
let this = &mut *ManuallyDrop::new(self);
394394
let front = &mut *this.front;
395-
let front2 = &mut this.front2;
395+
let middle = &mut this.middle;
396396
let back = &mut *this.back;
397397
let layer = &mut *this.layer;
398398
// Note that unlocking effectively flushes the changes, without this, the contents might not
399399
// be visible to the compositor.
400400
back.unlock();
401401

402402
back.age = 1;
403-
if let Some(front2) = front2 {
404-
if front2.age != 0 {
405-
front2.age += 1;
403+
if let Some(middle) = middle {
404+
if middle.age != 0 {
405+
middle.age += 1;
406406
}
407407
}
408408
if front.age != 0 {
409409
front.age += 1;
410410
}
411411

412412
// Rotate buffers such that the back buffer is now the front buffer.
413-
if let Some(front2) = front2 {
414-
std::mem::swap(back, front2);
415-
std::mem::swap(front2, front);
413+
if let Some(middle) = middle {
414+
std::mem::swap(back, middle);
415+
std::mem::swap(middle, front);
416416
} else {
417417
std::mem::swap(back, front);
418418
}

0 commit comments

Comments
 (0)