mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-09 18:44:46 +00:00
Rename gfx::Rect::createIntersect -> createIntersection
This commit is contained in:
parent
394c431d61
commit
4d055a7170
@ -46,7 +46,7 @@ ClearMask::ClearMask(Cel* cel)
|
|||||||
m_offsetY = mask->bounds().y - cel->y();
|
m_offsetY = mask->bounds().y - cel->y();
|
||||||
|
|
||||||
gfx::Rect bounds =
|
gfx::Rect bounds =
|
||||||
image->bounds().createIntersect(
|
image->bounds().createIntersection(
|
||||||
gfx::Rect(
|
gfx::Rect(
|
||||||
m_offsetX, m_offsetY,
|
m_offsetX, m_offsetY,
|
||||||
mask->bounds().w, mask->bounds().h));
|
mask->bounds().w, mask->bounds().h));
|
||||||
|
@ -34,7 +34,7 @@ ClearRect::ClearRect(Cel* cel, const gfx::Rect& bounds)
|
|||||||
m_offsetY = bounds.y - cel->y();
|
m_offsetY = bounds.y - cel->y();
|
||||||
|
|
||||||
gfx::Rect bounds2 =
|
gfx::Rect bounds2 =
|
||||||
image->bounds().createIntersect(
|
image->bounds().createIntersection(
|
||||||
gfx::Rect(
|
gfx::Rect(
|
||||||
m_offsetX, m_offsetY,
|
m_offsetX, m_offsetY,
|
||||||
bounds.w, bounds.h));
|
bounds.w, bounds.h));
|
||||||
|
@ -107,7 +107,7 @@ void FlipCommand::onExecute(Context* context)
|
|||||||
// Intersect the full area of the image with the mask's
|
// Intersect the full area of the image with the mask's
|
||||||
// bounds, so we don't request to flip an area outside the
|
// bounds, so we don't request to flip an area outside the
|
||||||
// image's bounds.
|
// image's bounds.
|
||||||
bounds = bounds.createIntersect(gfx::Rect(mask->bounds()).offset(-x, -y));
|
bounds = bounds.createIntersection(gfx::Rect(mask->bounds()).offset(-x, -y));
|
||||||
|
|
||||||
// If the mask isn't a rectangular area, we've to flip the mask too.
|
// If the mask isn't a rectangular area, we've to flip the mask too.
|
||||||
if (mask->bitmap() && !mask->isRectangular()) {
|
if (mask->bitmap() && !mask->isRectangular()) {
|
||||||
|
@ -127,7 +127,7 @@ void FilterManagerImpl::beginForPreview()
|
|||||||
Sprite* sprite = m_site.sprite();
|
Sprite* sprite = m_site.sprite();
|
||||||
gfx::Rect vp = View::getView(editor)->getViewportBounds();
|
gfx::Rect vp = View::getView(editor)->getViewportBounds();
|
||||||
vp = editor->screenToEditor(vp);
|
vp = editor->screenToEditor(vp);
|
||||||
vp = vp.createIntersect(sprite->bounds());
|
vp = vp.createIntersection(sprite->bounds());
|
||||||
|
|
||||||
if (vp.isEmpty()) {
|
if (vp.isEmpty()) {
|
||||||
m_preview_mask.reset(NULL);
|
m_preview_mask.reset(NULL);
|
||||||
|
@ -101,7 +101,7 @@ private:
|
|||||||
offset.x, offset.y,
|
offset.x, offset.y,
|
||||||
loop->sprite()->width(), loop->sprite()->height());
|
loop->sprite()->width(), loop->sprite()->height());
|
||||||
|
|
||||||
bounds = bounds.createIntersect(loop->getSrcImage()->bounds());
|
bounds = bounds.createIntersection(loop->getSrcImage()->bounds());
|
||||||
|
|
||||||
// Limit the flood-fill to the current tile if the grid is visible.
|
// Limit the flood-fill to the current tile if the grid is visible.
|
||||||
if (loop->getGridVisible()) {
|
if (loop->getGridVisible()) {
|
||||||
@ -117,7 +117,7 @@ private:
|
|||||||
d = div(y-dy.rem, grid.h);
|
d = div(y-dy.rem, grid.h);
|
||||||
y = dy.rem + d.quot*grid.h;
|
y = dy.rem + d.quot*grid.h;
|
||||||
|
|
||||||
bounds = bounds.createIntersect(gfx::Rect(x, y, grid.w, grid.h));
|
bounds = bounds.createIntersection(gfx::Rect(x, y, grid.w, grid.h));
|
||||||
}
|
}
|
||||||
|
|
||||||
return bounds;
|
return bounds;
|
||||||
|
@ -368,7 +368,7 @@ void Editor::updateEditor()
|
|||||||
void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& spriteRectToDraw, int dx, int dy)
|
void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& spriteRectToDraw, int dx, int dy)
|
||||||
{
|
{
|
||||||
// Clip from sprite and apply zoom
|
// Clip from sprite and apply zoom
|
||||||
gfx::Rect rc = m_sprite->bounds().createIntersect(spriteRectToDraw);
|
gfx::Rect rc = m_sprite->bounds().createIntersection(spriteRectToDraw);
|
||||||
rc = m_zoom.apply(rc);
|
rc = m_zoom.apply(rc);
|
||||||
|
|
||||||
int dest_x = dx + m_offset_x + rc.x;
|
int dest_x = dx + m_offset_x + rc.x;
|
||||||
@ -566,7 +566,7 @@ void Editor::drawSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& _rc)
|
|||||||
{
|
{
|
||||||
// Clipping
|
// Clipping
|
||||||
gfx::Rect cliprc = editorToScreen(rc).offset(-getBounds().getOrigin());
|
gfx::Rect cliprc = editorToScreen(rc).offset(-getBounds().getOrigin());
|
||||||
cliprc = cliprc.createIntersect(spriteRect);
|
cliprc = cliprc.createIntersection(spriteRect);
|
||||||
if (!cliprc.isEmpty()) {
|
if (!cliprc.isEmpty()) {
|
||||||
IntersectClip clip(g, cliprc);
|
IntersectClip clip(g, cliprc);
|
||||||
|
|
||||||
@ -1085,7 +1085,7 @@ Rect Editor::getVisibleSpriteBounds()
|
|||||||
Rect vp = view->getViewportBounds();
|
Rect vp = view->getViewportBounds();
|
||||||
vp = screenToEditor(vp);
|
vp = screenToEditor(vp);
|
||||||
|
|
||||||
return vp.createIntersect(m_sprite->bounds());
|
return vp.createIntersection(m_sprite->bounds());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Changes the scroll to see the given point as the center of the editor.
|
// Changes the scroll to see the given point as the center of the editor.
|
||||||
|
@ -1795,7 +1795,7 @@ void SkinTheme::paintTooltip(PaintEvent& ev)
|
|||||||
// Draw arrow in sides
|
// Draw arrow in sides
|
||||||
she::Surface* arrow = NULL;
|
she::Surface* arrow = NULL;
|
||||||
gfx::Rect target(widget->target());
|
gfx::Rect target(widget->target());
|
||||||
target = target.createIntersect(gfx::Rect(0, 0, ui::display_w(), ui::display_h()));
|
target = target.createIntersection(gfx::Rect(0, 0, ui::display_w(), ui::display_h()));
|
||||||
target.offset(-absRc.getOrigin());
|
target.offset(-absRc.getOrigin());
|
||||||
|
|
||||||
switch (widget->getArrowAlign()) {
|
switch (widget->getArrowAlign()) {
|
||||||
@ -1902,7 +1902,7 @@ void SkinTheme::drawTextString(Graphics* g, const char *t, gfx::Color fg_color,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
Rect textWrap = textrc.createIntersect(
|
Rect textWrap = textrc.createIntersection(
|
||||||
// TODO add ui::Widget::getPadding() property
|
// TODO add ui::Widget::getPadding() property
|
||||||
// Rect(widget->getClientBounds()).shrink(widget->getBorder()));
|
// Rect(widget->getClientBounds()).shrink(widget->getBorder()));
|
||||||
widget->getClientBounds()).inflate(0, 1*guiscale());
|
widget->getClientBounds()).inflate(0, 1*guiscale());
|
||||||
|
@ -157,7 +157,7 @@ void fixup_image_transparent_colors(Image* image)
|
|||||||
count = 0;
|
count = 0;
|
||||||
r = g = b = 0;
|
r = g = b = 0;
|
||||||
|
|
||||||
gfx::Rect area = gfx::Rect(x-1, y-1, 3, 3).createIntersect(image->bounds());
|
gfx::Rect area = gfx::Rect(x-1, y-1, 3, 3).createIntersection(image->bounds());
|
||||||
LockImageBits<RgbTraits>::iterator it2 = bits.begin_area(area);
|
LockImageBits<RgbTraits>::iterator it2 = bits.begin_area(area);
|
||||||
LockImageBits<RgbTraits>::iterator end2 = bits.end_area(area);
|
LockImageBits<RgbTraits>::iterator end2 = bits.end_area(area);
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ void fixup_image_transparent_colors(Image* image)
|
|||||||
count = 0;
|
count = 0;
|
||||||
k = 0;
|
k = 0;
|
||||||
|
|
||||||
gfx::Rect area = gfx::Rect(x-1, y-1, 3, 3).createIntersect(image->bounds());
|
gfx::Rect area = gfx::Rect(x-1, y-1, 3, 3).createIntersection(image->bounds());
|
||||||
LockImageBits<GrayscaleTraits>::iterator it2 = bits.begin_area(area);
|
LockImageBits<GrayscaleTraits>::iterator it2 = bits.begin_area(area);
|
||||||
LockImageBits<GrayscaleTraits>::iterator end2 = bits.end_area(area);
|
LockImageBits<GrayscaleTraits>::iterator end2 = bits.end_area(area);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite Document Library
|
// Aseprite Document Library
|
||||||
// Copyright (c) 2001-2014 David Capello
|
// Copyright (c) 2001-2015 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
@ -55,7 +55,7 @@ uint32_t convert_color_to_surface<GrayscaleTraits, she::kRgbaSurfaceFormat>(colo
|
|||||||
template<>
|
template<>
|
||||||
uint32_t convert_color_to_surface<IndexedTraits, she::kRgbaSurfaceFormat>(color_t c0, const Palette* palette, const she::SurfaceFormatData* fd) {
|
uint32_t convert_color_to_surface<IndexedTraits, she::kRgbaSurfaceFormat>(color_t c0, const Palette* palette, const she::SurfaceFormatData* fd) {
|
||||||
color_t c = palette->getEntry(c0);
|
color_t c = palette->getEntry(c0);
|
||||||
return
|
return
|
||||||
((rgba_getr(c) << fd->redShift ) & fd->redMask ) |
|
((rgba_getr(c) << fd->redShift ) & fd->redMask ) |
|
||||||
((rgba_getg(c) << fd->greenShift) & fd->greenMask) |
|
((rgba_getg(c) << fd->greenShift) & fd->greenMask) |
|
||||||
((rgba_getb(c) << fd->blueShift ) & fd->blueMask ) |
|
((rgba_getb(c) << fd->blueShift ) & fd->blueMask ) |
|
||||||
@ -65,7 +65,7 @@ uint32_t convert_color_to_surface<IndexedTraits, she::kRgbaSurfaceFormat>(color_
|
|||||||
template<>
|
template<>
|
||||||
uint32_t convert_color_to_surface<BitmapTraits, she::kRgbaSurfaceFormat>(color_t c0, const Palette* palette, const she::SurfaceFormatData* fd) {
|
uint32_t convert_color_to_surface<BitmapTraits, she::kRgbaSurfaceFormat>(color_t c0, const Palette* palette, const she::SurfaceFormatData* fd) {
|
||||||
color_t c = palette->getEntry(c0);
|
color_t c = palette->getEntry(c0);
|
||||||
return
|
return
|
||||||
((rgba_getr(c) << fd->redShift ) & fd->redMask ) |
|
((rgba_getr(c) << fd->redShift ) & fd->redMask ) |
|
||||||
((rgba_getg(c) << fd->greenShift) & fd->greenMask) |
|
((rgba_getg(c) << fd->greenShift) & fd->greenMask) |
|
||||||
((rgba_getb(c) << fd->blueShift ) & fd->blueMask ) |
|
((rgba_getb(c) << fd->blueShift ) & fd->blueMask ) |
|
||||||
@ -137,7 +137,7 @@ void convert_image_to_surface(const Image* image, const Palette* palette,
|
|||||||
she::Surface* surface, int src_x, int src_y, int dst_x, int dst_y, int w, int h)
|
she::Surface* surface, int src_x, int src_y, int dst_x, int dst_y, int w, int h)
|
||||||
{
|
{
|
||||||
gfx::Rect srcBounds(src_x, src_y, w, h);
|
gfx::Rect srcBounds(src_x, src_y, w, h);
|
||||||
srcBounds = srcBounds.createIntersect(image->bounds());
|
srcBounds = srcBounds.createIntersection(image->bounds());
|
||||||
if (srcBounds.isEmpty())
|
if (srcBounds.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ void convert_image_to_surface(const Image* image, const Palette* palette,
|
|||||||
h = srcBounds.h;
|
h = srcBounds.h;
|
||||||
|
|
||||||
gfx::Rect dstBounds(dst_x, dst_y, w, h);
|
gfx::Rect dstBounds(dst_x, dst_y, w, h);
|
||||||
dstBounds = dstBounds.createIntersect(surface->getClipBounds());
|
dstBounds = dstBounds.createIntersection(surface->getClipBounds());
|
||||||
if (dstBounds.isEmpty())
|
if (dstBounds.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ void Mask::intersect(const gfx::Rect& bounds)
|
|||||||
if (!m_bitmap)
|
if (!m_bitmap)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gfx::Rect newBounds = m_bounds.createIntersect(bounds);
|
gfx::Rect newBounds = m_bounds.createIntersection(bounds);
|
||||||
|
|
||||||
Image* image = NULL;
|
Image* image = NULL;
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ void fill_rect(Image* image, const gfx::Rect& rc, color_t c)
|
|||||||
{
|
{
|
||||||
ASSERT(image);
|
ASSERT(image);
|
||||||
|
|
||||||
gfx::Rect clip = rc.createIntersect(image->bounds());
|
gfx::Rect clip = rc.createIntersection(image->bounds());
|
||||||
if (!clip.isEmpty())
|
if (!clip.isEmpty())
|
||||||
image->fillRect(clip.x, clip.y,
|
image->fillRect(clip.x, clip.y,
|
||||||
clip.x+clip.w-1, clip.y+clip.h-1, c);
|
clip.x+clip.w-1, clip.y+clip.h-1, c);
|
||||||
|
@ -233,7 +233,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns the intersection rectangle between this and rc rectangles.
|
// Returns the intersection rectangle between this and rc rectangles.
|
||||||
RectT createIntersect(const RectT& rc) const {
|
RectT createIntersection(const RectT& rc) const {
|
||||||
if (intersects(rc))
|
if (intersects(rc))
|
||||||
return RectT(PointT<T>(x > rc.x ? x: rc.x,
|
return RectT(PointT<T>(x > rc.x ? x: rc.x,
|
||||||
y > rc.y ? y: rc.y),
|
y > rc.y ? y: rc.y),
|
||||||
@ -258,7 +258,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const RectT& operator&=(const RectT& rc) {
|
const RectT& operator&=(const RectT& rc) {
|
||||||
return *this = createIntersect(rc);
|
return *this = createIntersection(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
RectT operator+(const BorderT<T>& br) const {
|
RectT operator+(const BorderT<T>& br) const {
|
||||||
@ -274,7 +274,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
RectT operator&(const RectT& other) const {
|
RectT operator&(const RectT& other) const {
|
||||||
return createIntersect(other);
|
return createIntersection(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const RectT& rc) const {
|
bool operator==(const RectT& rc) const {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite Gfx Library
|
// Aseprite Gfx Library
|
||||||
// Copyright (C) 2001-2013 David Capello
|
// Copyright (C) 2001-2013, 2015 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
@ -44,7 +44,7 @@ public:
|
|||||||
std::max(h, sz.h));
|
std::max(h, sz.h));
|
||||||
}
|
}
|
||||||
|
|
||||||
SizeT createIntersect(const SizeT& sz) const {
|
SizeT createIntersection(const SizeT& sz) const {
|
||||||
return SizeT(std::min(w, sz.w),
|
return SizeT(std::min(w, sz.w),
|
||||||
std::min(h, sz.h));
|
std::min(h, sz.h));
|
||||||
}
|
}
|
||||||
|
@ -591,7 +591,7 @@ void Render::renderBackground(Image* image,
|
|||||||
int u_start = u;
|
int u_start = u;
|
||||||
for (y=y_start-tile_h; y<image->height()+tile_h; y+=tile_h) {
|
for (y=y_start-tile_h; y<image->height()+tile_h; y+=tile_h) {
|
||||||
for (x=x_start-tile_w; x<image->width()+tile_w; x+=tile_w) {
|
for (x=x_start-tile_w; x<image->width()+tile_w; x+=tile_w) {
|
||||||
gfx::Rect fillRc = dstBounds.createIntersect(gfx::Rect(x, y, tile_w, tile_h));
|
gfx::Rect fillRc = dstBounds.createIntersection(gfx::Rect(x, y, tile_w, tile_h));
|
||||||
if (!fillRc.isEmpty())
|
if (!fillRc.isEmpty())
|
||||||
fill_rect(
|
fill_rect(
|
||||||
image, fillRc.x, fillRc.y, fillRc.x+fillRc.w-1, fillRc.y+fillRc.h-1,
|
image, fillRc.x, fillRc.y, fillRc.x+fillRc.w-1, fillRc.y+fillRc.h-1,
|
||||||
@ -763,7 +763,7 @@ void Render::renderCel(
|
|||||||
int cel_y = zoom.apply(cel->y());
|
int cel_y = zoom.apply(cel->y());
|
||||||
|
|
||||||
gfx::Rect src_bounds =
|
gfx::Rect src_bounds =
|
||||||
area.srcBounds().createIntersect(
|
area.srcBounds().createIntersection(
|
||||||
gfx::Rect(
|
gfx::Rect(
|
||||||
cel_x, cel_y,
|
cel_x, cel_y,
|
||||||
zoom.apply(cel_image->width()),
|
zoom.apply(cel_image->width()),
|
||||||
|
@ -747,8 +747,8 @@ bool MenuItem::onProcessMessage(Message* msg)
|
|||||||
r1.y = r2.y = y = MID(0, y, ui::display_h()-pos.h);
|
r1.y = r2.y = y = MID(0, y, ui::display_h()-pos.h);
|
||||||
|
|
||||||
// Calculate both intersections
|
// Calculate both intersections
|
||||||
gfx::Rect s1 = r1.createIntersect(old_pos);
|
gfx::Rect s1 = r1.createIntersection(old_pos);
|
||||||
gfx::Rect s2 = r2.createIntersect(old_pos);
|
gfx::Rect s2 = r2.createIntersection(old_pos);
|
||||||
|
|
||||||
if (s2.isEmpty())
|
if (s2.isEmpty())
|
||||||
x = x_right; // Use the right because there aren't intersection with it
|
x = x_right; // Use the right because there aren't intersection with it
|
||||||
|
Loading…
x
Reference in New Issue
Block a user