* Do not use the Scaler anymore for asynchronous bilinear filtering, but pass
B_FILTER_BITMAP_BILINEAR to DrawBitmap(). There is virtually no delay at all. * Some cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37080 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6794f5b5c2
commit
d0a2818e88
@ -24,6 +24,10 @@
|
|||||||
#include "ShowImageConstants.h"
|
#include "ShowImageConstants.h"
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "PrintOptionsWindow"
|
||||||
|
|
||||||
|
|
||||||
PrintOptions::PrintOptions()
|
PrintOptions::PrintOptions()
|
||||||
:
|
:
|
||||||
fOption(kFitToPage),
|
fOption(kFitToPage),
|
||||||
@ -74,9 +78,6 @@ PrintOptions::SetHeight(float h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#undef B_TRANSLATE_CONTEXT
|
|
||||||
#define B_TRANSLATE_CONTEXT "PrintOptionsWindow"
|
|
||||||
|
|
||||||
PrintOptionsWindow::PrintOptionsWindow(BPoint at, PrintOptions* options,
|
PrintOptionsWindow::PrintOptionsWindow(BPoint at, PrintOptions* options,
|
||||||
BWindow* listener)
|
BWindow* listener)
|
||||||
:
|
:
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
|
|
||||||
#define WINDOWS_TO_IGNORE 1
|
#define WINDOWS_TO_IGNORE 1
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "AboutWindow"
|
||||||
|
|
||||||
extern const char* kApplicationSignature = "application/x-vnd.Haiku-ShowImage";
|
extern const char* kApplicationSignature = "application/x-vnd.Haiku-ShowImage";
|
||||||
|
|
||||||
|
|
||||||
@ -47,9 +50,6 @@ ShowImageApp::~ShowImageApp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#undef B_TRANSLATE_CONTEXT
|
|
||||||
#define B_TRANSLATE_CONTEXT "AboutWindow"
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ShowImageApp::AboutRequested()
|
ShowImageApp::AboutRequested()
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2009, Haiku, Inc. All Rights Reserved.
|
* Copyright 2003-2010, Haiku, Inc. All Rights Reserved.
|
||||||
* Copyright 2004-2005 yellowTAB GmbH. All Rights Reserverd.
|
* Copyright 2004-2005 yellowTAB GmbH. All Rights Reserverd.
|
||||||
* Copyright 2006 Bernd Korz. All Rights Reserved
|
* Copyright 2006 Bernd Korz. All Rights Reserved
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
@ -11,6 +11,7 @@
|
|||||||
* Ryan Leavengood
|
* Ryan Leavengood
|
||||||
* yellowTAB GmbH
|
* yellowTAB GmbH
|
||||||
* Bernd Korz
|
* Bernd Korz
|
||||||
|
* Stephan Aßmus <superstippi@gmx.de>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -460,7 +461,7 @@ void
|
|||||||
ShowImageView::_DeleteBitmap()
|
ShowImageView::_DeleteBitmap()
|
||||||
{
|
{
|
||||||
_DeleteScaler();
|
_DeleteScaler();
|
||||||
_DeleteSelBitmap();
|
_DeleteSelectionBitmap();
|
||||||
|
|
||||||
if (fDisplayBitmap != fBitmap)
|
if (fDisplayBitmap != fBitmap)
|
||||||
delete fDisplayBitmap;
|
delete fDisplayBitmap;
|
||||||
@ -472,7 +473,7 @@ ShowImageView::_DeleteBitmap()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ShowImageView::_DeleteSelBitmap()
|
ShowImageView::_DeleteSelectionBitmap()
|
||||||
{
|
{
|
||||||
delete fSelBitmap;
|
delete fSelBitmap;
|
||||||
fSelBitmap = NULL;
|
fSelBitmap = NULL;
|
||||||
@ -539,8 +540,6 @@ ShowImageView::SetImage(const entry_ref *ref)
|
|||||||
fMakesSelection = false;
|
fMakesSelection = false;
|
||||||
_DeleteBitmap();
|
_DeleteBitmap();
|
||||||
fBitmap = newBitmap;
|
fBitmap = newBitmap;
|
||||||
fDisplayBitmap = NULL;
|
|
||||||
newBitmap = NULL;
|
|
||||||
fCurrentRef = *ref;
|
fCurrentRef = *ref;
|
||||||
|
|
||||||
// prepare the display bitmap
|
// prepare the display bitmap
|
||||||
@ -951,7 +950,7 @@ ShowImageView::_GetScaler(BRect rect)
|
|||||||
void
|
void
|
||||||
ShowImageView::_DrawImage(BRect rect)
|
ShowImageView::_DrawImage(BRect rect)
|
||||||
{
|
{
|
||||||
if (fScaleBilinear || fDither) {
|
if (fDither) {
|
||||||
#if DELAYED_SCALING
|
#if DELAYED_SCALING
|
||||||
Scaler* scaler = fScaler;
|
Scaler* scaler = fScaler;
|
||||||
if (scaler != NULL && !scaler->Matches(rect, fDither)) {
|
if (scaler != NULL && !scaler->Matches(rect, fDither)) {
|
||||||
@ -974,7 +973,8 @@ ShowImageView::_DrawImage(BRect rect)
|
|||||||
if (!fDisplayBitmap)
|
if (!fDisplayBitmap)
|
||||||
fDisplayBitmap = fBitmap;
|
fDisplayBitmap = fBitmap;
|
||||||
|
|
||||||
DrawBitmap(fDisplayBitmap, fDisplayBitmap->Bounds(), rect);
|
uint32 options = fScaleBilinear ? B_FILTER_BITMAP_BILINEAR : 0;
|
||||||
|
DrawBitmap(fDisplayBitmap, fDisplayBitmap->Bounds(), rect, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2021,8 +2021,8 @@ ShowImageView::_RemoveSelection(bool toClipboard, bool neverCutBackground)
|
|||||||
|
|
||||||
BRect rect = fSelectionRect;
|
BRect rect = fSelectionRect;
|
||||||
bool cutBackground = (fSelBitmap) ? false : true;
|
bool cutBackground = (fSelBitmap) ? false : true;
|
||||||
BBitmap *selection, *restore = NULL;
|
BBitmap* selection = _CopySelection();
|
||||||
selection = _CopySelection();
|
BBitmap* restore = NULL;
|
||||||
|
|
||||||
if (toClipboard)
|
if (toClipboard)
|
||||||
CopySelectionToClipboard();
|
CopySelectionToClipboard();
|
||||||
@ -2100,7 +2100,8 @@ void
|
|||||||
ShowImageView::SelectAll()
|
ShowImageView::SelectAll()
|
||||||
{
|
{
|
||||||
_SetHasSelection(true);
|
_SetHasSelection(true);
|
||||||
fCopyFromRect.Set(0, 0, fBitmap->Bounds().Width(), fBitmap->Bounds().Height());
|
fCopyFromRect.Set(0, 0, fBitmap->Bounds().Width(),
|
||||||
|
fBitmap->Bounds().Height());
|
||||||
fSelectionRect = fCopyFromRect;
|
fSelectionRect = fCopyFromRect;
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
@ -2117,10 +2118,10 @@ ShowImageView::ClearSelection()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ShowImageView::_SetHasSelection(bool bHasSelection)
|
ShowImageView::_SetHasSelection(bool hasSelection)
|
||||||
{
|
{
|
||||||
_DeleteSelBitmap();
|
_DeleteSelectionBitmap();
|
||||||
fHasSelection = bHasSelection;
|
fHasSelection = hasSelection;
|
||||||
|
|
||||||
_UpdateStatusText();
|
_UpdateStatusText();
|
||||||
|
|
||||||
@ -2133,31 +2134,34 @@ ShowImageView::_SetHasSelection(bool bHasSelection)
|
|||||||
void
|
void
|
||||||
ShowImageView::CopySelectionToClipboard()
|
ShowImageView::CopySelectionToClipboard()
|
||||||
{
|
{
|
||||||
if (_HasSelection() && be_clipboard->Lock()) {
|
if (!_HasSelection() || !be_clipboard->Lock())
|
||||||
be_clipboard->Clear();
|
return;
|
||||||
BMessage *clip = NULL;
|
|
||||||
if ((clip = be_clipboard->Data()) != NULL) {
|
be_clipboard->Clear();
|
||||||
BMessage data;
|
|
||||||
BBitmap* bitmap = _CopySelection();
|
BMessage* data = be_clipboard->Data();
|
||||||
if (bitmap != NULL) {
|
if (data != NULL) {
|
||||||
#if 0
|
BBitmap* bitmap = _CopySelection();
|
||||||
// According to BeBook and Becasso, Gobe Productive do the following.
|
if (bitmap != NULL) {
|
||||||
// Paste works in Productive, but not in Becasso and original ShowImage.
|
#if 0
|
||||||
BMessage msg(B_OK); // Becasso uses B_TRANSLATOR_BITMAP, BeBook says its unused
|
// According to BeBook and Becasso, Gobe Productive do the
|
||||||
bitmap->Archive(&msg);
|
// following. Paste works in Productive, but not in Becasso and
|
||||||
clip->AddMessage("image/x-be-bitmap", &msg);
|
// original ShowImage.
|
||||||
#else
|
BMessage msg(B_OK);
|
||||||
// original ShowImage performs this. Paste works with original ShowImage.
|
// Becasso uses B_TRANSLATOR_BITMAP, BeBook says its unused.
|
||||||
bitmap->Archive(clip);
|
bitmap->Archive(&msg);
|
||||||
// original ShowImage uses be:location for insertion point
|
data->AddMessage("image/x-be-bitmap", &msg);
|
||||||
clip->AddPoint("be:location", BPoint(fSelectionRect.left, fSelectionRect.top));
|
#else
|
||||||
#endif
|
// Original ShowImage performs this.
|
||||||
delete bitmap;
|
bitmap->Archive(data);
|
||||||
be_clipboard->Commit();
|
// original ShowImage uses be:location for insertion point
|
||||||
}
|
data->AddPoint("be:location", fSelectionRect.LeftTop());
|
||||||
|
#endif
|
||||||
|
delete bitmap;
|
||||||
|
be_clipboard->Commit();
|
||||||
}
|
}
|
||||||
be_clipboard->Unlock();
|
|
||||||
}
|
}
|
||||||
|
be_clipboard->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ class ShowImageView : public BView {
|
|||||||
void _MergeSelection();
|
void _MergeSelection();
|
||||||
void _DeleteScaler();
|
void _DeleteScaler();
|
||||||
void _DeleteBitmap();
|
void _DeleteBitmap();
|
||||||
void _DeleteSelBitmap();
|
void _DeleteSelectionBitmap();
|
||||||
int32 _BytesPerPixel(color_space cs) const;
|
int32 _BytesPerPixel(color_space cs) const;
|
||||||
void _CopyPixel(uchar* dest, int32 destX, int32 destY, int32 destBPR,
|
void _CopyPixel(uchar* dest, int32 destX, int32 destY, int32 destBPR,
|
||||||
uchar* src, int32 x, int32 y, int32 bpr, int32 bpp);
|
uchar* src, int32 x, int32 y, int32 bpr, int32 bpp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user