00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "Core/precomp.h"
00020 #include "API/Display/SurfaceProviders/sprite_subsection_provider.h"
00021
00022 CL_Surface *CL_SpriteSubsectionProvider::create(
00023 CL_SurfaceProvider *parent_provider,
00024 int start_x,
00025 int start_y,
00026 int width,
00027 int height)
00028 {
00029 return CL_Surface::create(new CL_SpriteSubsectionProvider(parent_provider, start_x, start_y, width, height), true);
00030 }
00031
00032 CL_SpriteSubsectionProvider::CL_SpriteSubsectionProvider(CL_SurfaceProvider *_parent_provider,
00033 int _start_x, int _start_y,
00034 int _width, int _height)
00035 {
00036 parent_provider = _parent_provider;
00037 start_x = _start_x;
00038 start_y = _start_y;
00039 width = _width;
00040 height = _height;
00041 locked = false;
00042 }
00043
00044 CL_SpriteSubsectionProvider::~CL_SpriteSubsectionProvider()
00045 {
00046 delete parent_provider;
00047 }
00048
00049 unsigned int CL_SpriteSubsectionProvider::get_pitch() const
00050 {
00051 return parent_provider->get_pitch();
00052 }
00053
00054 int CL_SpriteSubsectionProvider::get_translate_x() const
00055 {
00056 return start_x;
00057 }
00058
00059 int CL_SpriteSubsectionProvider::get_translate_y() const
00060 {
00061 return start_y;
00062 }
00063
00064 unsigned int CL_SpriteSubsectionProvider::get_width() const
00065 {
00066 return width;
00067 }
00068
00069 unsigned int CL_SpriteSubsectionProvider::get_height() const
00070 {
00071 return height;
00072 }
00073
00074 unsigned int CL_SpriteSubsectionProvider::get_num_frames() const
00075 {
00076 return 1;
00077 }
00078
00079
00080
00081
00082
00083
00084
00085 bool CL_SpriteSubsectionProvider::is_indexed() const
00086 {
00087 return parent_provider->is_indexed();
00088 }
00089
00090 unsigned int CL_SpriteSubsectionProvider::get_red_mask() const
00091 {
00092 return parent_provider->get_red_mask();
00093 }
00094
00095 unsigned int CL_SpriteSubsectionProvider::get_green_mask() const
00096 {
00097 return parent_provider->get_green_mask();
00098 }
00099
00100 unsigned int CL_SpriteSubsectionProvider::get_blue_mask() const
00101 {
00102 return parent_provider->get_blue_mask();
00103 }
00104
00105 unsigned int CL_SpriteSubsectionProvider::get_alpha_mask() const
00106 {
00107 return parent_provider->get_alpha_mask();
00108 }
00109
00110 unsigned int CL_SpriteSubsectionProvider::get_depth() const
00111 {
00112 return parent_provider->get_depth();
00113 }
00114
00115 CL_Palette *CL_SpriteSubsectionProvider::get_palette() const
00116 {
00117 return parent_provider->get_palette();
00118 }
00119
00120 bool CL_SpriteSubsectionProvider::uses_src_colorkey() const
00121 {
00122 return parent_provider->uses_src_colorkey();
00123 }
00124
00125 unsigned int CL_SpriteSubsectionProvider::get_src_colorkey() const
00126 {
00127 return parent_provider->get_src_colorkey();
00128 }
00129
00130 void *CL_SpriteSubsectionProvider::get_data() const
00131 {
00132 return parent_provider->get_data();
00133 }
00134
00135 void CL_SpriteSubsectionProvider::perform_lock()
00136 {
00137 if (locked) return;
00138
00139 parent_provider->lock();
00140 locked = true;
00141 }
00142
00143 void CL_SpriteSubsectionProvider::perform_unlock()
00144 {
00145 parent_provider->unlock();
00146 locked = false;
00147 }
00148