Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Never change pixel ratio after creating a Map object - #1799

Merged
kkaefer merged 1 commit into
masterfrom
1799-constant-pixelratio
Jul 8, 2015
Merged

kkaefer merged 1 commit into
masterfrom
1799-constant-pixelratio

Conversation

@kkaefer

@kkaefer kkaefer commented Jul 1, 2015

Copy link
Copy Markdown
Member

We're currently allowing users to change the pixel ratio after a Map object is created. There are very few use cases for this: moving a window from one screen to another on OS X, and connecting a TV to an iOS device. We should remove the ability to change the pixel ratio. If the frame buffer changes at some point, we can use glViewport to resize the rendering to the new framebuffer dimensions. It won't look perfect, but it's an edge case that causes more headcache than it's worth.

@incanus

incanus commented Jun 29, 2015

Copy link
Copy Markdown
Contributor

Agree with strategy here, particularly since:

  1. While we work on OS X, it's not a primary platform (e.g. no Cocoa client APIs like on iOS).
  2. Workarounds exist such as saving state and recreating the view during an iOS external display swap.

@kkaefer kkaefer self-assigned this Jul 1, 2015
@kkaefer
kkaefer force-pushed the 1799-constant-pixelratio branch from e7c0a3a to 6f1d78d Compare July 1, 2015 11:15

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.

What's the rationale for introducing a separate argument rather than making framebufferSize part of TransformState?

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.

The TransformState is a status that is set for the map in general. It contains the extent (width/height) and position and is used to determine the tiles we need to load. The Framebuffer size is independent of the logical dimensions of the map and is always associated with a single frame, whereas TransformState represents the overall state of that map and isn't tied to a particular frame.

I plan to move additional data into FrameData, such as the animationTime.

@kkaefer
kkaefer force-pushed the 1799-constant-pixelratio branch from 6f1d78d to a6663a5 Compare July 2, 2015 09:29
@jfirebaugh

Copy link
Copy Markdown
Contributor

CC @mikemorris -- mutable pixel ratio may be an important use-case for the node bindings.

@kkaefer

kkaefer commented Jul 3, 2015

Copy link
Copy Markdown
Member Author

I think it shouldn't; instead of changing the dimensions of the map/view object for every request, we should cache those per size/ratio to save on memory allocation time.

@kkaefer
kkaefer force-pushed the 1799-constant-pixelratio branch from a6663a5 to 6a8d68a Compare July 6, 2015 09:22
@mikemorris

Copy link
Copy Markdown
Contributor

@jfirebaugh mutable pixel ratios was causing issues like #1273, I'd be happy to see this gone and segment cache on ratio instead.

@jfirebaugh

Copy link
Copy Markdown
Contributor

Cool, sounds like this simplifies things all around then.

also moves framebuffer size out of TransformState into its own object
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants