Пример #1
0
void LayerBuffer::OverlaySource::onVisibilityResolved(
        const Transform& planeTransform)
{
    // this code-path must be as tight as possible, it's called each time
    // the screen is composited.
    if (UNLIKELY(mOverlay != 0)) {
        if (mVisibilityChanged || !mInitialized) {
            mVisibilityChanged = false;
            mInitialized = true;
            const Rect bounds(mLayer.getTransformedBounds());
            int x = bounds.left;
            int y = bounds.top;
            int w = bounds.width();
            int h = bounds.height();
            
            // we need a lock here to protect "destroy"
            Mutex::Autolock _l(mOverlaySourceLock);
            if (mOverlay) {
                overlay_control_device_t* overlay_dev = mOverlayDevice;
                overlay_dev->setPosition(overlay_dev, mOverlay, x,y,w,h);
                // we need to combine the layer orientation and the
                // user-requested orientation.
                Transform finalTransform(Transform(mLayer.getOrientation()) *
                        Transform(mOrientation));
                overlay_dev->setParameter(overlay_dev, mOverlay,
                        OVERLAY_TRANSFORM, finalTransform.getOrientation());
                overlay_dev->commit(overlay_dev, mOverlay);
            }
        }
    }
}
Пример #2
0
void FunctionVessel::finish( const std::vector<double>& buffer ){
  unsigned nderivatives=getFinalValue()->getNumberOfDerivatives();
  if( norm && diffweight ){
      double dv, val=finalTransform( buffer[bufstart], dv), weight=buffer[bufstart+1+nderivatives];
      getFinalValue()->set( val / weight );
      for(unsigned i=0;i<nderivatives;++i){
         getFinalValue()->addDerivative( i, buffer[bufstart+1+i]/weight - val*buffer[bufstart+1+nderivatives+1+i]/(weight*weight) );
      }
  } else if( norm ){
     double dv, val=finalTransform( buffer[bufstart], dv), weight=buffer[bufstart+1+nderivatives];
     getFinalValue()->set( val / weight );
     for(unsigned i=0;i<nderivatives;++i) getFinalValue()->addDerivative( i, buffer[bufstart+1+i]/weight );
  } else {
     double dv, val=finalTransform( buffer[bufstart], dv); getFinalValue()->set( val );
     for(unsigned i=0;i<nderivatives;++i) getFinalValue()->addDerivative( i, dv*buffer[bufstart+1+i] );
  }
}
Пример #3
0
void LayerBuffer::OverlaySource::onVisibilityResolved(
        const Transform& planeTransform)
{
    // this code-path must be as tight as possible, it's called each time
    // the screen is composited.
    if (UNLIKELY(mOverlay != 0)) {
        if (mVisibilityChanged || !mInitialized) {
            mVisibilityChanged = false;
            mInitialized = true;
            const Rect bounds(mLayer.getTransformedBounds());
            int x = bounds.left;
            int y = bounds.top;
            int w = bounds.width();
            int h = bounds.height();
            
            // we need a lock here to protect "destroy"
            Mutex::Autolock _l(mOverlaySourceLock);
            if (mOverlay) {
                overlay_control_device_t* overlay_dev = mOverlayDevice;
                overlay_dev->setPosition(overlay_dev, mOverlay, x,y,w,h);
                // we need to combine the layer orientation and the
                // user-requested orientation.
                Transform finalTransform(Transform(mLayer.getOrientation()) *
                        Transform(mOrientation));
                overlay_dev->setParameter(overlay_dev, mOverlay,
                        OVERLAY_TRANSFORM, finalTransform.getOrientation());
                overlay_dev->setParameter(overlay_dev, mOverlay,
                        OVERLAY_ZORDER, mLayer.currentState().z);
                const Rect visible_bounds = mLayer.visibleRegionScreen.bounds();
                int visible_x = visible_bounds.left;
                int visible_y = visible_bounds.top;
                int visible_w = visible_bounds.width();
                int visible_h = visible_bounds.height();
                //This layer is not visiable, need hide the layer
                if((visible_w == 0) ||(visible_h == 0)){
                    LOGW("Warning!No visiable area for this layer");
                    overlay_dev->setParameter(overlay_dev, mOverlay, OVERLAY_VISIBLE, 0);
                }
                else{
                    overlay_dev->setParameter(overlay_dev, mOverlay, OVERLAY_VISIBLE, 1);
                }
                overlay_dev->commit(overlay_dev, mOverlay);
            }
        }
    }
}