-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vmapper #1009
Vmapper #1009
Changes from 5 commits
1c51f89
5a10b55
64bf6fa
775378b
118c2e4
b92bfe0
eb8fa7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -217,6 +217,50 @@ class UArrangementMapper : public PixelMapper { | |
int parallel_; | ||
}; | ||
|
||
|
||
|
||
class VerticalMapper : public PixelMapper { | ||
public: | ||
VerticalMapper() {} | ||
|
||
virtual const char *GetName() const { return "V-mapper"; } | ||
|
||
virtual bool SetParameters(int chain, int parallel, const char *param) { | ||
chain_ = chain; | ||
parallel_ = parallel; | ||
return true; | ||
} | ||
|
||
virtual bool GetSizeMapping(int matrix_width, int matrix_height, | ||
int *visible_width, int *visible_height) | ||
const { | ||
*visible_width = matrix_width * parallel_ / chain_; | ||
*visible_height = matrix_height * chain_ / parallel_; | ||
fprintf(stderr, "%s: C:%d P:%d. Turning W:%d H:%d Physical " | ||
"into W:%d H:%d Virtual\n", | ||
GetName(), chain_, parallel_, | ||
*visible_width, *visible_height, matrix_width, matrix_height); | ||
return true; | ||
} | ||
|
||
virtual void MapVisibleToMatrix(int matrix_width, int matrix_height, | ||
int x, int y, | ||
int *matrix_x, int *matrix_y) const { | ||
int panel_width = matrix_width / chain_; | ||
int panel_height = matrix_height / parallel_; | ||
*matrix_x = (x % panel_width) + int(y/panel_height)* panel_width; | ||
*matrix_y = (y % panel_height) + int(x/panel_width) * panel_height; | ||
|
||
//fprintf(stderr, "%s: Panel-W:%d Panel-H:%d. X: %3d -> %3d, Y: %3d -> %3d\n", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't leave commented-out code in the final version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, I left it there on purpose it case it helps someone (possibly me) writing the next mapper. Understanding how things worked without it would have been hard (it was non obvious to see how things were mapped) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing commented-out here. Someone who will want to debug this will add something very similar in the working copy, but here, we should leave out the clutter. Also above in the GetSizeMapping(), the output should not be there, but you can There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, PTAL |
||
// GetName(), panel_width, panel_height, x, *matrix_x, y, *matrix_y); | ||
} | ||
|
||
private: | ||
int chain_; | ||
int parallel_; | ||
}; | ||
|
||
|
||
typedef std::map<std::string, PixelMapper*> MapperByName; | ||
static void RegisterPixelMapperInternal(MapperByName *registry, | ||
PixelMapper *mapper) { | ||
|
@@ -233,6 +277,7 @@ static MapperByName *CreateMapperMap() { | |
// Register all the default PixelMappers here. | ||
RegisterPixelMapperInternal(result, new RotatePixelMapper()); | ||
RegisterPixelMapperInternal(result, new UArrangementMapper()); | ||
RegisterPixelMapperInternal(result, new VerticalMapper()); | ||
RegisterPixelMapperInternal(result, new MirrorPixelMapper()); | ||
return result; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, pretty :)