/[svn]/libgig/trunk/src/gig.cpp
ViewVC logotype

Diff of /libgig/trunk/src/gig.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2543 by schoenebeck, Sat May 10 02:06:58 2014 UTC revision 2547 by schoenebeck, Tue May 13 11:17:24 2014 UTC
# Line 1708  namespace { Line 1708  namespace {
1708          //NOTE: copy code copied from assignment constructor above, see comment there as well          //NOTE: copy code copied from assignment constructor above, see comment there as well
1709                    
1710          *this = *orig; // default memberwise shallow copy of all parameters          *this = *orig; // default memberwise shallow copy of all parameters
1711            
1712            // restore members that shall not be altered
1713          pParentList = p; // restore the chunk pointer          pParentList = p; // restore the chunk pointer
1714            pRegion = pOriginalRegion;
1715                    
1716          // only take the raw sample reference & parent region reference if the          // only take the raw sample reference reference if the
1717          // two DimensionRegion objects are part of the same file          // two DimensionRegion objects are part of the same file
1718          if (pOriginalRegion->GetParent()->GetParent() != orig->pRegion->GetParent()->GetParent()) {          if (pOriginalRegion->GetParent()->GetParent() != orig->pRegion->GetParent()->GetParent()) {
             pRegion = pOriginalRegion;  
1719              pSample = pOriginalSample;              pSample = pOriginalSample;
1720          }          }
1721                    
# Line 3199  namespace { Line 3201  namespace {
3201       *                        dimension bits limit is violated       *                        dimension bits limit is violated
3202       */       */
3203      void Region::AddDimension(dimension_def_t* pDimDef) {      void Region::AddDimension(dimension_def_t* pDimDef) {
3204            // some initial sanity checks of the given dimension definition
3205            if (pDimDef->zones < 2)
3206                throw gig::Exception("Could not add new dimension, amount of requested zones must always be at least two");
3207            if (pDimDef->bits < 1)
3208                throw gig::Exception("Could not add new dimension, amount of requested requested zone bits must always be at least one");
3209            if (pDimDef->dimension == dimension_samplechannel) {
3210                if (pDimDef->zones != 2)
3211                    throw gig::Exception("Could not add new 'sample channel' dimensions, the requested amount of zones must always be 2 for this dimension type");
3212                if (pDimDef->bits != 1)
3213                    throw gig::Exception("Could not add new 'sample channel' dimensions, the requested amount of zone bits must always be 1 for this dimension type");
3214            }
3215    
3216          // check if max. amount of dimensions reached          // check if max. amount of dimensions reached
3217          File* file = (File*) GetParent()->GetParent();          File* file = (File*) GetParent()->GetParent();
3218          const int iMaxDimensions = (file->pVersion && file->pVersion->major == 3) ? 8 : 5;          const int iMaxDimensions = (file->pVersion && file->pVersion->major == 3) ? 8 : 5;
# Line 3374  namespace { Line 3388  namespace {
3388          if (pDimDef->dimension == dimension_layer) Layers = 1;          if (pDimDef->dimension == dimension_layer) Layers = 1;
3389      }      }
3390    
3391        /**
3392         * Searches in the current Region for a dimension of the given dimension
3393         * type and returns the precise configuration of that dimension in this
3394         * Region.
3395         *
3396         * @param type - dimension type of the sought dimension
3397         * @returns dimension definition or NULL if there is no dimension with
3398         *          sought type in this Region.
3399         */
3400        dimension_def_t* Region::GetDimensionDefinition(dimension_t type) {
3401            for (int i = 0; i < Dimensions; ++i)
3402                if (pDimensionDefinitions[i].dimension == type)
3403                    return &pDimensionDefinitions[i];
3404            return NULL;
3405        }
3406    
3407      Region::~Region() {      Region::~Region() {
3408          for (int i = 0; i < 256; i++) {          for (int i = 0; i < 256; i++) {
3409              if (pDimensionRegions[i]) delete pDimensionRegions[i];              if (pDimensionRegions[i]) delete pDimensionRegions[i];

Legend:
Removed from v.2543  
changed lines
  Added in v.2547

  ViewVC Help
Powered by ViewVC