just a little cleanup, made PNG screenshots work
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12665 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -24,31 +24,34 @@
|
||||
// Description: main manager object for the app_server
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#include <AppDefs.h>
|
||||
#include <Accelerant.h>
|
||||
#include <Entry.h>
|
||||
#include <Path.h>
|
||||
#include <AppDefs.h>
|
||||
#include <Directory.h>
|
||||
#include <PortLink.h>
|
||||
|
||||
#include <Entry.h>
|
||||
#include <File.h>
|
||||
#include <Message.h>
|
||||
#include "AppServer.h"
|
||||
#include <Path.h>
|
||||
#include <PortLink.h>
|
||||
#include <StopWatch.h>
|
||||
|
||||
#include "BitmapManager.h"
|
||||
#include "ColorSet.h"
|
||||
#include "CursorManager.h"
|
||||
#include "DefaultDecorator.h"
|
||||
#include "Desktop.h"
|
||||
#include "DisplayDriver.h"
|
||||
#include "FontServer.h"
|
||||
#include "RegistrarDefs.h"
|
||||
#include "RGBColor.h"
|
||||
#include "RootLayer.h"
|
||||
#include "ServerApp.h"
|
||||
#include "ServerCursor.h"
|
||||
#include "ServerProtocol.h"
|
||||
#include "ServerWindow.h"
|
||||
#include "DefaultDecorator.h"
|
||||
#include "RGBColor.h"
|
||||
#include "BitmapManager.h"
|
||||
#include "CursorManager.h"
|
||||
#include "Utils.h"
|
||||
#include "FontServer.h"
|
||||
#include "Desktop.h"
|
||||
#include "RootLayer.h"
|
||||
#include <StopWatch.h>
|
||||
|
||||
#include "AppServer.h"
|
||||
|
||||
//#define DEBUG_KEYHANDLING
|
||||
//#define DEBUG_SERVER
|
||||
|
||||
@@ -104,7 +107,7 @@ AppServer::AppServer(void) :
|
||||
if (fServerInputPort == B_NO_MORE_PORTS)
|
||||
debugger("app_server could not create input port");
|
||||
|
||||
fAppList= new BList(0);
|
||||
fAppList= new BList();
|
||||
fQuittingServer= false;
|
||||
make_decorator= NULL;
|
||||
|
||||
@@ -282,7 +285,7 @@ AppServer::LaunchInputServer()
|
||||
|
||||
fISThreadID = B_ERROR;
|
||||
|
||||
while (find_thread("_roster_thread_") == B_NAME_NOT_FOUND && !fQuittingServer) {
|
||||
while (find_thread(BPrivate::kRosterThreadName) == B_NAME_NOT_FOUND && !fQuittingServer) {
|
||||
snooze(250000);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
|
||||
BString fDecoratorName;
|
||||
|
||||
bool fQuittingServer;
|
||||
volatile bool fQuittingServer;
|
||||
|
||||
BList *fAppList;
|
||||
thread_id fPicassoThreadID;
|
||||
|
||||
@@ -265,7 +265,7 @@ DrawData::SetFont(const ServerFont& font, uint32 flags)
|
||||
// face
|
||||
if (flags & B_FONT_FACE)
|
||||
fFont.SetFace(font.Face());
|
||||
// face
|
||||
// flags
|
||||
if (flags & B_FONT_FLAGS)
|
||||
fFont.SetFlags(font.Flags());
|
||||
}
|
||||
@@ -411,7 +411,7 @@ LayerData::PrintToStream() const
|
||||
printf("\t Flags: %lu\n", fFont.Flags());
|
||||
}
|
||||
|
||||
// ReadFromLink
|
||||
// ReadFontFromLink
|
||||
void
|
||||
LayerData::ReadFontFromLink(LinkMsgReader& link)
|
||||
{
|
||||
@@ -548,8 +548,7 @@ LayerData::WriteToLink(LinkMsgSender& link) const
|
||||
link.Attach<uint8>((uint8)fAlphaSrcMode);
|
||||
link.Attach<uint8>((uint8)fAlphaFncMode);
|
||||
link.Attach<float>(fScale);
|
||||
// TODO: bool, no?
|
||||
link.Attach<float>(!fFontAntiAliasing);
|
||||
link.Attach<bool>(!fFontAntiAliasing);
|
||||
|
||||
int32 clippingRectCount = fClippingRegion ? fClippingRegion->CountRects() : 0;
|
||||
link.Attach<int32>(clippingRectCount);
|
||||
|
||||
@@ -88,19 +88,22 @@ printf("Couldn't set jump\n");
|
||||
|
||||
png_init_io(png_ptr, fp);
|
||||
|
||||
png_set_compression_level(png_ptr,Z_NO_COMPRESSION);
|
||||
// png_set_compression_level(png_ptr, Z_NO_COMPRESSION);
|
||||
|
||||
png_set_bgr(png_ptr);
|
||||
|
||||
png_set_IHDR(png_ptr, info_ptr, bounds.IntegerWidth(), bounds.IntegerHeight(), 8, PNG_COLOR_TYPE_RGB_ALPHA,
|
||||
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
int32 width = bounds.IntegerWidth() + 1;
|
||||
int32 height = bounds.IntegerHeight() + 1;
|
||||
|
||||
png_set_IHDR(png_ptr, info_ptr, width, height, 8, PNG_COLOR_TYPE_RGB_ALPHA,
|
||||
// PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
|
||||
|
||||
png_write_info(png_ptr, info_ptr);
|
||||
|
||||
png_byte *row_pointers[bounds.IntegerHeight()];
|
||||
png_byte* row_pointers[height];
|
||||
png_byte* index = (png_byte*)bits;
|
||||
for(int32 i=0;i<bounds.IntegerHeight();i++)
|
||||
{
|
||||
for (int32 i = 0; i < height; i++) {
|
||||
row_pointers[i] = index;
|
||||
index += bytesperrow;
|
||||
}
|
||||
|
||||
@@ -513,12 +513,12 @@ AccelerantHWInterface::AvailableHWAcceleration() const
|
||||
{
|
||||
uint32 flags = 0;
|
||||
|
||||
if (fAccScreenBlit)
|
||||
/* if (fAccScreenBlit)
|
||||
flags |= HW_ACC_COPY_REGION;
|
||||
if (fAccFillRect)
|
||||
flags |= HW_ACC_FILL_REGION;
|
||||
if (fAccInvertRect)
|
||||
flags |= HW_ACC_INVERT_REGION;
|
||||
flags |= HW_ACC_INVERT_REGION;*/
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "LayerData.h"
|
||||
#include "Painter.h"
|
||||
#include "PNGDump.h"
|
||||
#include "RenderingBuffer.h"
|
||||
|
||||
#ifdef __HAIKU__
|
||||
@@ -1192,34 +1193,18 @@ DisplayDriverPainter::SetMode(const display_mode &mode)
|
||||
bool
|
||||
DisplayDriverPainter::DumpToFile(const char *path)
|
||||
{
|
||||
#if 0
|
||||
// TODO: find out why this does not work
|
||||
SaveToPNG( path,
|
||||
BRect(0, 0, fDisplayMode.virtual_width - 1, fDisplayMode.virtual_height - 1),
|
||||
(color_space)fDisplayMode.space,
|
||||
mFrameBufferConfig.frame_buffer,
|
||||
fDisplayMode.virtual_height * mFrameBufferConfig.bytes_per_row,
|
||||
mFrameBufferConfig.bytes_per_row);*/
|
||||
#else
|
||||
// TODO: remove this when SaveToPNG works properly
|
||||
|
||||
// this does dump each line at a time to ensure that everything
|
||||
// gets written even if we crash somewhere.
|
||||
// it's a bit overkill, but works for now.
|
||||
FILE *output = fopen(path, "w");
|
||||
if (!output)
|
||||
return false;
|
||||
|
||||
RenderingBuffer *backBuffer = fGraphicsCard->DrawingBuffer();
|
||||
uint32 row = backBuffer->BytesPerRow() / 4;
|
||||
for (int i = 0; i < fDisplayMode.virtual_height; i++) {
|
||||
fwrite((uint32 *)backBuffer->Bits() + i * row, 4, row, output);
|
||||
sync();
|
||||
if (Lock()) {
|
||||
RenderingBuffer* buffer = fGraphicsCard->DrawingBuffer();
|
||||
if (buffer) {
|
||||
BRect bounds(0.0, 0.0, buffer->Width() - 1, buffer->Height() - 1);
|
||||
// TODO: Don't assume B_RGBA32!!
|
||||
SaveToPNG(path, bounds, B_RGBA32,
|
||||
buffer->Bits(),
|
||||
buffer->BitsLength(),
|
||||
buffer->BytesPerRow());
|
||||
}
|
||||
Unlock();
|
||||
}
|
||||
fclose(output);
|
||||
sync();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user