The sw qualifier is used to define values based on smallest width avaialable on the device (so, when is in portrait mode). It's not based on the device density.
The fundamental size of a screen, as indicated by the shortest dimension of the available screen area. Specifically, the device's smallestWidth is the shortest of the screen's available height and width (you may also think of it as the "smallest possible width" for the screen). You can use this qualifier to ensure that, regardless of the screen's current orientation, your application has at least dps of width available for its UI.