Skip to content

[chore] framebuffer:setViewport ability to set multiple times#558

Merged
Frenzie merged 2 commits intomasterfrom
Frenzie-patch-1
Oct 22, 2017
Merged

[chore] framebuffer:setViewport ability to set multiple times#558
Frenzie merged 2 commits intomasterfrom
Frenzie-patch-1

Conversation

@Frenzie
Copy link
Copy Markdown
Member

@Frenzie Frenzie commented Oct 21, 2017

self.full_bb = self.bb
else
-- reset before applying new viewport
self.bb = self.bb:viewport(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@poire-z I'm not sure if this is quite the right way to go, although a viewport doesn't duplicate any memory and such.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a real need to reset?

function BB_mt.__index:viewport(x, y, w, h)
x, y, w, h = self:getPhysicalRect(x, y, w, h)
local viewport = BB.new(w, h, self:getType(), self:getPixelP(x, y), self.pitch)
viewport:setRotation(self:getRotation())
viewport:setInverse(self:getInverse())
return viewport
end

Can't you just call it (so, no else) on self.full_bb : self.bb = self.full_bb:viewport() ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried, but that just keeps pushing it down.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pardon, that's a bit incomplete. But my test case is a top "status bar height" on the Android emulator. I'll give provide some screenshots.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so I was preparing my screenshots and I guess the problem I was trying to work around was caused by something incorrect in front? Or maybe it was just too late last night… but I'd swear what you said was the first thing I tried. Seems to be working now though.

There is this remaining beauty flaw. I know there's a draw white thing called somewhere…

viewport.x, viewport.y,
viewport.w, viewport.h)
self.viewport = viewport
self.full_bb:fill(Blitbuffer.COLOR_WHITE)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@poire-z Okay, it all looks good this way. Do you think these extra two lines are a self-evident addition to setViewport or some kind of overreach?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From nowhere, I'd ask: why do you need them? You're setting a viewport on an existing full_bb, why would you need to erase it and repaint it? But if you did it, it obviously helps in some way, no?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You didn't see my screenshot? The existing full_bb already has content on it. It'll just remain there in perpetuity.

The only question is where these lines should be called from. Not if.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, ok, I probably don't get what viewport do (thought you had a full_bb, and viewport was the part of it that was displayed, so stuff outside would not matter).
So, you're more knowing than me to answer this question :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Traditionally what you say is essentially correct.

  1. We have a device, such as the H2O.
  2. We set the viewport on init combined with a white fill. This is enough. The white will stay white.

But now we add:

  1. We dynamically adjust the viewport on Android to adjust our display for the statusbar/toolbar. (I'd prefer to separate them out rather than just a generic "fullscreen".)

Whether this is 100% for sure the best way to do it I'm not entirely sure, but it's the easiest to implement for now and all roadblocks along the way are relevant with or without viewport (e.g., resizable SDL window).

Only the ReaderUI is currently capable of dynamic adjustment due to portrait/landscape. It'll need to be added to the FileManager. But I'll ignore that problem for now. Especially since there are some issues to be worked out on the Android side of things that I want to be as little involved in as possible.

@Frenzie Frenzie merged commit 658499c into master Oct 22, 2017
@Frenzie Frenzie deleted the Frenzie-patch-1 branch October 22, 2017 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants