mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-11 20:05:58 +03:00
fix(gx): fix Blit_uint32_uint32 when inStride != outStride
This commit is contained in:
parent
690a90a65b
commit
c721538698
@ -53,7 +53,7 @@ void Blit_uint32_uint32(const C2iVector& size, const void* in, uint32_t inStride
|
|||||||
char* out_ = reinterpret_cast<char*>(out);
|
char* out_ = reinterpret_cast<char*>(out);
|
||||||
|
|
||||||
for (int32_t i = 0; i < size.y; i++) {
|
for (int32_t i = 0; i < size.y; i++) {
|
||||||
memcpy(out, in, 4 * size.x);
|
memcpy(out_, in_, 4 * size.x);
|
||||||
in_ += inStride;
|
in_ += inStride;
|
||||||
out_ += outStride;
|
out_ += outStride;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#include "ui/CSimpleMovieFrame.hpp"
|
#include "ui/CSimpleMovieFrame.hpp"
|
||||||
#include "ui/CSimpleMovieFrameScript.hpp"
|
#include "ui/CSimpleMovieFrameScript.hpp"
|
||||||
#include "util/SFile.hpp"
|
#include "util/SFile.hpp"
|
||||||
|
#include "gx/Coordinate.hpp"
|
||||||
#include "gx/Buffer.hpp"
|
#include "gx/Buffer.hpp"
|
||||||
#include "gx/RenderState.hpp"
|
#include "gx/RenderState.hpp"
|
||||||
#include "gx/Texture.hpp"
|
#include "gx/Texture.hpp"
|
||||||
@ -112,10 +113,13 @@ void CSimpleMovieFrame::RenderMovie(void* param) {
|
|||||||
|
|
||||||
void CSimpleMovieFrame::TextureCallback(EGxTexCommand command, uint32_t width, uint32_t height, uint32_t, uint32_t, void* userData, uint32_t& texelStrideInBytes, const void*& texels) {
|
void CSimpleMovieFrame::TextureCallback(EGxTexCommand command, uint32_t width, uint32_t height, uint32_t, uint32_t, void* userData, uint32_t& texelStrideInBytes, const void*& texels) {
|
||||||
if (command == GxTex_Latch) {
|
if (command == GxTex_Latch) {
|
||||||
auto textureData = reinterpret_cast<CSimpleMovieFrame::TextureData*>(userData);
|
auto data = reinterpret_cast<CSimpleMovieFrame::TextureData*>(userData);
|
||||||
//texelStrideInBytes = textureData->strideData[3] / 2;
|
|
||||||
texelStrideInBytes = 4 * width;
|
STORM_ASSERT(width == data->data[0]);
|
||||||
texels = &textureData->data[textureData->strideData[2]];
|
STORM_ASSERT(height == data->data[1]);
|
||||||
|
|
||||||
|
texels = &data->buffer[data->data[2]];
|
||||||
|
texelStrideInBytes = data->data[3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,8 +420,8 @@ int32_t CSimpleMovieFrame::OpenVideo() {
|
|||||||
int32_t hasTextures = 1;
|
int32_t hasTextures = 1;
|
||||||
for (uint32_t i = 0; i < textureCountByFormat[this->m_textureFormat]; ++i) {
|
for (uint32_t i = 0; i < textureCountByFormat[this->m_textureFormat]; ++i) {
|
||||||
uint32_t stride = (6 * this->m_textureFormat + i) * 4;
|
uint32_t stride = (6 * this->m_textureFormat + i) * 4;
|
||||||
this->m_textureData[i].strideData = &s_strideData[stride];
|
this->m_textureData[i].data = &s_strideData[stride];
|
||||||
this->m_textureData[i].data = this->m_imageData;
|
this->m_textureData[i].buffer = this->m_imageData;
|
||||||
|
|
||||||
hasTextures &= GxTexCreate(
|
hasTextures &= GxTexCreate(
|
||||||
s_strideData[stride],
|
s_strideData[stride],
|
||||||
@ -599,18 +603,23 @@ void CSimpleMovieFrame::Render() {
|
|||||||
s_movieFrameNormalVec.x = 0.0;
|
s_movieFrameNormalVec.x = 0.0;
|
||||||
s_movieFrameNormalVec.y = 0.0;
|
s_movieFrameNormalVec.y = 0.0;
|
||||||
s_movieFrameNormalVec.z = 1.0;
|
s_movieFrameNormalVec.z = 1.0;
|
||||||
|
|
||||||
s_movieRenderFlag |= 1;
|
s_movieRenderFlag |= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((s_movieRenderFlag & 2) == 0) {
|
if ((s_movieRenderFlag & 2) == 0) {
|
||||||
s_movieFrameTexVec[0].x = 0.0;
|
s_movieFrameTexVec[0].x = 0.0f;
|
||||||
s_movieFrameTexVec[0].y = 0.0;
|
s_movieFrameTexVec[0].y = 0.0f;
|
||||||
s_movieFrameTexVec[1].y = 0.0;
|
|
||||||
s_movieFrameTexVec[2].x = 0.0;
|
s_movieFrameTexVec[1].x = 1.0f;
|
||||||
s_movieFrameTexVec[1].x = 1.0;
|
s_movieFrameTexVec[1].y = 0.0f;
|
||||||
s_movieFrameTexVec[2].y = s_movieFrameTexVec[1].x;
|
|
||||||
s_movieFrameTexVec[3].x = s_movieFrameTexVec[1].x;
|
s_movieFrameTexVec[2].x = 0.0f;
|
||||||
s_movieFrameTexVec[3].y = s_movieFrameTexVec[1].x;
|
s_movieFrameTexVec[2].y = 1.0f;
|
||||||
|
|
||||||
|
s_movieFrameTexVec[3].x = 1.0f;
|
||||||
|
s_movieFrameTexVec[3].y = 1.0f;
|
||||||
|
|
||||||
s_movieRenderFlag |= 2;
|
s_movieRenderFlag |= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -622,11 +631,13 @@ void CSimpleMovieFrame::Render() {
|
|||||||
|
|
||||||
static float s_layout[] = {0.0, 0.63999999, 0.11, -0.33000001, 0.63999999, 0.95999998, 0.11, -0.33000001, 0.95999998, 1.0, 0.11, -0.33000001, 0.0, 0.63999999, 0.33000001, 0.11, 0.63999999, 0.95999998, 0.33000001, 0.11, 0.95999998, 1.0, 0.33000001, 0.11, 0.0, 0.5, 0.333, -0.333, 0.5, 1.0, 0.333, -0.333, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.63999999, 0.41999999, -0.41999999, 0.63999999, 0.95999998, 0.41999999, -0.41999999, 0.95999998, 1.0, 0.41999999, -0.41999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.32659999, -0.41999999, 0.5, 1.0, 0.32659999, -0.41999999, 0.0, 0.5, 0.41999999, 0.32659999, 0.5, 1.0, 0.41999999, 0.32659999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.63999999, 0.11, -0.33000001, 0.63999999, 0.95999998, 0.11, -0.33000001, 0.95999998, 1.0, 0.11, -0.33000001, 0.0, 0.63999999, 0.33000001, 0.11, 0.63999999, 0.95999998, 0.33000001, 0.11, 0.95999998, 1.0, 0.33000001, 0.11, 0.0, 0.5, 0.333, -0.333, 0.5, 1.0, 0.333, -0.333, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
|
static float s_layout[] = {0.0, 0.63999999, 0.11, -0.33000001, 0.63999999, 0.95999998, 0.11, -0.33000001, 0.95999998, 1.0, 0.11, -0.33000001, 0.0, 0.63999999, 0.33000001, 0.11, 0.63999999, 0.95999998, 0.33000001, 0.11, 0.95999998, 1.0, 0.33000001, 0.11, 0.0, 0.5, 0.333, -0.333, 0.5, 1.0, 0.333, -0.333, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.63999999, 0.41999999, -0.41999999, 0.63999999, 0.95999998, 0.41999999, -0.41999999, 0.95999998, 1.0, 0.41999999, -0.41999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.32659999, -0.41999999, 0.5, 1.0, 0.32659999, -0.41999999, 0.0, 0.5, 0.41999999, 0.32659999, 0.5, 1.0, 0.41999999, 0.32659999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.63999999, 0.11, -0.33000001, 0.63999999, 0.95999998, 0.11, -0.33000001, 0.95999998, 1.0, 0.11, -0.33000001, 0.0, 0.63999999, 0.33000001, 0.11, 0.63999999, 0.95999998, 0.33000001, 0.11, 0.95999998, 1.0, 0.33000001, 0.11, 0.0, 0.5, 0.333, -0.333, 0.5, 1.0, 0.333, -0.333, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
|
||||||
|
|
||||||
|
float aspectCompensation = CoordinateGetAspectCompensation();
|
||||||
|
|
||||||
for (uint32_t i = 0; i < textureCountByFormat[this->m_textureFormat]; ++i) {
|
for (uint32_t i = 0; i < textureCountByFormat[this->m_textureFormat]; ++i) {
|
||||||
float* rect = &s_layout[24 * this->m_textureFormat + 4 * i];
|
float* rect = &s_layout[24 * this->m_textureFormat + 4 * i];
|
||||||
|
|
||||||
float v16 = rect[3]; // * aspectCompensation
|
float v16 = rect[3] * aspectCompensation;
|
||||||
float v17 = rect[2]; // * aspectCompensation
|
float v17 = rect[2] * aspectCompensation;
|
||||||
|
|
||||||
C3Vector position[] = {
|
C3Vector position[] = {
|
||||||
{ rect[0], v16, 0.0f },
|
{ rect[0], v16, 0.0f },
|
||||||
|
|||||||
@ -14,8 +14,8 @@ class CGxTexParms;
|
|||||||
class CSimpleMovieFrame : public CSimpleFrame {
|
class CSimpleMovieFrame : public CSimpleFrame {
|
||||||
public:
|
public:
|
||||||
struct TextureData {
|
struct TextureData {
|
||||||
uint32_t* strideData;
|
uint32_t* data;
|
||||||
char* data;
|
char* buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user