avm2: Renamed bitmap_data_wrapper into bitmap_data
This commit is contained in:
parent
0f81d60db2
commit
a80a1422b0
|
@ -78,7 +78,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_wrapper()
|
.bitmap_data()
|
||||||
.overwrite_cpu_pixels_from_gpu(&mut activation.context);
|
.overwrite_cpu_pixels_from_gpu(&mut activation.context);
|
||||||
sync.write(activation.context.gc_context).init_pixels(
|
sync.write(activation.context.gc_context).init_pixels(
|
||||||
width,
|
width,
|
||||||
|
@ -98,7 +98,7 @@ pub fn height<'gc>(
|
||||||
) -> Result<Value<'gc>, Error<'gc>> {
|
) -> Result<Value<'gc>, Error<'gc>> {
|
||||||
if let Some(bitmap_data) = this.as_bitmap_data_object() {
|
if let Some(bitmap_data) = this.as_bitmap_data_object() {
|
||||||
if !bitmap_data.disposed() {
|
if !bitmap_data.disposed() {
|
||||||
return Ok(bitmap_data.bitmap_data_wrapper().height().into());
|
return Ok(bitmap_data.bitmap_data().height().into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ pub fn width<'gc>(
|
||||||
) -> Result<Value<'gc>, Error<'gc>> {
|
) -> Result<Value<'gc>, Error<'gc>> {
|
||||||
if let Some(bitmap_data) = this.as_bitmap_data_object() {
|
if let Some(bitmap_data) = this.as_bitmap_data_object() {
|
||||||
if !bitmap_data.disposed() {
|
if !bitmap_data.disposed() {
|
||||||
return Ok(bitmap_data.bitmap_data_wrapper().width().into());
|
return Ok(bitmap_data.bitmap_data().width().into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ pub fn get_transparent<'gc>(
|
||||||
) -> Result<Value<'gc>, Error<'gc>> {
|
) -> Result<Value<'gc>, Error<'gc>> {
|
||||||
if let Some(bitmap_data) = this.as_bitmap_data_object() {
|
if let Some(bitmap_data) = this.as_bitmap_data_object() {
|
||||||
if !bitmap_data.disposed() {
|
if !bitmap_data.disposed() {
|
||||||
return Ok(bitmap_data.bitmap_data_wrapper().transparency().into());
|
return Ok(bitmap_data.bitmap_data().transparency().into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ pub fn get_pixel<'gc>(
|
||||||
if let (Some(x_val), Some(y_val)) = (args.get(0), args.get(1)) {
|
if let (Some(x_val), Some(y_val)) = (args.get(0), args.get(1)) {
|
||||||
let x = x_val.coerce_to_u32(activation)?;
|
let x = x_val.coerce_to_u32(activation)?;
|
||||||
let y = y_val.coerce_to_u32(activation)?;
|
let y = y_val.coerce_to_u32(activation)?;
|
||||||
let col = operations::get_pixel(bitmap_data.bitmap_data_wrapper(), x, y);
|
let col = operations::get_pixel(bitmap_data.bitmap_data(), x, y);
|
||||||
return Ok(col.into());
|
return Ok(col.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ pub fn get_pixel32<'gc>(
|
||||||
if let (Some(x_val), Some(y_val)) = (args.get(0), args.get(1)) {
|
if let (Some(x_val), Some(y_val)) = (args.get(0), args.get(1)) {
|
||||||
let x = x_val.coerce_to_u32(activation)?;
|
let x = x_val.coerce_to_u32(activation)?;
|
||||||
let y = y_val.coerce_to_u32(activation)?;
|
let y = y_val.coerce_to_u32(activation)?;
|
||||||
let col = operations::get_pixel32(bitmap_data.bitmap_data_wrapper(), x, y);
|
let col = operations::get_pixel32(bitmap_data.bitmap_data(), x, y);
|
||||||
return Ok(col.into());
|
return Ok(col.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ pub fn set_pixel<'gc>(
|
||||||
|
|
||||||
operations::set_pixel(
|
operations::set_pixel(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
color.into(),
|
color.into(),
|
||||||
|
@ -241,7 +241,7 @@ pub fn set_pixel32<'gc>(
|
||||||
|
|
||||||
operations::set_pixel32(
|
operations::set_pixel32(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
color,
|
color,
|
||||||
|
@ -292,11 +292,11 @@ pub fn copy_channel<'gc>(
|
||||||
let min_x = dest_point
|
let min_x = dest_point
|
||||||
.get("x", activation)?
|
.get("x", activation)?
|
||||||
.coerce_to_u32(activation)?
|
.coerce_to_u32(activation)?
|
||||||
.min(bitmap_data.bitmap_data_wrapper().width());
|
.min(bitmap_data.bitmap_data().width());
|
||||||
let min_y = dest_point
|
let min_y = dest_point
|
||||||
.get("y", activation)?
|
.get("y", activation)?
|
||||||
.coerce_to_u32(activation)?
|
.coerce_to_u32(activation)?
|
||||||
.min(bitmap_data.bitmap_data_wrapper().height());
|
.min(bitmap_data.bitmap_data().height());
|
||||||
|
|
||||||
let src_min_x = source_rect
|
let src_min_x = source_rect
|
||||||
.get("x", activation)?
|
.get("x", activation)?
|
||||||
|
@ -313,10 +313,10 @@ pub fn copy_channel<'gc>(
|
||||||
|
|
||||||
operations::copy_channel(
|
operations::copy_channel(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
(min_x, min_y),
|
(min_x, min_y),
|
||||||
(src_min_x, src_min_y, src_width, src_height),
|
(src_min_x, src_min_y, src_width, src_height),
|
||||||
source_bitmap.bitmap_data_wrapper(),
|
source_bitmap.bitmap_data(),
|
||||||
source_channel,
|
source_channel,
|
||||||
dest_channel,
|
dest_channel,
|
||||||
);
|
);
|
||||||
|
@ -355,7 +355,7 @@ pub fn fill_rect<'gc>(
|
||||||
|
|
||||||
operations::fill_rect(
|
operations::fill_rect(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
width,
|
width,
|
||||||
|
@ -377,7 +377,7 @@ pub fn clone<'gc>(
|
||||||
) -> Result<Value<'gc>, Error<'gc>> {
|
) -> Result<Value<'gc>, Error<'gc>> {
|
||||||
if let Some(bitmap_data) = this.as_bitmap_data_object() {
|
if let Some(bitmap_data) = this.as_bitmap_data_object() {
|
||||||
if !bitmap_data.disposed() {
|
if !bitmap_data.disposed() {
|
||||||
let new_bitmap_data = operations::clone(bitmap_data.bitmap_data_wrapper());
|
let new_bitmap_data = operations::clone(bitmap_data.bitmap_data());
|
||||||
let new_bitmap_data = BitmapDataObject::with_bitmap_data(
|
let new_bitmap_data = BitmapDataObject::with_bitmap_data(
|
||||||
activation.context.gc_context,
|
activation.context.gc_context,
|
||||||
activation.context.avm1.prototypes().bitmap_data,
|
activation.context.avm1.prototypes().bitmap_data,
|
||||||
|
@ -422,7 +422,7 @@ pub fn flood_fill<'gc>(
|
||||||
|
|
||||||
operations::flood_fill(
|
operations::flood_fill(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
color,
|
color,
|
||||||
|
@ -464,7 +464,7 @@ pub fn noise<'gc>(
|
||||||
let random_seed = random_seed_val.coerce_to_i32(activation)?;
|
let random_seed = random_seed_val.coerce_to_i32(activation)?;
|
||||||
operations::noise(
|
operations::noise(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
random_seed,
|
random_seed,
|
||||||
low,
|
low,
|
||||||
high.max(low),
|
high.max(low),
|
||||||
|
@ -528,7 +528,7 @@ pub fn draw<'gc>(
|
||||||
let source = if let Some(source_object) = source.as_display_object() {
|
let source = if let Some(source_object) = source.as_display_object() {
|
||||||
IBitmapDrawable::DisplayObject(source_object)
|
IBitmapDrawable::DisplayObject(source_object)
|
||||||
} else if let Some(source_bitmap) = source.as_bitmap_data_object() {
|
} else if let Some(source_bitmap) = source.as_bitmap_data_object() {
|
||||||
IBitmapDrawable::BitmapData(source_bitmap.bitmap_data_wrapper())
|
IBitmapDrawable::BitmapData(source_bitmap.bitmap_data())
|
||||||
} else {
|
} else {
|
||||||
avm_error!(
|
avm_error!(
|
||||||
activation,
|
activation,
|
||||||
|
@ -544,7 +544,7 @@ pub fn draw<'gc>(
|
||||||
let quality = activation.context.stage.quality();
|
let quality = activation.context.stage.quality();
|
||||||
match operations::draw(
|
match operations::draw(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
source,
|
source,
|
||||||
Transform {
|
Transform {
|
||||||
matrix,
|
matrix,
|
||||||
|
@ -625,7 +625,7 @@ pub fn color_transform<'gc>(
|
||||||
|
|
||||||
operations::color_transform(
|
operations::color_transform(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
x_min,
|
x_min,
|
||||||
y_min,
|
y_min,
|
||||||
x_max,
|
x_max,
|
||||||
|
@ -656,7 +656,7 @@ pub fn get_color_bounds_rect<'gc>(
|
||||||
let color = color_val.coerce_to_i32(activation)?;
|
let color = color_val.coerce_to_i32(activation)?;
|
||||||
|
|
||||||
let (x, y, w, h) = operations::color_bounds_rect(
|
let (x, y, w, h) = operations::color_bounds_rect(
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
find_color,
|
find_color,
|
||||||
mask,
|
mask,
|
||||||
color,
|
color,
|
||||||
|
@ -733,7 +733,7 @@ pub fn perlin_noise<'gc>(
|
||||||
|
|
||||||
operations::perlin_noise(
|
operations::perlin_noise(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
(base_x, base_y),
|
(base_x, base_y),
|
||||||
num_octaves,
|
num_octaves,
|
||||||
seed,
|
seed,
|
||||||
|
@ -805,10 +805,10 @@ pub fn hit_test<'gc>(
|
||||||
.coerce_to_u32(activation)?;
|
.coerce_to_u32(activation)?;
|
||||||
|
|
||||||
let result = operations::hit_test_bitmapdata(
|
let result = operations::hit_test_bitmapdata(
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
top_left,
|
top_left,
|
||||||
source_threshold,
|
source_threshold,
|
||||||
other_bmd.bitmap_data_wrapper(),
|
other_bmd.bitmap_data(),
|
||||||
second_point,
|
second_point,
|
||||||
second_threshold,
|
second_threshold,
|
||||||
);
|
);
|
||||||
|
@ -830,7 +830,7 @@ pub fn hit_test<'gc>(
|
||||||
test_y.coerce_to_i32(activation)? - top_left.1,
|
test_y.coerce_to_i32(activation)? - top_left.1,
|
||||||
);
|
);
|
||||||
return Ok(Value::Bool(operations::hit_test_point(
|
return Ok(Value::Bool(operations::hit_test_point(
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
source_threshold,
|
source_threshold,
|
||||||
test_point,
|
test_point,
|
||||||
)));
|
)));
|
||||||
|
@ -847,7 +847,7 @@ pub fn hit_test<'gc>(
|
||||||
test_height.coerce_to_i32(activation)?,
|
test_height.coerce_to_i32(activation)?,
|
||||||
);
|
);
|
||||||
return Ok(Value::Bool(operations::hit_test_rectangle(
|
return Ok(Value::Bool(operations::hit_test_rectangle(
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
source_threshold,
|
source_threshold,
|
||||||
test_point,
|
test_point,
|
||||||
size,
|
size,
|
||||||
|
@ -941,11 +941,11 @@ pub fn copy_pixels<'gc>(
|
||||||
|
|
||||||
operations::copy_pixels_with_alpha_source(
|
operations::copy_pixels_with_alpha_source(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
src_bitmap.bitmap_data_wrapper(),
|
src_bitmap.bitmap_data(),
|
||||||
(src_min_x, src_min_y, src_width, src_height),
|
(src_min_x, src_min_y, src_width, src_height),
|
||||||
(dest_x, dest_y),
|
(dest_x, dest_y),
|
||||||
alpha_bitmap.bitmap_data_wrapper(),
|
alpha_bitmap.bitmap_data(),
|
||||||
(alpha_x, alpha_y),
|
(alpha_x, alpha_y),
|
||||||
merge_alpha.unwrap_or(true),
|
merge_alpha.unwrap_or(true),
|
||||||
);
|
);
|
||||||
|
@ -953,8 +953,8 @@ pub fn copy_pixels<'gc>(
|
||||||
} else {
|
} else {
|
||||||
operations::copy_pixels(
|
operations::copy_pixels(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
src_bitmap.bitmap_data_wrapper(),
|
src_bitmap.bitmap_data(),
|
||||||
(src_min_x, src_min_y, src_width, src_height),
|
(src_min_x, src_min_y, src_width, src_height),
|
||||||
(dest_x, dest_y),
|
(dest_x, dest_y),
|
||||||
// Despite what the docs claim, mergeAlpa appears to be treated as 'false'
|
// Despite what the docs claim, mergeAlpa appears to be treated as 'false'
|
||||||
|
@ -1034,8 +1034,8 @@ pub fn merge<'gc>(
|
||||||
if !src_bitmap.disposed() {
|
if !src_bitmap.disposed() {
|
||||||
operations::merge(
|
operations::merge(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
src_bitmap.bitmap_data_wrapper(),
|
src_bitmap.bitmap_data(),
|
||||||
(src_min_x, src_min_y, src_width, src_height),
|
(src_min_x, src_min_y, src_width, src_height),
|
||||||
(dest_x, dest_y),
|
(dest_x, dest_y),
|
||||||
(red_mult, green_mult, blue_mult, alpha_mult),
|
(red_mult, green_mult, blue_mult, alpha_mult),
|
||||||
|
@ -1113,8 +1113,8 @@ pub fn palette_map<'gc>(
|
||||||
if !src_bitmap.disposed() {
|
if !src_bitmap.disposed() {
|
||||||
operations::palette_map(
|
operations::palette_map(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
src_bitmap.bitmap_data_wrapper(),
|
src_bitmap.bitmap_data(),
|
||||||
(src_min_x, src_min_y, src_width, src_height),
|
(src_min_x, src_min_y, src_width, src_height),
|
||||||
(dest_x, dest_y),
|
(dest_x, dest_y),
|
||||||
(red_array, green_array, blue_array, alpha_array),
|
(red_array, green_array, blue_array, alpha_array),
|
||||||
|
@ -1160,12 +1160,7 @@ pub fn scroll<'gc>(
|
||||||
.unwrap_or(&Value::Undefined)
|
.unwrap_or(&Value::Undefined)
|
||||||
.coerce_to_i32(activation)?;
|
.coerce_to_i32(activation)?;
|
||||||
|
|
||||||
operations::scroll(
|
operations::scroll(&mut activation.context, bitmap_data.bitmap_data(), x, y);
|
||||||
&mut activation.context,
|
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
|
||||||
x,
|
|
||||||
y,
|
|
||||||
);
|
|
||||||
|
|
||||||
return Ok(Value::Undefined);
|
return Ok(Value::Undefined);
|
||||||
}
|
}
|
||||||
|
@ -1243,8 +1238,8 @@ pub fn threshold<'gc>(
|
||||||
if !src_bitmap.disposed() {
|
if !src_bitmap.disposed() {
|
||||||
let modified_count = operations::threshold(
|
let modified_count = operations::threshold(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data(),
|
||||||
src_bitmap.bitmap_data_wrapper(),
|
src_bitmap.bitmap_data(),
|
||||||
(src_min_x, src_min_y, src_width, src_height),
|
(src_min_x, src_min_y, src_width, src_height),
|
||||||
(dest_x, dest_y),
|
(dest_x, dest_y),
|
||||||
operation,
|
operation,
|
||||||
|
@ -1303,8 +1298,8 @@ pub fn compare<'gc>(
|
||||||
return Ok(BITMAP_DISPOSED.into());
|
return Ok(BITMAP_DISPOSED.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
let this_bitmap_data = this_bitmap_data.bitmap_data_wrapper();
|
let this_bitmap_data = this_bitmap_data.bitmap_data();
|
||||||
let other_bitmap_data = other_bitmap_data.bitmap_data_wrapper();
|
let other_bitmap_data = other_bitmap_data.bitmap_data();
|
||||||
|
|
||||||
if this_bitmap_data.width() != other_bitmap_data.width() {
|
if this_bitmap_data.width() != other_bitmap_data.width() {
|
||||||
return Ok(DIFFERENT_WIDTHS.into());
|
return Ok(DIFFERENT_WIDTHS.into());
|
||||||
|
@ -1367,7 +1362,7 @@ pub fn load_bitmap<'gc>(
|
||||||
let (sync, _) = new_bitmap_data
|
let (sync, _) = new_bitmap_data
|
||||||
.as_bitmap_data_object()
|
.as_bitmap_data_object()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.bitmap_data_wrapper()
|
.bitmap_data()
|
||||||
.overwrite_cpu_pixels_from_gpu(&mut activation.context);
|
.overwrite_cpu_pixels_from_gpu(&mut activation.context);
|
||||||
|
|
||||||
sync.write(activation.context.gc_context)
|
sync.write(activation.context.gc_context)
|
||||||
|
|
|
@ -247,7 +247,7 @@ fn attach_bitmap<'gc>(
|
||||||
if let Some(bitmap_data) = bitmap
|
if let Some(bitmap_data) = bitmap
|
||||||
.coerce_to_object(activation)
|
.coerce_to_object(activation)
|
||||||
.as_bitmap_data_object()
|
.as_bitmap_data_object()
|
||||||
.map(|bd| bd.bitmap_data_wrapper())
|
.map(|bd| bd.bitmap_data())
|
||||||
{
|
{
|
||||||
if let Some(depth) = args.get(1) {
|
if let Some(depth) = args.get(1) {
|
||||||
let depth = depth
|
let depth = depth
|
||||||
|
@ -400,7 +400,7 @@ fn begin_bitmap_fill<'gc>(
|
||||||
.and_then(|val| val.coerce_to_object(activation).as_bitmap_data_object())
|
.and_then(|val| val.coerce_to_object(activation).as_bitmap_data_object())
|
||||||
{
|
{
|
||||||
// Register the bitmap data with the drawing.
|
// Register the bitmap data with the drawing.
|
||||||
let bitmap_data = bitmap_data.bitmap_data_wrapper();
|
let bitmap_data = bitmap_data.bitmap_data();
|
||||||
let handle =
|
let handle =
|
||||||
bitmap_data.bitmap_handle(activation.context.gc_context, activation.context.renderer);
|
bitmap_data.bitmap_handle(activation.context.gc_context, activation.context.renderer);
|
||||||
let bitmap = ruffle_render::bitmap::BitmapInfo {
|
let bitmap = ruffle_render::bitmap::BitmapInfo {
|
||||||
|
|
|
@ -28,7 +28,7 @@ impl fmt::Debug for BitmapDataObject<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'gc> BitmapDataObject<'gc> {
|
impl<'gc> BitmapDataObject<'gc> {
|
||||||
pub fn bitmap_data_wrapper(&self) -> BitmapDataWrapper<'gc> {
|
pub fn bitmap_data(&self) -> BitmapDataWrapper<'gc> {
|
||||||
self.0.read().data
|
self.0.read().data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ impl<'gc> BitmapDataObject<'gc> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dispose(&self, context: &mut UpdateContext<'_, 'gc>) {
|
pub fn dispose(&self, context: &mut UpdateContext<'_, 'gc>) {
|
||||||
self.bitmap_data_wrapper().dispose(context.gc_context);
|
self.bitmap_data().dispose(context.gc_context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue