Fixed window title to match Be's version, removed bits->bits translation code (this should be handled in the BaseTranslator.cpp anyway) and removed hardcoding of config view bg color
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6883 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
39622c6739
commit
5a253979d3
@ -50,7 +50,7 @@ main()
|
||||
BApplication app("application/x-vnd.obos-tga-translator");
|
||||
status_t result;
|
||||
result = LaunchTranslatorWindow(new TGATranslator,
|
||||
"TGATranslator", BRect(0, 0, 225, 175));
|
||||
"TGA Settings", BRect(0, 0, 225, 175));
|
||||
if (result == B_OK) {
|
||||
app.Run();
|
||||
return 0;
|
||||
|
@ -212,12 +212,6 @@ TGATranslator::tga_alphabits(TGAFileHeader &filehead, TGAColorMapSpec &mapspec,
|
||||
// outInfo, Information about the translator
|
||||
// is copied here
|
||||
//
|
||||
// amtread, Amount of data read from inSource
|
||||
// before this function was called
|
||||
//
|
||||
// read, Pointer to the data that was read
|
||||
// in before this function was called
|
||||
//
|
||||
// pfileheader, File header info for the TGA is
|
||||
// copied here after it is read from
|
||||
// the file.
|
||||
@ -1177,42 +1171,9 @@ TGATranslator::translate_from_bits(BPositionIO *inSource, uint32 outType,
|
||||
result = identify_bits_header(inSource, NULL, &bitsHeader);
|
||||
if (result != B_OK)
|
||||
return result;
|
||||
|
||||
// Translate B_TRANSLATOR_BITMAP to B_TRANSLATOR_BITMAP, easy enough :)
|
||||
if (outType == B_TRANSLATOR_BITMAP) {
|
||||
// write out bitsHeader (only if configured to)
|
||||
if (bheaderonly || (!bheaderonly && !bdataonly)) {
|
||||
if (swap_data(B_UINT32_TYPE, &bitsHeader,
|
||||
sizeof(TranslatorBitmap), B_SWAP_HOST_TO_BENDIAN) != B_OK)
|
||||
return B_ERROR;
|
||||
if (outDestination->Write(&bitsHeader,
|
||||
sizeof(TranslatorBitmap)) != sizeof(TranslatorBitmap))
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
// write out the data (only if configured to)
|
||||
if (bdataonly || (!bheaderonly && !bdataonly)) {
|
||||
uint8 buf[1024];
|
||||
uint32 remaining = B_BENDIAN_TO_HOST_INT32(bitsHeader.dataSize);
|
||||
ssize_t rd, writ;
|
||||
rd = inSource->Read(buf, 1024);
|
||||
while (rd > 0) {
|
||||
writ = outDestination->Write(buf, rd);
|
||||
if (writ < 0)
|
||||
break;
|
||||
remaining -= static_cast<uint32>(writ);
|
||||
rd = inSource->Read(buf, min(1024, remaining));
|
||||
}
|
||||
|
||||
if (remaining > 0)
|
||||
return B_ERROR;
|
||||
else
|
||||
return B_OK;
|
||||
} else
|
||||
return B_OK;
|
||||
|
||||
|
||||
// Translate B_TRANSLATOR_BITMAP to B_TGA_FORMAT
|
||||
} else if (outType == B_TGA_FORMAT) {
|
||||
if (outType == B_TGA_FORMAT) {
|
||||
// Set up TGA header
|
||||
TGAFileHeader fileheader;
|
||||
fileheader.idlength = 0;
|
||||
|
@ -52,7 +52,7 @@ TGAView::TGAView(const BRect &frame, const char *name,
|
||||
{
|
||||
fSettings = settings;
|
||||
|
||||
SetViewColor(220,220,220,0);
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
|
||||
BMessage *pmsg;
|
||||
int32 val;
|
||||
|
Loading…
Reference in New Issue
Block a user