diff --git a/src/apps/showimage/Filter.cpp b/src/apps/showimage/Filter.cpp index 43a38e3a11..b9521bd7f9 100644 --- a/src/apps/showimage/Filter.cpp +++ b/src/apps/showimage/Filter.cpp @@ -1068,7 +1068,7 @@ ImageProcessor::Run(int32 i, int32 n) } } break; - case kMirrorHorizontal: + case kFlipUpsideDown: for (y = from; y <= to; y ++) { for (x = 0; x <= fWidth; x ++) { destX = x; @@ -1077,7 +1077,7 @@ ImageProcessor::Run(int32 i, int32 n) } } break; - case kMirrorVertical: + case kFlipSideways: for (y = from; y <= to; y ++) { for (x = 0; x <= fWidth; x ++) { destX = fWidth - x; diff --git a/src/apps/showimage/Filter.h b/src/apps/showimage/Filter.h index aeb45b37dd..d1faa19d32 100644 --- a/src/apps/showimage/Filter.h +++ b/src/apps/showimage/Filter.h @@ -189,8 +189,8 @@ public: enum operation { kRotateClockwise, kRotateAntiClockwise, - kMirrorVertical, - kMirrorHorizontal, + kFlipSideways, + kFlipUpsideDown, kInvert, kNumberOfAffineTransformations = 4 }; diff --git a/src/apps/showimage/ShowImageConstants.h b/src/apps/showimage/ShowImageConstants.h index 380658edb2..a8c5bd5ff3 100644 --- a/src/apps/showimage/ShowImageConstants.h +++ b/src/apps/showimage/ShowImageConstants.h @@ -40,8 +40,8 @@ const uint32 MSG_SHRINK_TO_WINDOW = 'mSTW'; const uint32 MSG_ZOOM_TO_WINDOW = 'mZTW'; const uint32 MSG_ROTATE_90 = 'mR90'; const uint32 MSG_ROTATE_270 = 'mR27'; -const uint32 MSG_MIRROR_VERTICAL = 'mMIV'; -const uint32 MSG_MIRROR_HORIZONTAL = 'mMIH'; +const uint32 MSG_FLIP_SIDEWAYS = 'mFSW'; +const uint32 MSG_FLIP_UPSIDE_DOWN = 'mFUD'; const uint32 MSG_INVERT = 'mINV'; const uint32 MSG_SLIDE_SHOW = 'mSSW'; const uint32 MSG_SLIDE_SHOW_DELAY = 'mSSD'; diff --git a/src/apps/showimage/ShowImageView.cpp b/src/apps/showimage/ShowImageView.cpp index 0075ea3c13..40b32cfe0b 100644 --- a/src/apps/showimage/ShowImageView.cpp +++ b/src/apps/showimage/ShowImageView.cpp @@ -497,18 +497,18 @@ ShowImageView::SetImage(const entry_ref *ref) DoImageOperation(ImageProcessor::kRotateAntiClockwise, true); break; case k0V: - DoImageOperation(ImageProcessor::ImageProcessor::kMirrorHorizontal, true); + DoImageOperation(ImageProcessor::ImageProcessor::kFlipUpsideDown, true); break; case k90V: DoImageOperation(ImageProcessor::kRotateClockwise, true); - DoImageOperation(ImageProcessor::ImageProcessor::kMirrorHorizontal, true); + DoImageOperation(ImageProcessor::ImageProcessor::kFlipUpsideDown, true); break; case k0H: - DoImageOperation(ImageProcessor::ImageProcessor::kMirrorVertical, true); + DoImageOperation(ImageProcessor::ImageProcessor::kFlipSideways, true); break; case k270V: DoImageOperation(ImageProcessor::kRotateAntiClockwise, true); - DoImageOperation(ImageProcessor::ImageProcessor::kMirrorHorizontal, true); + DoImageOperation(ImageProcessor::ImageProcessor::kFlipUpsideDown, true); break; } } @@ -741,6 +741,10 @@ ShowImageView::AlignBitmap() rect.right = floorf(bitmapWidth * zoom) - 1; rect.bottom = floorf(bitmapHeight * zoom) - 1; + // update the bitmap size after the zoom + bitmapWidth = rect.Width() + 1.0; + bitmapHeight = rect.Height() + 1.0; + // align switch (fHAlignment) { case B_ALIGN_CENTER: @@ -2388,8 +2392,8 @@ ShowImageView::DoImageOperation(ImageProcessor::operation op, bool quiet) // Note: If one of these fails, check its definition in class ImageProcessor. ASSERT(ImageProcessor::kRotateClockwise < ImageProcessor::kNumberOfAffineTransformations); ASSERT(ImageProcessor::kRotateAntiClockwise < ImageProcessor::kNumberOfAffineTransformations); - ASSERT(ImageProcessor::kMirrorVertical < ImageProcessor::kNumberOfAffineTransformations); - ASSERT(ImageProcessor::kMirrorHorizontal < ImageProcessor::kNumberOfAffineTransformations); + ASSERT(ImageProcessor::kFlipSideways < ImageProcessor::kNumberOfAffineTransformations); + ASSERT(ImageProcessor::kFlipUpsideDown < ImageProcessor::kNumberOfAffineTransformations); fImageOrientation = fTransformation[op][fImageOrientation]; } else { fInverted = !fInverted; @@ -2440,12 +2444,12 @@ ShowImageView::Rotate(int degree) void -ShowImageView::Mirror(bool vertical) +ShowImageView::Flip(bool vertical) { if (vertical) { - UserDoImageOperation(ImageProcessor::kMirrorVertical); + UserDoImageOperation(ImageProcessor::kFlipSideways); } else { - UserDoImageOperation(ImageProcessor::kMirrorHorizontal); + UserDoImageOperation(ImageProcessor::kFlipUpsideDown); } } diff --git a/src/apps/showimage/ShowImageView.h b/src/apps/showimage/ShowImageView.h index 881032ae1c..8bec416624 100644 --- a/src/apps/showimage/ShowImageView.h +++ b/src/apps/showimage/ShowImageView.h @@ -101,7 +101,7 @@ class ShowImageView : public BView { // Image manipulation void Rotate(int degree); // 90 and 270 only - void Mirror(bool vertical); + void Flip(bool vertical); void Invert(); void SetIcon(bool clear); diff --git a/src/apps/showimage/ShowImageWindow.cpp b/src/apps/showimage/ShowImageWindow.cpp index d14136dd3e..7ec4aaa3cd 100644 --- a/src/apps/showimage/ShowImageWindow.cpp +++ b/src/apps/showimage/ShowImageWindow.cpp @@ -329,8 +329,8 @@ ShowImageWindow::AddMenus(BMenuBar *bar) AddItemMenu(menu, "Rotate -90°", MSG_ROTATE_270, '[', 0, 'W', true); AddItemMenu(menu, "Rotate +90°", MSG_ROTATE_90, ']', 0, 'W', true); menu->AddSeparatorItem(); - AddItemMenu(menu, "Mirror Vertical", MSG_MIRROR_VERTICAL, 0, 0, 'W', true); - AddItemMenu(menu, "Mirror Horizontal", MSG_MIRROR_HORIZONTAL, 0, 0, 'W', true); + AddItemMenu(menu, "Flip Sideways", MSG_FLIP_SIDEWAYS, 0, 0, 'W', true); + AddItemMenu(menu, "Flip Upside Down", MSG_FLIP_UPSIDE_DOWN, 0, 0, 'W', true); menu->AddSeparatorItem(); AddItemMenu(menu, "Invert", MSG_INVERT, 0, 0, 'W', true); bar->AddItem(menu); @@ -717,11 +717,11 @@ ShowImageWindow::MessageReceived(BMessage *message) case MSG_ROTATE_270: fImageView->Rotate(270); break; - case MSG_MIRROR_VERTICAL: - fImageView->Mirror(true); + case MSG_FLIP_SIDEWAYS: + fImageView->Flip(true); break; - case MSG_MIRROR_HORIZONTAL: - fImageView->Mirror(false); + case MSG_FLIP_UPSIDE_DOWN: + fImageView->Flip(false); break; case MSG_INVERT: fImageView->Invert();