core: Made overwrite_cpu_pixels_from_gpu take in MutationContext instead of &mut UpdateContext
This commit is contained in:
parent
e62e2a94e8
commit
4477d65331
|
@ -79,7 +79,7 @@ pub fn constructor<'gc>(
|
||||||
if let Some(bitmap_data) = this.as_bitmap_data_object() {
|
if let Some(bitmap_data) = this.as_bitmap_data_object() {
|
||||||
let (sync, _) = bitmap_data
|
let (sync, _) = bitmap_data
|
||||||
.bitmap_data()
|
.bitmap_data()
|
||||||
.overwrite_cpu_pixels_from_gpu(&mut activation.context);
|
.overwrite_cpu_pixels_from_gpu(activation.context.gc_context);
|
||||||
sync.write(activation.context.gc_context).init_pixels(
|
sync.write(activation.context.gc_context).init_pixels(
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
@ -1363,7 +1363,7 @@ pub fn load_bitmap<'gc>(
|
||||||
.as_bitmap_data_object()
|
.as_bitmap_data_object()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.bitmap_data()
|
.bitmap_data()
|
||||||
.overwrite_cpu_pixels_from_gpu(&mut activation.context);
|
.overwrite_cpu_pixels_from_gpu(activation.context.gc_context);
|
||||||
|
|
||||||
sync.write(activation.context.gc_context)
|
sync.write(activation.context.gc_context)
|
||||||
.set_pixels(width, height, true, pixels);
|
.set_pixels(width, height, true, pixels);
|
||||||
|
|
|
@ -232,7 +232,7 @@ enum DirtyState {
|
||||||
|
|
||||||
mod wrapper {
|
mod wrapper {
|
||||||
use crate::avm2::{Object as Avm2Object, Value as Avm2Value};
|
use crate::avm2::{Object as Avm2Object, Value as Avm2Value};
|
||||||
use crate::context::{RenderContext, UpdateContext};
|
use crate::context::RenderContext;
|
||||||
use gc_arena::{Collect, GcCell, MutationContext};
|
use gc_arena::{Collect, GcCell, MutationContext};
|
||||||
use ruffle_render::backend::RenderBackend;
|
use ruffle_render::backend::RenderBackend;
|
||||||
use ruffle_render::bitmap::{BitmapHandle, PixelRegion};
|
use ruffle_render::bitmap::{BitmapHandle, PixelRegion};
|
||||||
|
@ -344,9 +344,9 @@ mod wrapper {
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
pub fn overwrite_cpu_pixels_from_gpu(
|
pub fn overwrite_cpu_pixels_from_gpu(
|
||||||
&self,
|
&self,
|
||||||
context: &mut UpdateContext<'_, 'gc>,
|
mc: MutationContext<'gc, '_>,
|
||||||
) -> (GcCell<'gc, BitmapData<'gc>>, Option<PixelRegion>) {
|
) -> (GcCell<'gc, BitmapData<'gc>>, Option<PixelRegion>) {
|
||||||
let mut write = self.0.write(context.gc_context);
|
let mut write = self.0.write(mc);
|
||||||
let dirty_rect = match write.dirty_state {
|
let dirty_rect = match write.dirty_state {
|
||||||
DirtyState::GpuModified(_, rect) => {
|
DirtyState::GpuModified(_, rect) => {
|
||||||
write.dirty_state = DirtyState::Clean;
|
write.dirty_state = DirtyState::Clean;
|
||||||
|
|
|
@ -40,7 +40,7 @@ pub fn fill_rect<'gc>(
|
||||||
|
|
||||||
let target = if rect.width() == target.width() && rect.height() == target.height() {
|
let target = if rect.width() == target.width() && rect.height() == target.height() {
|
||||||
// If we're filling the whole region, we can discard the gpu data
|
// If we're filling the whole region, we can discard the gpu data
|
||||||
target.overwrite_cpu_pixels_from_gpu(context).0
|
target.overwrite_cpu_pixels_from_gpu(context.gc_context).0
|
||||||
} else {
|
} else {
|
||||||
// If we're filling a partial region, finish any gpu->cpu sync
|
// If we're filling a partial region, finish any gpu->cpu sync
|
||||||
target.sync()
|
target.sync()
|
||||||
|
@ -177,7 +177,7 @@ pub fn noise<'gc>(
|
||||||
channel_options: ChannelOptions,
|
channel_options: ChannelOptions,
|
||||||
gray_scale: bool,
|
gray_scale: bool,
|
||||||
) {
|
) {
|
||||||
let (target, _) = target.overwrite_cpu_pixels_from_gpu(context);
|
let (target, _) = target.overwrite_cpu_pixels_from_gpu(context.gc_context);
|
||||||
let mut write = target.write(context.gc_context);
|
let mut write = target.write(context.gc_context);
|
||||||
|
|
||||||
let true_seed = if seed <= 0 {
|
let true_seed = if seed <= 0 {
|
||||||
|
@ -247,7 +247,7 @@ pub fn perlin_noise<'gc>(
|
||||||
grayscale: bool,
|
grayscale: bool,
|
||||||
offsets: Vec<(f64, f64)>, // must contain `num_octaves` values
|
offsets: Vec<(f64, f64)>, // must contain `num_octaves` values
|
||||||
) {
|
) {
|
||||||
let (target, _) = target.overwrite_cpu_pixels_from_gpu(context);
|
let (target, _) = target.overwrite_cpu_pixels_from_gpu(context.gc_context);
|
||||||
let mut write = target.write(context.gc_context);
|
let mut write = target.write(context.gc_context);
|
||||||
|
|
||||||
let turb = Turbulence::from_seed(random_seed);
|
let turb = Turbulence::from_seed(random_seed);
|
||||||
|
@ -1184,7 +1184,7 @@ pub fn apply_filter<'gc>(
|
||||||
filter: Filter,
|
filter: Filter,
|
||||||
) {
|
) {
|
||||||
let source_handle = source.bitmap_handle(context.gc_context, context.renderer);
|
let source_handle = source.bitmap_handle(context.gc_context, context.renderer);
|
||||||
let (target, _) = target.overwrite_cpu_pixels_from_gpu(context);
|
let (target, _) = target.overwrite_cpu_pixels_from_gpu(context.gc_context);
|
||||||
let mut write = target.write(context.gc_context);
|
let mut write = target.write(context.gc_context);
|
||||||
let dest = write.bitmap_handle(context.renderer).unwrap();
|
let dest = write.bitmap_handle(context.renderer).unwrap();
|
||||||
|
|
||||||
|
@ -1293,7 +1293,7 @@ pub fn draw<'gc>(
|
||||||
commands
|
commands
|
||||||
};
|
};
|
||||||
|
|
||||||
let (target, include_dirty_area) = target.overwrite_cpu_pixels_from_gpu(context);
|
let (target, include_dirty_area) = target.overwrite_cpu_pixels_from_gpu(context.gc_context);
|
||||||
let mut write = target.write(context.gc_context);
|
let mut write = target.write(context.gc_context);
|
||||||
// If we have another dirty area to preserve, expand this to include it
|
// If we have another dirty area to preserve, expand this to include it
|
||||||
if let Some(old) = include_dirty_area {
|
if let Some(old) = include_dirty_area {
|
||||||
|
@ -1375,7 +1375,7 @@ pub fn set_pixels_from_byte_array<'gc>(
|
||||||
|
|
||||||
let target = if region.width() == target.width() && region.height() == target.height() {
|
let target = if region.width() == target.width() && region.height() == target.height() {
|
||||||
// If we're filling the whole region, we can discard the gpu data
|
// If we're filling the whole region, we can discard the gpu data
|
||||||
target.overwrite_cpu_pixels_from_gpu(context).0
|
target.overwrite_cpu_pixels_from_gpu(context.gc_context).0
|
||||||
} else {
|
} else {
|
||||||
// If we're filling a partial region, finish any gpu->cpu sync
|
// If we're filling a partial region, finish any gpu->cpu sync
|
||||||
target.sync()
|
target.sync()
|
||||||
|
|
Loading…
Reference in New Issue