core: Rename bitmap_data_operations to just operations
This commit is contained in:
parent
94e5aa8f34
commit
66e2eb77e5
|
@ -8,7 +8,7 @@ use crate::avm1::property_decl::{define_properties_on, Declaration};
|
||||||
use crate::avm1::{Activation, Error, Object, TObject, Value};
|
use crate::avm1::{Activation, Error, Object, TObject, Value};
|
||||||
use crate::bitmap::bitmap_data::{BitmapDataDrawError, IBitmapDrawable};
|
use crate::bitmap::bitmap_data::{BitmapDataDrawError, IBitmapDrawable};
|
||||||
use crate::bitmap::bitmap_data::{ChannelOptions, ThresholdOperation};
|
use crate::bitmap::bitmap_data::{ChannelOptions, ThresholdOperation};
|
||||||
use crate::bitmap::{bitmap_data_operations, is_size_valid};
|
use crate::bitmap::{is_size_valid, operations};
|
||||||
use crate::character::Character;
|
use crate::character::Character;
|
||||||
use crate::display_object::TDisplayObject;
|
use crate::display_object::TDisplayObject;
|
||||||
use crate::swf::BlendMode;
|
use crate::swf::BlendMode;
|
||||||
|
@ -162,8 +162,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 =
|
let col = operations::get_pixel(bitmap_data.bitmap_data_wrapper(), x, y);
|
||||||
bitmap_data_operations::get_pixel(bitmap_data.bitmap_data_wrapper(), x, y);
|
|
||||||
return Ok(col.into());
|
return Ok(col.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,8 +181,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 =
|
let col = operations::get_pixel32(bitmap_data.bitmap_data_wrapper(), x, y);
|
||||||
bitmap_data_operations::get_pixel32(bitmap_data.bitmap_data_wrapper(), x, y);
|
|
||||||
return Ok(col.into());
|
return Ok(col.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,7 +204,7 @@ pub fn set_pixel<'gc>(
|
||||||
let y = y_val.coerce_to_u32(activation)?;
|
let y = y_val.coerce_to_u32(activation)?;
|
||||||
let color = color_val.coerce_to_i32(activation)?;
|
let color = color_val.coerce_to_i32(activation)?;
|
||||||
|
|
||||||
bitmap_data_operations::set_pixel(
|
operations::set_pixel(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
x,
|
x,
|
||||||
|
@ -236,7 +234,7 @@ pub fn set_pixel32<'gc>(
|
||||||
let y = y_val.coerce_to_u32(activation)?;
|
let y = y_val.coerce_to_u32(activation)?;
|
||||||
let color = color_val.coerce_to_i32(activation)?;
|
let color = color_val.coerce_to_i32(activation)?;
|
||||||
|
|
||||||
bitmap_data_operations::set_pixel32(
|
operations::set_pixel32(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
x,
|
x,
|
||||||
|
@ -308,7 +306,7 @@ pub fn copy_channel<'gc>(
|
||||||
.get("height", activation)?
|
.get("height", activation)?
|
||||||
.coerce_to_u32(activation)?;
|
.coerce_to_u32(activation)?;
|
||||||
|
|
||||||
bitmap_data_operations::copy_channel(
|
operations::copy_channel(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
(min_x, min_y),
|
(min_x, min_y),
|
||||||
|
@ -349,7 +347,7 @@ pub fn fill_rect<'gc>(
|
||||||
.get("height", activation)?
|
.get("height", activation)?
|
||||||
.coerce_to_i32(activation)?;
|
.coerce_to_i32(activation)?;
|
||||||
|
|
||||||
bitmap_data_operations::fill_rect(
|
operations::fill_rect(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
x,
|
x,
|
||||||
|
@ -425,7 +423,7 @@ pub fn flood_fill<'gc>(
|
||||||
let y = y_val.coerce_to_u32(activation)?;
|
let y = y_val.coerce_to_u32(activation)?;
|
||||||
let color = color_val.coerce_to_i32(activation)?;
|
let color = color_val.coerce_to_i32(activation)?;
|
||||||
|
|
||||||
bitmap_data_operations::flood_fill(
|
operations::flood_fill(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
x,
|
x,
|
||||||
|
@ -467,7 +465,7 @@ pub fn noise<'gc>(
|
||||||
if !bitmap_data.disposed() {
|
if !bitmap_data.disposed() {
|
||||||
if let Some(random_seed_val) = args.get(0) {
|
if let Some(random_seed_val) = args.get(0) {
|
||||||
let random_seed = random_seed_val.coerce_to_i32(activation)?;
|
let random_seed = random_seed_val.coerce_to_i32(activation)?;
|
||||||
bitmap_data_operations::noise(
|
operations::noise(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
random_seed,
|
random_seed,
|
||||||
|
@ -547,7 +545,7 @@ pub fn draw<'gc>(
|
||||||
// Do this last, so that we only call `overwrite_cpu_pixels_from_gpu`
|
// Do this last, so that we only call `overwrite_cpu_pixels_from_gpu`
|
||||||
// if we're actually going to draw something.
|
// if we're actually going to draw something.
|
||||||
let quality = activation.context.stage.quality();
|
let quality = activation.context.stage.quality();
|
||||||
match bitmap_data_operations::draw(
|
match operations::draw(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
source,
|
source,
|
||||||
|
@ -628,7 +626,7 @@ pub fn color_transform<'gc>(
|
||||||
None => return Ok((-3).into()),
|
None => return Ok((-3).into()),
|
||||||
};
|
};
|
||||||
|
|
||||||
bitmap_data_operations::color_transform(
|
operations::color_transform(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
x_min,
|
x_min,
|
||||||
|
@ -660,7 +658,7 @@ pub fn get_color_bounds_rect<'gc>(
|
||||||
let mask = mask_val.coerce_to_i32(activation)?;
|
let mask = mask_val.coerce_to_i32(activation)?;
|
||||||
let color = color_val.coerce_to_i32(activation)?;
|
let color = color_val.coerce_to_i32(activation)?;
|
||||||
|
|
||||||
let (x, y, w, h) = bitmap_data_operations::color_bounds_rect(
|
let (x, y, w, h) = operations::color_bounds_rect(
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
find_color,
|
find_color,
|
||||||
mask,
|
mask,
|
||||||
|
@ -736,7 +734,7 @@ pub fn perlin_noise<'gc>(
|
||||||
.collect();
|
.collect();
|
||||||
let octave_offsets = octave_offsets?;
|
let octave_offsets = octave_offsets?;
|
||||||
|
|
||||||
bitmap_data_operations::perlin_noise(
|
operations::perlin_noise(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
(base_x, base_y),
|
(base_x, base_y),
|
||||||
|
@ -809,7 +807,7 @@ pub fn hit_test<'gc>(
|
||||||
.unwrap_or(&Value::Undefined)
|
.unwrap_or(&Value::Undefined)
|
||||||
.coerce_to_u32(activation)?;
|
.coerce_to_u32(activation)?;
|
||||||
|
|
||||||
let result = bitmap_data_operations::hit_test_bitmapdata(
|
let result = operations::hit_test_bitmapdata(
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
top_left,
|
top_left,
|
||||||
source_threshold,
|
source_threshold,
|
||||||
|
@ -834,7 +832,7 @@ pub fn hit_test<'gc>(
|
||||||
test_x.coerce_to_i32(activation)? - top_left.0,
|
test_x.coerce_to_i32(activation)? - top_left.0,
|
||||||
test_y.coerce_to_i32(activation)? - top_left.1,
|
test_y.coerce_to_i32(activation)? - top_left.1,
|
||||||
);
|
);
|
||||||
return Ok(Value::Bool(bitmap_data_operations::hit_test_point(
|
return Ok(Value::Bool(operations::hit_test_point(
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
source_threshold,
|
source_threshold,
|
||||||
test_point,
|
test_point,
|
||||||
|
@ -851,7 +849,7 @@ pub fn hit_test<'gc>(
|
||||||
test_width.coerce_to_i32(activation)?,
|
test_width.coerce_to_i32(activation)?,
|
||||||
test_height.coerce_to_i32(activation)?,
|
test_height.coerce_to_i32(activation)?,
|
||||||
);
|
);
|
||||||
return Ok(Value::Bool(bitmap_data_operations::hit_test_rectangle(
|
return Ok(Value::Bool(operations::hit_test_rectangle(
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
source_threshold,
|
source_threshold,
|
||||||
test_point,
|
test_point,
|
||||||
|
@ -944,7 +942,7 @@ pub fn copy_pixels<'gc>(
|
||||||
.coerce_to_f64(activation)?
|
.coerce_to_f64(activation)?
|
||||||
as i32;
|
as i32;
|
||||||
|
|
||||||
bitmap_data_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_wrapper(),
|
||||||
src_bitmap.bitmap_data_wrapper(),
|
src_bitmap.bitmap_data_wrapper(),
|
||||||
|
@ -956,7 +954,7 @@ pub fn copy_pixels<'gc>(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bitmap_data_operations::copy_pixels(
|
operations::copy_pixels(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
src_bitmap.bitmap_data_wrapper(),
|
src_bitmap.bitmap_data_wrapper(),
|
||||||
|
@ -1037,7 +1035,7 @@ pub fn merge<'gc>(
|
||||||
|
|
||||||
if let Some(src_bitmap) = source_bitmap.as_bitmap_data_object() {
|
if let Some(src_bitmap) = source_bitmap.as_bitmap_data_object() {
|
||||||
if !src_bitmap.disposed() {
|
if !src_bitmap.disposed() {
|
||||||
bitmap_data_operations::merge(
|
operations::merge(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
src_bitmap.bitmap_data_wrapper(),
|
src_bitmap.bitmap_data_wrapper(),
|
||||||
|
@ -1116,7 +1114,7 @@ pub fn palette_map<'gc>(
|
||||||
|
|
||||||
if let Some(src_bitmap) = source_bitmap.as_bitmap_data_object() {
|
if let Some(src_bitmap) = source_bitmap.as_bitmap_data_object() {
|
||||||
if !src_bitmap.disposed() {
|
if !src_bitmap.disposed() {
|
||||||
bitmap_data_operations::palette_map(
|
operations::palette_map(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
src_bitmap.bitmap_data_wrapper(),
|
src_bitmap.bitmap_data_wrapper(),
|
||||||
|
@ -1165,7 +1163,7 @@ pub fn scroll<'gc>(
|
||||||
.unwrap_or(&Value::Undefined)
|
.unwrap_or(&Value::Undefined)
|
||||||
.coerce_to_i32(activation)?;
|
.coerce_to_i32(activation)?;
|
||||||
|
|
||||||
bitmap_data_operations::scroll(
|
operations::scroll(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
x,
|
x,
|
||||||
|
@ -1246,7 +1244,7 @@ pub fn threshold<'gc>(
|
||||||
|
|
||||||
if let Some(src_bitmap) = source_bitmap.as_bitmap_data_object() {
|
if let Some(src_bitmap) = source_bitmap.as_bitmap_data_object() {
|
||||||
if !src_bitmap.disposed() {
|
if !src_bitmap.disposed() {
|
||||||
let modified_count = bitmap_data_operations::threshold(
|
let modified_count = operations::threshold(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data.bitmap_data_wrapper(),
|
bitmap_data.bitmap_data_wrapper(),
|
||||||
src_bitmap.bitmap_data_wrapper(),
|
src_bitmap.bitmap_data_wrapper(),
|
||||||
|
@ -1319,7 +1317,7 @@ pub fn compare<'gc>(
|
||||||
return Ok(DIFFERENT_HEIGHTS.into());
|
return Ok(DIFFERENT_HEIGHTS.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
match bitmap_data_operations::compare(this_bitmap_data, other_bitmap_data) {
|
match operations::compare(this_bitmap_data, other_bitmap_data) {
|
||||||
Some(bitmap_data) => Ok(BitmapDataObject::with_bitmap_data(
|
Some(bitmap_data) => Ok(BitmapDataObject::with_bitmap_data(
|
||||||
activation.context.gc_context,
|
activation.context.gc_context,
|
||||||
activation.context.avm1.prototypes().bitmap_data,
|
activation.context.avm1.prototypes().bitmap_data,
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::avm2::Error;
|
||||||
use crate::avm2_stub_method;
|
use crate::avm2_stub_method;
|
||||||
use crate::bitmap::bitmap_data::{BitmapData, ChannelOptions, Color, ThresholdOperation};
|
use crate::bitmap::bitmap_data::{BitmapData, ChannelOptions, Color, ThresholdOperation};
|
||||||
use crate::bitmap::bitmap_data::{BitmapDataDrawError, IBitmapDrawable};
|
use crate::bitmap::bitmap_data::{BitmapDataDrawError, IBitmapDrawable};
|
||||||
use crate::bitmap::{bitmap_data_operations, is_size_valid};
|
use crate::bitmap::{is_size_valid, operations};
|
||||||
use crate::character::Character;
|
use crate::character::Character;
|
||||||
use crate::display_object::Bitmap;
|
use crate::display_object::Bitmap;
|
||||||
use crate::swf::BlendMode;
|
use crate::swf::BlendMode;
|
||||||
|
@ -164,7 +164,7 @@ pub fn scroll<'gc>(
|
||||||
let x = args.get_i32(activation, 0)?;
|
let x = args.get_i32(activation, 0)?;
|
||||||
let y = args.get_i32(activation, 1)?;
|
let y = args.get_i32(activation, 1)?;
|
||||||
|
|
||||||
bitmap_data_operations::scroll(&mut activation.context, bitmap_data, x, y);
|
operations::scroll(&mut activation.context, bitmap_data, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Value::Undefined)
|
Ok(Value::Undefined)
|
||||||
|
@ -239,7 +239,7 @@ pub fn copy_pixels<'gc>(
|
||||||
let merge_alpha = args.get_bool(5);
|
let merge_alpha = args.get_bool(5);
|
||||||
|
|
||||||
if let Some((alpha_bitmap, alpha_point)) = alpha_source {
|
if let Some((alpha_bitmap, alpha_point)) = alpha_source {
|
||||||
bitmap_data_operations::copy_pixels_with_alpha_source(
|
operations::copy_pixels_with_alpha_source(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data,
|
bitmap_data,
|
||||||
src_bitmap,
|
src_bitmap,
|
||||||
|
@ -250,7 +250,7 @@ pub fn copy_pixels<'gc>(
|
||||||
merge_alpha,
|
merge_alpha,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
bitmap_data_operations::copy_pixels(
|
operations::copy_pixels(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data,
|
bitmap_data,
|
||||||
src_bitmap,
|
src_bitmap,
|
||||||
|
@ -288,7 +288,7 @@ pub fn get_pixels<'gc>(
|
||||||
.coerce_to_i32(activation)?;
|
.coerce_to_i32(activation)?;
|
||||||
let bytearray = ByteArrayObject::from_storage(
|
let bytearray = ByteArrayObject::from_storage(
|
||||||
activation,
|
activation,
|
||||||
bitmap_data_operations::get_pixels_as_byte_array(bitmap_data, x, y, width, height)?,
|
operations::get_pixels_as_byte_array(bitmap_data, x, y, width, height)?,
|
||||||
)?;
|
)?;
|
||||||
return Ok(bytearray.into());
|
return Ok(bytearray.into());
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,7 @@ pub fn get_vector<'gc>(
|
||||||
.get_public_property("height", activation)?
|
.get_public_property("height", activation)?
|
||||||
.coerce_to_i32(activation)?;
|
.coerce_to_i32(activation)?;
|
||||||
|
|
||||||
let pixels = bitmap_data_operations::get_vector(bitmap_data, x, y, width, height);
|
let pixels = operations::get_vector(bitmap_data, x, y, width, height);
|
||||||
|
|
||||||
let value_type = activation.avm2().classes().uint;
|
let value_type = activation.avm2().classes().uint;
|
||||||
let new_storage = VectorStorage::from_values(pixels, false, value_type);
|
let new_storage = VectorStorage::from_values(pixels, false, value_type);
|
||||||
|
@ -338,7 +338,7 @@ pub fn get_pixel<'gc>(
|
||||||
bitmap_data.check_valid(activation)?;
|
bitmap_data.check_valid(activation)?;
|
||||||
let x = args.get_u32(activation, 0)?;
|
let x = args.get_u32(activation, 0)?;
|
||||||
let y = args.get_u32(activation, 1)?;
|
let y = args.get_u32(activation, 1)?;
|
||||||
let col = bitmap_data_operations::get_pixel(bitmap_data, x, y);
|
let col = operations::get_pixel(bitmap_data, x, y);
|
||||||
return Ok(col.into());
|
return Ok(col.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ pub fn get_pixel32<'gc>(
|
||||||
if let Some(bitmap_data) = this.and_then(|t| t.as_bitmap_data_wrapper()) {
|
if let Some(bitmap_data) = this.and_then(|t| t.as_bitmap_data_wrapper()) {
|
||||||
let x = args.get_u32(activation, 0)?;
|
let x = args.get_u32(activation, 0)?;
|
||||||
let y = args.get_u32(activation, 1)?;
|
let y = args.get_u32(activation, 1)?;
|
||||||
let pixel = bitmap_data_operations::get_pixel32(bitmap_data, x, y);
|
let pixel = operations::get_pixel32(bitmap_data, x, y);
|
||||||
return Ok((pixel as u32).into());
|
return Ok((pixel as u32).into());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ pub fn set_pixel<'gc>(
|
||||||
let x = args.get_u32(activation, 0)?;
|
let x = args.get_u32(activation, 0)?;
|
||||||
let y = args.get_u32(activation, 1)?;
|
let y = args.get_u32(activation, 1)?;
|
||||||
let color = args.get_i32(activation, 2)?;
|
let color = args.get_i32(activation, 2)?;
|
||||||
bitmap_data_operations::set_pixel(&mut activation.context, bitmap_data, x, y, color.into());
|
operations::set_pixel(&mut activation.context, bitmap_data, x, y, color.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Value::Undefined)
|
Ok(Value::Undefined)
|
||||||
|
@ -388,7 +388,7 @@ pub fn set_pixel32<'gc>(
|
||||||
let y = args.get_u32(activation, 1)?;
|
let y = args.get_u32(activation, 1)?;
|
||||||
let color = args.get_i32(activation, 2)?;
|
let color = args.get_i32(activation, 2)?;
|
||||||
|
|
||||||
bitmap_data_operations::set_pixel32(&mut activation.context, bitmap_data, x, y, color);
|
operations::set_pixel32(&mut activation.context, bitmap_data, x, y, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Value::Undefined)
|
Ok(Value::Undefined)
|
||||||
|
@ -495,7 +495,7 @@ pub fn copy_channel<'gc>(
|
||||||
.get_public_property("height", activation)?
|
.get_public_property("height", activation)?
|
||||||
.coerce_to_u32(activation)?;
|
.coerce_to_u32(activation)?;
|
||||||
|
|
||||||
bitmap_data_operations::copy_channel(
|
operations::copy_channel(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data,
|
bitmap_data,
|
||||||
(dest_x, dest_y),
|
(dest_x, dest_y),
|
||||||
|
@ -520,7 +520,7 @@ pub fn flood_fill<'gc>(
|
||||||
let y = args.get_u32(activation, 1)?;
|
let y = args.get_u32(activation, 1)?;
|
||||||
let color = args.get_i32(activation, 2)?;
|
let color = args.get_i32(activation, 2)?;
|
||||||
|
|
||||||
bitmap_data_operations::flood_fill(&mut activation.context, bitmap_data, x, y, color);
|
operations::flood_fill(&mut activation.context, bitmap_data, x, y, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,7 +542,7 @@ pub fn noise<'gc>(
|
||||||
|
|
||||||
if let Some(bitmap_data) = this.and_then(|t| t.as_bitmap_data_wrapper()) {
|
if let Some(bitmap_data) = this.and_then(|t| t.as_bitmap_data_wrapper()) {
|
||||||
let random_seed = args.get_i32(activation, 0)?;
|
let random_seed = args.get_i32(activation, 0)?;
|
||||||
bitmap_data_operations::noise(
|
operations::noise(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data,
|
bitmap_data,
|
||||||
random_seed,
|
random_seed,
|
||||||
|
@ -589,7 +589,7 @@ pub fn color_transform<'gc>(
|
||||||
activation,
|
activation,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
bitmap_data_operations::color_transform(
|
operations::color_transform(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data,
|
bitmap_data,
|
||||||
x_min,
|
x_min,
|
||||||
|
@ -616,8 +616,7 @@ pub fn get_color_bounds_rect<'gc>(
|
||||||
let mask = args.get_i32(activation, 0)?;
|
let mask = args.get_i32(activation, 0)?;
|
||||||
let color = args.get_i32(activation, 1)?;
|
let color = args.get_i32(activation, 1)?;
|
||||||
|
|
||||||
let (x, y, w, h) =
|
let (x, y, w, h) = operations::color_bounds_rect(bitmap_data, find_color, mask, color);
|
||||||
bitmap_data_operations::color_bounds_rect(bitmap_data, find_color, mask, color);
|
|
||||||
|
|
||||||
let rect = activation
|
let rect = activation
|
||||||
.avm2()
|
.avm2()
|
||||||
|
@ -682,7 +681,7 @@ pub fn hit_test<'gc>(
|
||||||
.coerce_to_i32(activation)?
|
.coerce_to_i32(activation)?
|
||||||
- top_left.1,
|
- top_left.1,
|
||||||
);
|
);
|
||||||
return Ok(Value::Bool(bitmap_data_operations::hit_test_point(
|
return Ok(Value::Bool(operations::hit_test_point(
|
||||||
bitmap_data,
|
bitmap_data,
|
||||||
source_threshold,
|
source_threshold,
|
||||||
test_point,
|
test_point,
|
||||||
|
@ -706,7 +705,7 @@ pub fn hit_test<'gc>(
|
||||||
.get_public_property("height", activation)?
|
.get_public_property("height", activation)?
|
||||||
.coerce_to_i32(activation)?,
|
.coerce_to_i32(activation)?,
|
||||||
);
|
);
|
||||||
return Ok(Value::Bool(bitmap_data_operations::hit_test_rectangle(
|
return Ok(Value::Bool(operations::hit_test_rectangle(
|
||||||
bitmap_data,
|
bitmap_data,
|
||||||
source_threshold,
|
source_threshold,
|
||||||
test_point,
|
test_point,
|
||||||
|
@ -725,7 +724,7 @@ pub fn hit_test<'gc>(
|
||||||
);
|
);
|
||||||
let second_threshold = args.get_u32(activation, 4)?;
|
let second_threshold = args.get_u32(activation, 4)?;
|
||||||
|
|
||||||
let result = bitmap_data_operations::hit_test_bitmapdata(
|
let result = operations::hit_test_bitmapdata(
|
||||||
bitmap_data,
|
bitmap_data,
|
||||||
top_left,
|
top_left,
|
||||||
source_threshold,
|
source_threshold,
|
||||||
|
@ -751,7 +750,7 @@ pub fn hit_test<'gc>(
|
||||||
);
|
);
|
||||||
let second_threshold = args.get_u32(activation, 4)?;
|
let second_threshold = args.get_u32(activation, 4)?;
|
||||||
|
|
||||||
return Ok(Value::Bool(bitmap_data_operations::hit_test_bitmapdata(
|
return Ok(Value::Bool(operations::hit_test_bitmapdata(
|
||||||
bitmap_data,
|
bitmap_data,
|
||||||
top_left,
|
top_left,
|
||||||
source_threshold,
|
source_threshold,
|
||||||
|
@ -833,7 +832,7 @@ pub fn draw<'gc>(
|
||||||
// Do this last, so that we only call `overwrite_cpu_pixels_from_gpu`
|
// Do this last, so that we only call `overwrite_cpu_pixels_from_gpu`
|
||||||
// if we're actually going to draw something.
|
// if we're actually going to draw something.
|
||||||
let quality = activation.context.stage.quality();
|
let quality = activation.context.stage.quality();
|
||||||
match bitmap_data_operations::draw(
|
match operations::draw(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data,
|
bitmap_data,
|
||||||
source,
|
source,
|
||||||
|
@ -921,7 +920,7 @@ pub fn draw_with_quality<'gc>(
|
||||||
activation.context.stage.quality()
|
activation.context.stage.quality()
|
||||||
};
|
};
|
||||||
|
|
||||||
match bitmap_data_operations::draw(
|
match operations::draw(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data,
|
bitmap_data,
|
||||||
source,
|
source,
|
||||||
|
@ -964,7 +963,7 @@ pub fn fill_rect<'gc>(
|
||||||
.get_public_property("height", activation)?
|
.get_public_property("height", activation)?
|
||||||
.coerce_to_i32(activation)?;
|
.coerce_to_i32(activation)?;
|
||||||
|
|
||||||
bitmap_data_operations::fill_rect(
|
operations::fill_rect(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data,
|
bitmap_data,
|
||||||
x,
|
x,
|
||||||
|
@ -1045,7 +1044,7 @@ pub fn apply_filter<'gc>(
|
||||||
);
|
);
|
||||||
let filter = args.get_object(activation, 3, "filter")?;
|
let filter = args.get_object(activation, 3, "filter")?;
|
||||||
let filter = Filter::from_avm2_object(activation, filter)?;
|
let filter = Filter::from_avm2_object(activation, filter)?;
|
||||||
bitmap_data_operations::apply_filter(
|
operations::apply_filter(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
dest_bitmap,
|
dest_bitmap,
|
||||||
source_bitmap,
|
source_bitmap,
|
||||||
|
@ -1141,7 +1140,7 @@ pub fn palette_map<'gc>(
|
||||||
let blue_array = get_channel(5, 0)?;
|
let blue_array = get_channel(5, 0)?;
|
||||||
let alpha_array = get_channel(6, 24)?;
|
let alpha_array = get_channel(6, 24)?;
|
||||||
|
|
||||||
bitmap_data_operations::palette_map(
|
operations::palette_map(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data,
|
bitmap_data,
|
||||||
source_bitmap,
|
source_bitmap,
|
||||||
|
@ -1198,7 +1197,7 @@ pub fn perlin_noise<'gc>(
|
||||||
.collect();
|
.collect();
|
||||||
let octave_offsets = octave_offsets?;
|
let octave_offsets = octave_offsets?;
|
||||||
|
|
||||||
bitmap_data_operations::perlin_noise(
|
operations::perlin_noise(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data,
|
bitmap_data,
|
||||||
(base_x, base_y),
|
(base_x, base_y),
|
||||||
|
@ -1272,7 +1271,7 @@ pub fn threshold<'gc>(
|
||||||
if let Some(src_bitmap) = src_bitmap.as_bitmap_data_wrapper() {
|
if let Some(src_bitmap) = src_bitmap.as_bitmap_data_wrapper() {
|
||||||
src_bitmap.check_valid(activation)?;
|
src_bitmap.check_valid(activation)?;
|
||||||
|
|
||||||
return Ok(bitmap_data_operations::threshold(
|
return Ok(operations::threshold(
|
||||||
&mut activation.context,
|
&mut activation.context,
|
||||||
bitmap_data,
|
bitmap_data,
|
||||||
src_bitmap,
|
src_bitmap,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
pub mod bitmap_data;
|
pub mod bitmap_data;
|
||||||
pub mod bitmap_data_operations;
|
pub mod operations;
|
||||||
pub mod turbulence;
|
pub mod turbulence;
|
||||||
|
|
||||||
/// Determine if a particular bitmap data size is valid.
|
/// Determine if a particular bitmap data size is valid.
|
||||||
|
|
Loading…
Reference in New Issue