libbe_build: Synchronize BBitmap implementation with the main one.
BView-related code removed or disabled, of course, but this now uses the ColorConversions class, and adds some more ImportBits APIs from that. Change-Id: I805cef159bac52173ef16030eae69e83db6f061b Reviewed-on: https://review.haiku-os.org/c/haiku/+/9391 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
1ad882a7ec
commit
8e86be8509
@@ -1,21 +1,16 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2005, Haiku, Inc.
|
* Copyright 2001-2007, Haiku, Inc. All rights reserved.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Distributed under the terms of the MIT license.
|
*/
|
||||||
//
|
|
||||||
// File Name: Bitmap.h
|
|
||||||
// Author: Ingo Weinhold ([email protected])
|
|
||||||
// Description: BBitmap objects represent off-screen windows that
|
|
||||||
// contain bitmap data.
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef _BITMAP_H
|
#ifndef _BITMAP_H
|
||||||
#define _BITMAP_H
|
#define _BITMAP_H
|
||||||
|
|
||||||
|
|
||||||
#include <Archivable.h>
|
#include <Archivable.h>
|
||||||
#include <InterfaceDefs.h>
|
#include <InterfaceDefs.h>
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
B_BITMAP_CLEAR_TO_WHITE = 0x00000001,
|
B_BITMAP_CLEAR_TO_WHITE = 0x00000001,
|
||||||
B_BITMAP_ACCEPTS_VIEWS = 0x00000002,
|
B_BITMAP_ACCEPTS_VIEWS = 0x00000002,
|
||||||
@@ -23,90 +18,119 @@ enum {
|
|||||||
B_BITMAP_IS_LOCKED = 0x00000008 | B_BITMAP_IS_AREA,
|
B_BITMAP_IS_LOCKED = 0x00000008 | B_BITMAP_IS_AREA,
|
||||||
B_BITMAP_IS_CONTIGUOUS = 0x00000010 | B_BITMAP_IS_LOCKED,
|
B_BITMAP_IS_CONTIGUOUS = 0x00000010 | B_BITMAP_IS_LOCKED,
|
||||||
B_BITMAP_IS_OFFSCREEN = 0x00000020,
|
B_BITMAP_IS_OFFSCREEN = 0x00000020,
|
||||||
|
// Offscreen but non-overlay bitmaps are not supported on Haiku,
|
||||||
|
// but appearantly never were on BeOS either! The accelerant API
|
||||||
|
// would need to be extended to so that the app_server can ask
|
||||||
|
// the graphics driver to reserve memory for a bitmap and for this
|
||||||
|
// to make any sense, an accelerated blit from this memory into
|
||||||
|
// the framebuffer needs to be added to the API as well.
|
||||||
B_BITMAP_WILL_OVERLAY = 0x00000040 | B_BITMAP_IS_OFFSCREEN,
|
B_BITMAP_WILL_OVERLAY = 0x00000040 | B_BITMAP_IS_OFFSCREEN,
|
||||||
B_BITMAP_RESERVE_OVERLAY_CHANNEL = 0x00000080,
|
B_BITMAP_RESERVE_OVERLAY_CHANNEL = 0x00000080,
|
||||||
B_BITMAP_NO_SERVER_LINK = 0x00000100
|
|
||||||
|
// Haiku extensions:
|
||||||
|
B_BITMAP_NO_SERVER_LINK = 0x00000100,
|
||||||
|
// Cheap to create, object will manage memory itself,
|
||||||
|
// no BApplication needs to run, but one can't draw such
|
||||||
|
// a BBitmap.
|
||||||
};
|
};
|
||||||
|
|
||||||
#define B_ANY_BYTES_PER_ROW -1
|
#define B_ANY_BYTES_PER_ROW -1
|
||||||
|
|
||||||
//----------------------------------------------------------------//
|
|
||||||
//----- BBitmap class --------------------------------------------//
|
|
||||||
|
|
||||||
class BBitmap : public BArchivable {
|
class BBitmap : public BArchivable {
|
||||||
public:
|
public:
|
||||||
BBitmap(BRect bounds, uint32 flags, color_space colorSpace,
|
BBitmap(BRect bounds, uint32 flags,
|
||||||
int32 bytesPerRow = B_ANY_BYTES_PER_ROW,
|
color_space colorSpace,
|
||||||
screen_id screenID = B_MAIN_SCREEN_ID);
|
int32 bytesPerRow = B_ANY_BYTES_PER_ROW,
|
||||||
BBitmap(BRect bounds, color_space colorSpace, bool acceptsViews = false,
|
screen_id screenID = B_MAIN_SCREEN_ID);
|
||||||
bool needsContiguous = false);
|
BBitmap(BRect bounds, color_space colorSpace,
|
||||||
BBitmap(const BBitmap *source, bool acceptsViews = false,
|
bool acceptsViews = false,
|
||||||
bool needsContiguous = false);
|
bool needsContiguous = false);
|
||||||
virtual ~BBitmap();
|
BBitmap(const BBitmap& source, uint32 flags);
|
||||||
|
BBitmap(const BBitmap& source);
|
||||||
|
BBitmap(const BBitmap* source,
|
||||||
|
bool acceptsViews = false,
|
||||||
|
bool needsContiguous = false);
|
||||||
|
virtual ~BBitmap();
|
||||||
|
|
||||||
// Archiving
|
// Archiving
|
||||||
BBitmap(BMessage *data);
|
BBitmap(BMessage* data);
|
||||||
static BArchivable *Instantiate(BMessage *data);
|
static BArchivable* Instantiate(BMessage* data);
|
||||||
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
||||||
|
|
||||||
status_t InitCheck() const;
|
status_t InitCheck() const;
|
||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
|
|
||||||
status_t LockBits(uint32 *state = NULL);
|
status_t LockBits(uint32* state = NULL);
|
||||||
void UnlockBits();
|
void UnlockBits();
|
||||||
|
|
||||||
area_id Area() const;
|
void* Bits() const;
|
||||||
void *Bits() const;
|
int32 BitsLength() const;
|
||||||
int32 BitsLength() const;
|
int32 BytesPerRow() const;
|
||||||
int32 BytesPerRow() const;
|
color_space ColorSpace() const;
|
||||||
color_space ColorSpace() const;
|
BRect Bounds() const;
|
||||||
BRect Bounds() const;
|
|
||||||
|
|
||||||
void SetBits(const void *data, int32 length, int32 offset,
|
status_t SetDrawingFlags(uint32 flags);
|
||||||
color_space colorSpace);
|
uint32 Flags() const;
|
||||||
|
|
||||||
// not part of the R5 API
|
status_t ImportBits(const void* data, int32 length,
|
||||||
status_t ImportBits(const void *data, int32 length, int32 bpr,
|
int32 bpr, int32 offset,
|
||||||
int32 offset, color_space colorSpace);
|
color_space colorSpace);
|
||||||
status_t ImportBits(const BBitmap *bitmap);
|
status_t ImportBits(const void* data, int32 length,
|
||||||
|
int32 bpr, color_space colorSpace,
|
||||||
|
BPoint from, BPoint to, BSize size);
|
||||||
|
status_t ImportBits(const BBitmap* bitmap);
|
||||||
|
status_t ImportBits(const BBitmap* bitmap, BPoint from,
|
||||||
|
BPoint to, BSize size);
|
||||||
|
|
||||||
status_t GetOverlayRestrictions(overlay_restrictions *restrictions) const;
|
status_t GetOverlayRestrictions(
|
||||||
|
overlay_restrictions* restrictions) const;
|
||||||
|
|
||||||
//----- Private or reserved -----------------------------------------//
|
bool Lock();
|
||||||
|
void Unlock();
|
||||||
virtual status_t Perform(perform_code d, void *arg);
|
bool IsLocked() const;
|
||||||
|
|
||||||
|
BBitmap& operator=(const BBitmap& source);
|
||||||
|
|
||||||
|
class Private;
|
||||||
|
|
||||||
|
public:
|
||||||
|
// deprecated
|
||||||
|
void SetBits(const void* data, int32 length,
|
||||||
|
int32 offset, color_space colorSpace);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void _ReservedBitmap1();
|
status_t ImportBits(const void* data, int32 length,
|
||||||
virtual void _ReservedBitmap2();
|
int32 bpr, color_space colorSpace,
|
||||||
virtual void _ReservedBitmap3();
|
BPoint from, BPoint to, int32 width, int32 height);
|
||||||
|
status_t ImportBits(const BBitmap* bitmap, BPoint from,
|
||||||
|
BPoint to, int32 width, int32 height);
|
||||||
|
|
||||||
BBitmap(const BBitmap &);
|
private:
|
||||||
BBitmap &operator=(const BBitmap &);
|
friend class Private;
|
||||||
|
|
||||||
char *get_shared_pointer() const;
|
virtual status_t Perform(perform_code d, void* arg);
|
||||||
int32 get_server_token() const;
|
virtual void _ReservedBitmap1();
|
||||||
void InitObject(BRect bounds, color_space colorSpace, uint32 flags,
|
virtual void _ReservedBitmap2();
|
||||||
int32 bytesPerRow, screen_id screenID);
|
virtual void _ReservedBitmap3();
|
||||||
void CleanUp();
|
|
||||||
|
|
||||||
void AssertPtr();
|
int32 _ServerToken() const;
|
||||||
|
void _InitObject(BRect bounds,
|
||||||
|
color_space colorSpace, uint32 flags,
|
||||||
|
int32 bytesPerRow, screen_id screenID);
|
||||||
|
void _CleanUp();
|
||||||
|
void _AssertPointer();
|
||||||
|
|
||||||
void *fBasePtr;
|
private:
|
||||||
int32 fSize;
|
uint8* fBasePointer;
|
||||||
color_space fColorSpace;
|
int32 fSize;
|
||||||
BRect fBounds;
|
color_space fColorSpace;
|
||||||
int32 fBytesPerRow;
|
BRect fBounds;
|
||||||
int32 fServerToken;
|
int32 fBytesPerRow;
|
||||||
int32 fToken;
|
int32 fServerToken;
|
||||||
uint8 unused;
|
uint8 unused;
|
||||||
area_id fArea;
|
uint32 fFlags;
|
||||||
area_id fOrigArea;
|
status_t fInitError;
|
||||||
uint32 fFlags;
|
|
||||||
status_t fInitError;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-------------------------------------------------------------*/
|
|
||||||
/*-------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif // _BITMAP_H
|
#endif // _BITMAP_H
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
#include <../private/interface/ColorConversion.h>
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <InterfaceDefs.h>
|
#include <InterfaceDefs.h>
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
|
|
||||||
|
|
||||||
class BView;
|
class BView;
|
||||||
class BWindow;
|
class BWindow;
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|||||||
+405
-1758
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,7 @@ USES_BE_API on <libbe_build>interface_kit.o = true ;
|
|||||||
|
|
||||||
BuildPlatformMergeObjectPIC <libbe_build>interface_kit.o :
|
BuildPlatformMergeObjectPIC <libbe_build>interface_kit.o :
|
||||||
Bitmap.cpp
|
Bitmap.cpp
|
||||||
|
ColorConversion.cpp
|
||||||
Gradient.cpp
|
Gradient.cpp
|
||||||
GradientLinear.cpp
|
GradientLinear.cpp
|
||||||
GradientRadial.cpp
|
GradientRadial.cpp
|
||||||
|
|||||||
Reference in New Issue
Block a user