Open kkangs opened 9 years ago
// Sink side modify
/frameworks/native/libs/gui/GLConsumer.cpp
status_t GLConsumer::updateAndReleaseLocked(const BufferQueue::BufferItem& item)
{
status_t err = NO_ERROR;
// ...
// for Miracast Sink, screen rotation
BufferQueue::BufferItem newrot;
newrot.mTransform = item.mTransform;
if (mName == "A Sink Surface") {
// ...
if (mSinkRotate) {
newrot.mTransform = item.mTransform | 0x04; //
/system/core/include/system/graphics.h HAL_TRANSFORM_ROT_90 = 0x04,
//ST_LOGW("updateAndReleaseLocked() Force
Transform::ROT_90 [%d, %d]", mSlots[buf].mGraphicBuffer->getWidth(),
mSlots[buf].mGraphicBuffer->getHeight());
}
// add this
newrot.mScalingMode = NATIVE_WINDOW_SCALING_MODE_SCALE_CROP;
ST_LOGW("updateAndReleaseLocked() item.mScalingMode[%d, %d]",
item.mScalingMode, newrot.mScalingMode);
}
// /system/core/include/system/window.h
//NATIVE_WINDOW_SCALING_MODE_FREEZE = 0,
//NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW = 1,
//NATIVE_WINDOW_SCALING_MODE_SCALE_CROP = 2,
//NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP = 3,
// Update the GLConsumer state.
mCurrentTexture = buf;
mCurrentTextureBuf = mSlots[buf].mGraphicBuffer;
mCurrentCrop = item.mCrop;
//mCurrentTransform = item.mTransform;
mCurrentTransform = newrot.mTransform; // control rotation
//mCurrentScalingMode = item.mScalingMode;
mCurrentScalingMode = newrot.mScalingMode; // control scaling // add this
this works only Source side resolution 800x480
when using normally (not fix), screen like pressed side by side. (Source : Nexus 4(left img), Sink : Galaxy Nexus(right img), Screen : Vertical)
i want to display the original image(display) when portrait mode. e.g. sink Nexus5, source Nexus5 -> like equally mode(portrait or landscape) wanna equal image display!
but, now when rotating a screen, it's equall mode. how to fix?