Tracker: style fixes to Bitmaps
This commit is contained in:
@@ -48,6 +48,9 @@ All rights reserved.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - BImageResources
|
||||||
|
|
||||||
|
|
||||||
BImageResources::BImageResources(void* memAddr)
|
BImageResources::BImageResources(void* memAddr)
|
||||||
{
|
{
|
||||||
image_id image = find_image(memAddr);
|
image_id image = find_image(memAddr);
|
||||||
@@ -99,6 +102,7 @@ BImageResources::FinishResources(BResources* res) const
|
|||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
fLock.Unlock();
|
fLock.Unlock();
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,21 +242,21 @@ BImageResources::GetBitmapResource(type_code type, int32 id,
|
|||||||
// Try to read as an archived bitmap.
|
// Try to read as an archived bitmap.
|
||||||
stream.Seek(0, SEEK_SET);
|
stream.Seek(0, SEEK_SET);
|
||||||
BMessage archive;
|
BMessage archive;
|
||||||
status_t err = archive.Unflatten(&stream);
|
status_t result = archive.Unflatten(&stream);
|
||||||
if (err != B_OK)
|
if (result != B_OK)
|
||||||
return err;
|
return result;
|
||||||
|
|
||||||
*out = new BBitmap(&archive);
|
*out = new BBitmap(&archive);
|
||||||
if (!*out)
|
if (*out == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
err = (*out)->InitCheck();
|
result = (*out)->InitCheck();
|
||||||
if (err != B_OK) {
|
if (result != B_OK) {
|
||||||
delete *out;
|
delete *out;
|
||||||
*out = NULL;
|
*out = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -263,7 +267,10 @@ static BImageResources* resources = NULL;
|
|||||||
// global object when the image is getting unloaded.
|
// global object when the image is getting unloaded.
|
||||||
class _TTrackerCleanupResources {
|
class _TTrackerCleanupResources {
|
||||||
public:
|
public:
|
||||||
_TTrackerCleanupResources() { }
|
_TTrackerCleanupResources()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
~_TTrackerCleanupResources()
|
~_TTrackerCleanupResources()
|
||||||
{
|
{
|
||||||
delete resources;
|
delete resources;
|
||||||
@@ -276,14 +283,14 @@ namespace BPrivate {
|
|||||||
|
|
||||||
static _TTrackerCleanupResources CleanupResources;
|
static _TTrackerCleanupResources CleanupResources;
|
||||||
|
|
||||||
|
|
||||||
BImageResources* GetTrackerResources()
|
BImageResources* GetTrackerResources()
|
||||||
{
|
{
|
||||||
if (!resources) {
|
if (!resources) {
|
||||||
BAutolock lock(&resLock);
|
BAutolock lock(&resLock);
|
||||||
resources = new BImageResources(&resources);
|
resources = new BImageResources(&resources);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resources;
|
return resources;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace BPrivate
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ of Be Incorporated in the United States and other countries. Other brand product
|
|||||||
names are registered trademarks or trademarks of their respective holders.
|
names are registered trademarks or trademarks of their respective holders.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
*/
|
*/
|
||||||
#ifndef __BITS__
|
#ifndef _TRACKER_BITMAPS_H
|
||||||
#define __BITS__
|
#define _TRACKER_BITMAPS_H
|
||||||
|
|
||||||
|
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
@@ -104,4 +104,5 @@ BImageResources* GetTrackerResources();
|
|||||||
|
|
||||||
using namespace BPrivate;
|
using namespace BPrivate;
|
||||||
|
|
||||||
#endif // __BITS__
|
|
||||||
|
#endif // _TRACKER_BITMAPS_H
|
||||||
|
|||||||
Reference in New Issue
Block a user