Merge pull request #64198 from Geometror/add-bitmap-tests
This commit is contained in:
commit
5263fd5343
11 changed files with 581 additions and 95 deletions
|
|
@ -81,7 +81,7 @@ void EditorAtlasPacker::chart_pack(Vector<Chart> &charts, int &r_width, int &r_h
|
|||
int l = k == 0 ? 2 : k - 1;
|
||||
Vector<Point2i> points = Geometry2D::bresenham_line(v[k], v[l]);
|
||||
for (Point2i point : points) {
|
||||
src_bitmap->set_bit(point, true);
|
||||
src_bitmap->set_bitv(point, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -128,7 +128,7 @@ void EditorAtlasPacker::chart_pack(Vector<Chart> &charts, int &r_width, int &r_h
|
|||
continue;
|
||||
}
|
||||
|
||||
if (src_bitmap->get_bit(Vector2(px, py))) {
|
||||
if (src_bitmap->get_bit(px, py)) {
|
||||
found_pixel = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ Error ResourceImporterBitMap::import(const String &p_source_file, const String &
|
|||
bit = c.a > threshold;
|
||||
}
|
||||
|
||||
bitmap->set_bit(Vector2(j, i), bit);
|
||||
bitmap->set_bit(j, i, bit);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ Ref<Texture2D> EditorBitmapPreviewPlugin::generate(const Ref<Resource> &p_from,
|
|||
|
||||
for (int i = 0; i < bm->get_size().width; i++) {
|
||||
for (int j = 0; j < bm->get_size().height; j++) {
|
||||
if (bm->get_bit(Point2i(i, j))) {
|
||||
if (bm->get_bit(i, j)) {
|
||||
w[j * (int)bm->get_size().width + i] = 255;
|
||||
} else {
|
||||
w[j * (int)bm->get_size().width + i] = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue