public void updateTransform(){
  tmpMatrix.setToIdentity();
  if (!visible_) {
    Arrays.fill(tmpV,0);
    textureAtlas_.putVertex(textureAtlas_.getVertexBuffer(),tmpV,atlasIndex);
    dirty_=recursiveDirty_=false;
    return;
  }
  if (parent_ == null || parent_ == spriteSheet_) {
    float radians=-ccMacros.CC_DEGREES_TO_RADIANS(rotation_);
    float c=(float)Math.cos(radians);
    float s=(float)Math.sin(radians);
    tmpMatrix.set(c * scaleX_,s * scaleX_,-s * scaleY_,c * scaleY_,position_.x,position_.y);
    tmpMatrix.translate(-anchorPointInPixels_.x,-anchorPointInPixels_.y);
  }
 else   if (parent_ != spriteSheet_) {
    int prevHonor=CC_HONOR_PARENT_TRANSFORM_ALL;
    for (CCNode p=this; p != null && p != spriteSheet_; p=p.getParent()) {
      CCSprite sprP=(CCSprite)p;
      tmpNewMatrix.setToIdentity();
      if ((prevHonor & CC_HONOR_PARENT_TRANSFORM_TRANSLATE) != 0)       tmpNewMatrix.translate(sprP.position_.x,sprP.position_.y);
      if ((prevHonor & CC_HONOR_PARENT_TRANSFORM_ROTATE) != 0)       tmpNewMatrix.rotate(-ccMacros.CC_DEGREES_TO_RADIANS(sprP.rotation_));
      if ((prevHonor & CC_HONOR_PARENT_TRANSFORM_SCALE) != 0) {
        tmpNewMatrix.scale(sprP.scaleX_,sprP.scaleY_);
      }
      tmpNewMatrix.translate(-sprP.anchorPointInPixels_.x,-sprP.anchorPointInPixels_.y);
      tmpMatrix.multiply(tmpNewMatrix);
      prevHonor=sprP.honorParentTransform_;
    }
  }
  CGSize size=rect_.size;
  float x1=offsetPosition_.x;
  float y1=offsetPosition_.y;
  float x2=x1 + size.width;
  float y2=y1 + size.height;
  float x=(float)tmpMatrix.m02;
  float y=(float)tmpMatrix.m12;
  float cr=(float)tmpMatrix.m00;
  float sr=(float)tmpMatrix.m10;
  float cr2=(float)tmpMatrix.m11;
  float sr2=(float)-tmpMatrix.m01;
  float ax=x1 * cr - y1 * sr2 + x;
  float ay=x1 * sr + y1 * cr2 + y;
  float bx=x2 * cr - y1 * sr2 + x;
  float by=x2 * sr + y1 * cr2 + y;
  float cx=x2 * cr - y2 * sr2 + x;
  float cy=x2 * sr + y2 * cr2 + y;
  float dx=x1 * cr - y2 * sr2 + x;
  float dy=x1 * sr + y2 * cr2 + y;
  tmpV[0]=dx;
  tmpV[1]=dy;
  tmpV[2]=vertexZ_;
  tmpV[3]=ax;
  tmpV[4]=ay;
  tmpV[5]=vertexZ_;
  tmpV[6]=cx;
  tmpV[7]=cy;
  tmpV[8]=vertexZ_;
  tmpV[9]=bx;
  tmpV[10]=by;
  tmpV[11]=vertexZ_;
  textureAtlas_.putVertex(textureAtlas_.getVertexBuffer(),tmpV,atlasIndex);
  dirty_=recursiveDirty_=false;
}

public void updateTransform ( ) { tmpMatrix . setToIdentity ( ) ; if ( ! visible_ ) { Arrays . fill ( tmpV , 0 ) ; textureAtlas_ . putVertex ( textureAtlas_ . getVertexBuffer ( ) , tmpV , atlasIndex ) ; dirty_ = recursiveDirty_ = false ; return ; } if ( parent_ == null || parent_ == spriteSheet_ ) { float radians = - ccMacros . CC_DEGREES_TO_RADIANS ( rotation_ ) ; float c = ( float ) Math . cos ( radians ) ; float s = ( float ) Math . sin ( radians ) ; tmpMatrix . set ( c * scaleX_ , s * scaleX_ , - s * scaleY_ , c * scaleY_ , position_ . x , position_ . y ) ; tmpMatrix . translate ( - anchorPointInPixels_ . x , - anchorPointInPixels_ . y ) ; } else if ( parent_ != spriteSheet_ ) { int prevHonor = CC_HONOR_PARENT_TRANSFORM_ALL ; for ( CCNode p = this ; p != null && p != spriteSheet_ ; p = p . getParent ( ) ) { CCSprite sprP = ( CCSprite ) p ; tmpNewMatrix . setToIdentity ( ) ; if ( ( prevHonor & CC_HONOR_PARENT_TRANSFORM_TRANSLATE ) != 0 ) tmpNewMatrix . translate ( sprP . position_ . x , sprP . position_ . y ) ; if ( ( prevHonor & CC_HONOR_PARENT_TRANSFORM_ROTATE ) != 0 ) tmpNewMatrix . rotate ( - ccMacros . CC_DEGREES_TO_RADIANS ( sprP . rotation_ ) ) ; if ( ( prevHonor & CC_HONOR_PARENT_TRANSFORM_SCALE ) != 0 ) { tmpNewMatrix . scale ( sprP . scaleX_ , sprP . scaleY_ ) ; } tmpNewMatrix . translate ( - sprP . anchorPointInPixels_ . x , - sprP . anchorPointInPixels_ . y ) ; tmpMatrix . multiply ( tmpNewMatrix ) ; prevHonor = sprP . honorParentTransform_ ; } } CGSize size = rect_ . size ; float x1 = offsetPosition_ . x ; float y1 = offsetPosition_ . y ; float x2 = x1 + size . width ; float y2 = y1 + size . height ; float x = ( float ) tmpMatrix . m02 ; float y = ( float ) tmpMatrix . m12 ; float cr = ( float ) tmpMatrix . m00 ; float sr = ( float ) tmpMatrix . m10 ; float cr2 = ( float ) tmpMatrix . m11 ; float sr2 = ( float ) - tmpMatrix . m01 ; float ax = x1 * cr - y1 * sr2 + x ; float ay = x1 * sr + y1 * cr2 + y ; float bx = x2 * cr - y1 * sr2 + x ; float by = x2 * sr + y1 * cr2 + y ; float cx = x2 * cr - y2 * sr2 + x ; float cy = x2 * sr + y2 * cr2 + y ; float dx = x1 * cr - y2 * sr2 + x ; float dy = x1 * sr + y2 * cr2 + y ; tmpV [ 0 ] = dx ; tmpV [ 1 ] = dy ; tmpV [ 2 ] = vertexZ_ ; tmpV [ 3 ] = ax ; tmpV [ 4 ] = ay ; tmpV [ 5 ] = vertexZ_ ; tmpV [ 6 ] = cx ; tmpV [ 7 ] = cy ; tmpV [ 8 ] = vertexZ_ ; tmpV [ 9 ] = bx ; tmpV [ 10 ] = by ; tmpV [ 11 ] = vertexZ_ ; textureAtlas_ . putVertex ( textureAtlas_ . getVertexBuffer ( ) , tmpV , atlasIndex ) ; dirty_ = recursiveDirty_ = false ; }
updates the quad according the the rotation , position , scale values .
