Skip to content

Commit

Permalink
fix: Fix rotation being parsed incorrectly
Browse files Browse the repository at this point in the history
We use enum values of 90, 180 and 270.
  • Loading branch information
mrousavy committed May 3, 2024
1 parent fec7638 commit 6323940
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions android/src/main/cpp/ResizePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ FrameBuffer ResizePlugin::rotateARGBBuffer(const FrameBuffer& frameBuffer, Rotat
return frameBuffer;
}

__android_log_print(ANDROID_LOG_INFO, TAG, "Rotating ARGB buffer by %zu degrees...", static_cast<int>(rotation));

int rotatedWidth, rotatedHeight;
if (rotation == Rotation90 || rotation == Rotation270) {
// flipped to the side
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/cpp/ResizePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum PixelFormat { RGB, BGR, ARGB, RGBA, BGRA, ABGR };

enum DataType { UINT8, FLOAT32 };

enum Rotation { Rotation0, Rotation90, Rotation180, Rotation270 };
enum Rotation { Rotation0 = 0, Rotation90 = 90, Rotation180 = 180, Rotation270 = 270 };

struct FrameBuffer {
int width;
Expand Down
4 changes: 2 additions & 2 deletions ios/ResizePlugin.mm
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ - (FrameBuffer*)convertInt8Buffer:(FrameBuffer*)buffer toDataType:(ConvertDataTy
break;
case FLOAT32: {
// Convert uint8 -> float32
unsigned char *input = (unsigned char *)source->data;
float *output = (float *)destination->data;
unsigned char* input = (unsigned char*)source->data;
float* output = (float*)destination->data;
size_t numBytes = source->height * source->rowBytes;
float scale = 1.0f / 255.0f;

Expand Down

0 comments on commit 6323940

Please sign in to comment.