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
|
// Description: main manager object for the app_server
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
#include <AppDefs.h>
|
|
||||||
#include <Accelerant.h>
|
#include <Accelerant.h>
|
||||||
#include <Entry.h>
|
#include <AppDefs.h>
|
||||||
#include <Path.h>
|
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <PortLink.h>
|
#include <Entry.h>
|
||||||
|
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include "AppServer.h"
|
#include <Path.h>
|
||||||
|
#include <PortLink.h>
|
||||||
|
#include <StopWatch.h>
|
||||||
|
|
||||||
|
#include "BitmapManager.h"
|
||||||
#include "ColorSet.h"
|
#include "ColorSet.h"
|
||||||
|
#include "CursorManager.h"
|
||||||
|
#include "DefaultDecorator.h"
|
||||||
|
#include "Desktop.h"
|
||||||
#include "DisplayDriver.h"
|
#include "DisplayDriver.h"
|
||||||
|
#include "FontServer.h"
|
||||||
|
#include "RegistrarDefs.h"
|
||||||
|
#include "RGBColor.h"
|
||||||
|
#include "RootLayer.h"
|
||||||
#include "ServerApp.h"
|
#include "ServerApp.h"
|
||||||
#include "ServerCursor.h"
|
#include "ServerCursor.h"
|
||||||
#include "ServerProtocol.h"
|
#include "ServerProtocol.h"
|
||||||
#include "ServerWindow.h"
|
#include "ServerWindow.h"
|
||||||
#include "DefaultDecorator.h"
|
|
||||||
#include "RGBColor.h"
|
|
||||||
#include "BitmapManager.h"
|
|
||||||
#include "CursorManager.h"
|
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "FontServer.h"
|
|
||||||
#include "Desktop.h"
|
#include "AppServer.h"
|
||||||
#include "RootLayer.h"
|
|
||||||
#include <StopWatch.h>
|
|
||||||
//#define DEBUG_KEYHANDLING
|
//#define DEBUG_KEYHANDLING
|
||||||
//#define DEBUG_SERVER
|
//#define DEBUG_SERVER
|
||||||
|
|
||||||
@@ -104,7 +107,7 @@ AppServer::AppServer(void) :
|
|||||||
if (fServerInputPort == B_NO_MORE_PORTS)
|
if (fServerInputPort == B_NO_MORE_PORTS)
|
||||||
debugger("app_server could not create input port");
|
debugger("app_server could not create input port");
|
||||||
|
|
||||||
fAppList= new BList(0);
|
fAppList= new BList();
|
||||||
fQuittingServer= false;
|
fQuittingServer= false;
|
||||||
make_decorator= NULL;
|
make_decorator= NULL;
|
||||||
|
|
||||||
@@ -282,7 +285,7 @@ AppServer::LaunchInputServer()
|
|||||||
|
|
||||||
fISThreadID = B_ERROR;
|
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);
|
snooze(250000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ private:
|
|||||||
|
|
||||||
BString fDecoratorName;
|
BString fDecoratorName;
|
||||||
|
|
||||||
bool fQuittingServer;
|
volatile bool fQuittingServer;
|
||||||
|
|
||||||
BList *fAppList;
|
BList *fAppList;
|
||||||
thread_id fPicassoThreadID;
|
thread_id fPicassoThreadID;
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ DrawData::SetFont(const ServerFont& font, uint32 flags)
|
|||||||
// face
|
// face
|
||||||
if (flags & B_FONT_FACE)
|
if (flags & B_FONT_FACE)
|
||||||
fFont.SetFace(font.Face());
|
fFont.SetFace(font.Face());
|
||||||
// face
|
// flags
|
||||||
if (flags & B_FONT_FLAGS)
|
if (flags & B_FONT_FLAGS)
|
||||||
fFont.SetFlags(font.Flags());
|
fFont.SetFlags(font.Flags());
|
||||||
}
|
}
|
||||||
@@ -411,7 +411,7 @@ LayerData::PrintToStream() const
|
|||||||
printf("\t Flags: %lu\n", fFont.Flags());
|
printf("\t Flags: %lu\n", fFont.Flags());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromLink
|
// ReadFontFromLink
|
||||||
void
|
void
|
||||||
LayerData::ReadFontFromLink(LinkMsgReader& link)
|
LayerData::ReadFontFromLink(LinkMsgReader& link)
|
||||||
{
|
{
|
||||||
@@ -548,8 +548,7 @@ LayerData::WriteToLink(LinkMsgSender& link) const
|
|||||||
link.Attach<uint8>((uint8)fAlphaSrcMode);
|
link.Attach<uint8>((uint8)fAlphaSrcMode);
|
||||||
link.Attach<uint8>((uint8)fAlphaFncMode);
|
link.Attach<uint8>((uint8)fAlphaFncMode);
|
||||||
link.Attach<float>(fScale);
|
link.Attach<float>(fScale);
|
||||||
// TODO: bool, no?
|
link.Attach<bool>(!fFontAntiAliasing);
|
||||||
link.Attach<float>(!fFontAntiAliasing);
|
|
||||||
|
|
||||||
int32 clippingRectCount = fClippingRegion ? fClippingRegion->CountRects() : 0;
|
int32 clippingRectCount = fClippingRegion ? fClippingRegion->CountRects() : 0;
|
||||||
link.Attach<int32>(clippingRectCount);
|
link.Attach<int32>(clippingRectCount);
|
||||||
|
|||||||
@@ -88,19 +88,22 @@ printf("Couldn't set jump\n");
|
|||||||
|
|
||||||
png_init_io(png_ptr, fp);
|
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_bgr(png_ptr);
|
||||||
|
|
||||||
png_set_IHDR(png_ptr, info_ptr, bounds.IntegerWidth(), bounds.IntegerHeight(), 8, PNG_COLOR_TYPE_RGB_ALPHA,
|
int32 width = bounds.IntegerWidth() + 1;
|
||||||
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
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_write_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
png_byte *row_pointers[bounds.IntegerHeight()];
|
png_byte* row_pointers[height];
|
||||||
png_byte* index = (png_byte*)bits;
|
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;
|
row_pointers[i] = index;
|
||||||
index += bytesperrow;
|
index += bytesperrow;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -513,12 +513,12 @@ AccelerantHWInterface::AvailableHWAcceleration() const
|
|||||||
{
|
{
|
||||||
uint32 flags = 0;
|
uint32 flags = 0;
|
||||||
|
|
||||||
if (fAccScreenBlit)
|
/* if (fAccScreenBlit)
|
||||||
flags |= HW_ACC_COPY_REGION;
|
flags |= HW_ACC_COPY_REGION;
|
||||||
if (fAccFillRect)
|
if (fAccFillRect)
|
||||||
flags |= HW_ACC_FILL_REGION;
|
flags |= HW_ACC_FILL_REGION;
|
||||||
if (fAccInvertRect)
|
if (fAccInvertRect)
|
||||||
flags |= HW_ACC_INVERT_REGION;
|
flags |= HW_ACC_INVERT_REGION;*/
|
||||||
|
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "LayerData.h"
|
#include "LayerData.h"
|
||||||
#include "Painter.h"
|
#include "Painter.h"
|
||||||
|
#include "PNGDump.h"
|
||||||
#include "RenderingBuffer.h"
|
#include "RenderingBuffer.h"
|
||||||
|
|
||||||
#ifdef __HAIKU__
|
#ifdef __HAIKU__
|
||||||
@@ -1192,34 +1193,18 @@ DisplayDriverPainter::SetMode(const display_mode &mode)
|
|||||||
bool
|
bool
|
||||||
DisplayDriverPainter::DumpToFile(const char *path)
|
DisplayDriverPainter::DumpToFile(const char *path)
|
||||||
{
|
{
|
||||||
#if 0
|
if (Lock()) {
|
||||||
// TODO: find out why this does not work
|
RenderingBuffer* buffer = fGraphicsCard->DrawingBuffer();
|
||||||
SaveToPNG( path,
|
if (buffer) {
|
||||||
BRect(0, 0, fDisplayMode.virtual_width - 1, fDisplayMode.virtual_height - 1),
|
BRect bounds(0.0, 0.0, buffer->Width() - 1, buffer->Height() - 1);
|
||||||
(color_space)fDisplayMode.space,
|
// TODO: Don't assume B_RGBA32!!
|
||||||
mFrameBufferConfig.frame_buffer,
|
SaveToPNG(path, bounds, B_RGBA32,
|
||||||
fDisplayMode.virtual_height * mFrameBufferConfig.bytes_per_row,
|
buffer->Bits(),
|
||||||
mFrameBufferConfig.bytes_per_row);*/
|
buffer->BitsLength(),
|
||||||
#else
|
buffer->BytesPerRow());
|
||||||
// TODO: remove this when SaveToPNG works properly
|
}
|
||||||
|
Unlock();
|
||||||
// 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();
|
|
||||||
}
|
}
|
||||||
fclose(output);
|
|
||||||
sync();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user