forked from beefviper/hode-vs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed 'libxbr-standalone' dependency
- Loading branch information
1 parent
b69ba4a
commit 8ff3f25
Showing
8 changed files
with
310 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule libxbr-standalone
deleted from
3835e9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,26 @@ | ||
|
||
#include "scaler.h" | ||
|
||
static void scale_nearest(int factor, uint32_t *dst, int dstPitch, const uint32_t *src, int srcPitch, int w, int h) { | ||
switch (factor) { | ||
case 2: | ||
while (h--) { | ||
uint32_t *p = dst; | ||
for (int i = 0; i < w; ++i, p += 2) { | ||
uint32_t c = *(src + i); | ||
*(p) = c; | ||
*(p + 1) = c; | ||
*(p + dstPitch) = c; | ||
*(p + dstPitch + 1) = c; | ||
template <int N> | ||
static void scale_nearest(uint32_t *dst, int dstPitch, const uint8_t *src, int srcPitch, int w, int h, const uint32_t *palette) { | ||
while (h--) { | ||
uint32_t *p = dst; | ||
for (int i = 0; i < w; ++i, p += N) { | ||
const uint32_t c = palette[src[i]]; | ||
for (int j = 0; j < N; ++j) { | ||
for (int k = 0; k < N; ++k) { | ||
*(p + j * dstPitch + k) = c; | ||
} | ||
} | ||
dst += dstPitch * 2; | ||
src += srcPitch; | ||
} | ||
break; | ||
case 3: | ||
while (h--) { | ||
uint32_t *p = dst; | ||
for (int i = 0; i < w; ++i, p += 3) { | ||
uint32_t c = *(src + i); | ||
*(p) = c; | ||
*(p + 1) = c; | ||
*(p + 2) = c; | ||
*(p + dstPitch) = c; | ||
*(p + dstPitch + 1) = c; | ||
*(p + dstPitch + 2) = c; | ||
*(p + 2 * dstPitch) = c; | ||
*(p + 2 * dstPitch + 1) = c; | ||
*(p + 2 * dstPitch + 2) = c; | ||
} | ||
dst += dstPitch * 3; | ||
src += srcPitch; | ||
} | ||
break; | ||
dst += dstPitch * N; | ||
src += srcPitch; | ||
} | ||
} | ||
|
||
const Scaler scaler_nearest = { | ||
"nearest", | ||
2, 3, | ||
scale_nearest | ||
2, 4, | ||
0, | ||
{ scale_nearest<2>, scale_nearest<3>, scale_nearest<4> } | ||
}; |
Oops, something went wrong.