Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
add simple sub bitmap constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
kazzmir committed Aug 24, 2015
1 parent 0ea744a commit fd962a0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 deletions.
2 changes: 2 additions & 0 deletions include/r-tech1/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ android_ostream & operator<<(android_ostream & stream, const unsigned int);
android_ostream & operator<<(android_ostream & stream, const bool);
android_ostream & operator<<(android_ostream & stream, const long int);
android_ostream & operator<<(android_ostream & stream, const unsigned long int);
android_ostream & operator<<(android_ostream & stream, const uint64_t);
android_ostream & operator<<(android_ostream & stream, const void *);
android_ostream & operator<<(android_ostream & stream, const double);
android_ostream & operator<<(android_ostream & stream, std::ostream & (*f)(std::ostream &));
#elif defined(WII) && defined(DEBUG)
class wii_ostream: public std::ostream {
Expand Down
3 changes: 3 additions & 0 deletions include/r-tech1/graphics/bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ class Bitmap{
virtual TranslucentBitmap translucent() const;
/* will call transBlender() with the supplied values for you */
virtual TranslucentBitmap translucent(int red, int green, int blue, int alpha) const;

virtual Bitmap subBitmap(int x, int y, int width, int height);

virtual LitBitmap lit() const;

virtual void save( const std::string & str ) const;
Expand Down
5 changes: 5 additions & 0 deletions src/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ android_ostream & operator<<(android_ostream & stream, const unsigned long int i
return stream;
}

android_ostream & operator<<(android_ostream & stream, const uint64_t input){
stream.buffer << input;
return stream;
}

android_ostream & operator<<(android_ostream & stream, const void * input){
stream.buffer << input;
return stream;
Expand Down
2 changes: 1 addition & 1 deletion src/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ static void doStandardLoop(Logic & logic, Draw & draw){
frameTime += (later - now);

if (frameCount >= maxCount){
// Global::debug(0) << "Draw average " << (frameTime / frameCount) << "ms" << std::endl;
Global::debug(0) << "Draw average " << (frameTime / frameCount) << "ms" << std::endl;
frameCount = 0;
frameTime = 0;
}
Expand Down
6 changes: 6 additions & 0 deletions src/graphics/allegro5/bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ Bitmap Bitmap::createMemoryBitmap(int width, int height){
al_set_new_bitmap_flags(flags);
return out;
}

Bitmap Bitmap::subBitmap(int x, int y, int width, int height){
ALLEGRO_BITMAP * original = getData()->getBitmap();
ALLEGRO_BITMAP * sub = al_create_sub_bitmap(original, x, y, width, height);
return Bitmap(sub, false);
}

void Bitmap::convertToVideo(){
ALLEGRO_BITMAP * original = getData()->getBitmap();
Expand Down
12 changes: 0 additions & 12 deletions src/graphics/bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ Util::ReferenceCount<Shader> ShaderManager::getShader(const std::string & name,

/* implementation independant definitions can go here */

Bitmap * Bitmap::temporary_bitmap = NULL;
Bitmap * Bitmap::temporary_bitmap2 = NULL;

/*
int SCALE_X = 0;
int SCALE_Y = 0;
Expand Down Expand Up @@ -134,15 +131,6 @@ Bitmap Bitmap::temporaryBitmap2(int w, int h){
*/

void Bitmap::cleanupTemporaryBitmaps(){
if (temporary_bitmap != NULL){
delete temporary_bitmap;
temporary_bitmap = NULL;
}

if (temporary_bitmap2 != NULL){
delete temporary_bitmap2;
temporary_bitmap2 = NULL;
}
}

Bitmap & Bitmap::operator=(const Bitmap & copy){
Expand Down

0 comments on commit fd962a0

Please sign in to comment.