mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-23 18:39:55 +00:00
Simplify code in generic_surface.h for gcc/clang
This commit is contained in:
parent
9784c0d455
commit
fb10cf1d36
@ -57,8 +57,8 @@ public:
|
|||||||
|
|
||||||
void drawColoredRgbaSurface(const Surface* src, gfx::Color fg, gfx::Color bg, const gfx::Clip& clipbase) override {
|
void drawColoredRgbaSurface(const Surface* src, gfx::Color fg, gfx::Color bg, const gfx::Clip& clipbase) override {
|
||||||
gfx::Clip clip(clipbase);
|
gfx::Clip clip(clipbase);
|
||||||
if (!clip.clip(static_cast<Base*>(this)->width(),
|
if (!clip.clip(this->width(),
|
||||||
static_cast<Base*>(this)->height(),
|
this->height(),
|
||||||
src->width(), src->height()))
|
src->width(), src->height()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ public:
|
|||||||
clip.src.x, clip.src.y+v);
|
clip.src.x, clip.src.y+v);
|
||||||
|
|
||||||
for (int u=0; u<clip.size.w; ++u) {
|
for (int u=0; u<clip.size.w; ++u) {
|
||||||
gfx::Color dstColor = static_cast<Base*>(this)->getPixel(clip.dst.x+u, clip.dst.y+v);
|
gfx::Color dstColor = this->getPixel(clip.dst.x+u, clip.dst.y+v);
|
||||||
if (gfx::geta(bg) > 0)
|
if (gfx::geta(bg) > 0)
|
||||||
dstColor = blend(dstColor, bg);
|
dstColor = blend(dstColor, bg);
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ public:
|
|||||||
dstColor = blend(dstColor, src);
|
dstColor = blend(dstColor, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
static_cast<Base*>(this)->putPixel(dstColor, clip.dst.x+u, clip.dst.y+v);
|
this->putPixel(dstColor, clip.dst.x+u, clip.dst.y+v);
|
||||||
++ptr;
|
++ptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ public:
|
|||||||
if (!charBounds.isEmpty()) {
|
if (!charBounds.isEmpty()) {
|
||||||
Surface* sheet = ssFont->getSurfaceSheet();
|
Surface* sheet = ssFont->getSurfaceSheet();
|
||||||
SurfaceLock lock(sheet);
|
SurfaceLock lock(sheet);
|
||||||
static_cast<Base*>(this)->drawColoredRgbaSurface(sheet, fg, bg, gfx::Clip(x, y, charBounds));
|
this->drawColoredRgbaSurface(sheet, fg, bg, gfx::Clip(x, y, charBounds));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -141,10 +141,10 @@ public:
|
|||||||
int fg_alpha = gfx::geta(fg);
|
int fg_alpha = gfx::geta(fg);
|
||||||
|
|
||||||
gfx::Rect bounds = ttFont->face().calcTextBounds(str);
|
gfx::Rect bounds = ttFont->face().calcTextBounds(str);
|
||||||
gfx::Rect clipBounds = static_cast<Base*>(this)->getClipBounds();
|
gfx::Rect clipBounds = this->getClipBounds();
|
||||||
|
|
||||||
she::SurfaceFormatData fd;
|
she::SurfaceFormatData fd;
|
||||||
static_cast<Base*>(this)->getFormat(&fd);
|
this->getFormat(&fd);
|
||||||
|
|
||||||
ttFont->face().forEachGlyph(
|
ttFont->face().forEachGlyph(
|
||||||
str,
|
str,
|
||||||
@ -167,7 +167,7 @@ public:
|
|||||||
+ (v+clippedRows)*glyph.bitmap->pitch;
|
+ (v+clippedRows)*glyph.bitmap->pitch;
|
||||||
int dst_x = dstBounds.x;
|
int dst_x = dstBounds.x;
|
||||||
uint32_t* dst_address =
|
uint32_t* dst_address =
|
||||||
(uint32_t*)static_cast<Base*>(this)->getData(dst_x, dst_y);
|
(uint32_t*)this->getData(dst_x, dst_y);
|
||||||
|
|
||||||
// Skip first clipped pixels
|
// Skip first clipped pixels
|
||||||
for (int u=0; u<dstBounds.x-origDstBounds.x; ++u) {
|
for (int u=0; u<dstBounds.x-origDstBounds.x; ++u) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user