Commit 3d9cdfdc authored by Bobby Bingham's avatar Bobby Bingham

targa: use named constants for flag values

Signed-off-by: 's avatarBobby Bingham <uhmmmm@gmail.com>
parent d07940b7
...@@ -166,7 +166,7 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -166,7 +166,7 @@ static int decode_frame(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1; return -1;
} }
if(flags & 0x20){ if(flags & TGA_TOPTOBOTTOM) {
dst = p->data[0]; dst = p->data[0];
stride = p->linesize[0]; stride = p->linesize[0];
}else{ //image is upside-down }else{ //image is upside-down
...@@ -247,7 +247,7 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -247,7 +247,7 @@ static int decode_frame(AVCodecContext *avctx,
} }
} }
} }
if(flags & 0x10){ // right-to-left, needs horizontal flip if(flags & TGA_RIGHTTOLEFT) { // right-to-left, needs horizontal flip
int x; int x;
for(y = 0; y < h; y++){ for(y = 0; y < h; y++){
void *line = &p->data[0][y * p->linesize[0]]; void *line = &p->data[0][y * p->linesize[0]];
......
...@@ -38,4 +38,9 @@ enum TargaCompr { ...@@ -38,4 +38,9 @@ enum TargaCompr {
TGA_RLE = 8, // flag pointing that data is RLE-coded TGA_RLE = 8, // flag pointing that data is RLE-coded
}; };
enum TargaFlags {
TGA_RIGHTTOLEFT = 0x10, // right-to-left (flipped horizontally)
TGA_TOPTOBOTTOM = 0x20, // top-to-bottom (NOT flipped vertically)
};
#endif /* AVCODEC_TARGA_H */ #endif /* AVCODEC_TARGA_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment