app/appenv.h removed "use_mmx" and the MMX detection.

2001-07-13  Michael Natterer  <mitch@gimp.org>

	* app/appenv.h
	* app/main.c: removed "use_mmx" and the MMX detection.

	* app/base/Makefile.am: build the MMX detection unconditionally
	as it's already #ifdef'ed in the source.

	* app/base/detect-mmx.h: added a header for detect-mmx.S

	* app/base/base-config.[ch]: added the "use_mmx" boolean.

	* app/base/base.c: call intel_cpu_features() here.

	* app/paint-funcs/paint-funcs.c: #include "base/base-config.h".

	* app/floating_sel.c
	* app/core/gimpimage.c: removed commented out cruft.

	* app/core/gimplayer.c: gimp_layer_new_from_tiles(): pass the
	gimage instead of NULL to gimp_layer_new() because layers have to
	be created in an image context now
	(checked gimp_layer_new_from_tile()'s callers if this is
	semantically correct).
This commit is contained in:
Michael Natterer 2001-07-13 19:25:34 +00:00 committed by Michael Natterer
parent 8492ea7f58
commit 2d82171679
19 changed files with 97 additions and 90 deletions

View File

@ -1,3 +1,28 @@
2001-07-13 Michael Natterer <mitch@gimp.org>
* app/appenv.h
* app/main.c: removed "use_mmx" and the MMX detection.
* app/base/Makefile.am: build the MMX detection unconditionally
as it's already #ifdef'ed in the source.
* app/base/detect-mmx.h: added a header for detect-mmx.S
* app/base/base-config.[ch]: added the "use_mmx" boolean.
* app/base/base.c: call intel_cpu_features() here.
* app/paint-funcs/paint-funcs.c: #include "base/base-config.h".
* app/floating_sel.c
* app/core/gimpimage.c: removed commented out cruft.
* app/core/gimplayer.c: gimp_layer_new_from_tiles(): pass the
gimage instead of NULL to gimp_layer_new() because layers have to
be created in an image context now
(checked gimp_layer_new_from_tile()'s callers if this is
semantically correct).
2001-07-12 Dave Neary <dneary@eircom.net>
* po/POTFILES.in: One line fix to fix dependency problem.

View File

@ -38,7 +38,6 @@ extern gchar **batch_cmds;
extern gchar *prog_name;
extern MessageHandlerType message_handler;
extern gboolean double_speed;
extern gboolean use_mmx;
#endif /* __APPENV_H__ */

View File

@ -2,13 +2,6 @@
noinst_LIBRARIES = libappbase.a
if HAVE_ASM_MMX
mmx_sources = \
detect-mmx.S
else
mmx_sources =
endif
libappbase_a_SOURCES = @STRIP_BEGIN@ \
base.c \
base.h \
@ -19,6 +12,8 @@ libappbase_a_SOURCES = @STRIP_BEGIN@ \
boundary.h \
brush-scale.c \
brush-scale.h \
detect-mmx.S \
detect-mmx.h \
gimphistogram.c \
gimphistogram.h \
gimplut.c \
@ -45,12 +40,10 @@ libappbase_a_SOURCES = @STRIP_BEGIN@ \
tile-manager-crop.h \
tile-swap.c \
tile-swap.h \
$(mmx_sources) \
@STRIP_END@
EXTRA_DIST = \
makefile.msc \
detect-mmx.S
makefile.msc
AM_CPPFLAGS = @STRIP_BEGIN@ \
-DG_LOG_DOMAIN=\"Gimp-Base\" \

View File

@ -38,3 +38,4 @@ static GimpBaseConfig static_base_config =
GimpBaseConfig *base_config = &static_base_config;
gboolean use_mmx = FALSE;

View File

@ -34,6 +34,7 @@ struct _GimpBaseConfig
extern GimpBaseConfig *base_config;
extern gboolean use_mmx;
#endif /* __BASE_CONFIG_H__ */

View File

@ -40,6 +40,7 @@
#include "base.h"
#include "base-config.h"
#include "detect-mmx.h"
#include "temp-buf.h"
#include "tile-swap.h"
@ -56,6 +57,11 @@ base_init (void)
{
gchar *path;
#ifdef HAVE_ASM_MMX
use_mmx = (intel_cpu_features() & (1 << 23)) ? 1 : 0;
g_print ("using MMX: %s\n", use_mmx ? "yes" : "no");
#endif
toast_old_temp_files ();
/* Add the swap file */

28
app/base/detect-mmx.h Normal file
View File

@ -0,0 +1,28 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __DETECT_MMX_H__
#define __DETECT_MMX_H__
#ifdef HAVE_ASM_MMX
gulong intel_cpu_features (void);
#endif
#endif /* __DETECT_MMX__ */

View File

@ -3443,8 +3443,6 @@ gimp_image_merge_layers (GimpImage *gimage,
gimp_drawable_width (GIMP_DRAWABLE (merge_layer)),
gimp_drawable_height (GIMP_DRAWABLE (merge_layer)));
/*reinit_layer_idlerender (gimage, merge_layer);*/
return merge_layer;
}

View File

@ -3443,8 +3443,6 @@ gimp_image_merge_layers (GimpImage *gimage,
gimp_drawable_width (GIMP_DRAWABLE (merge_layer)),
gimp_drawable_height (GIMP_DRAWABLE (merge_layer)));
/*reinit_layer_idlerender (gimage, merge_layer);*/
return merge_layer;
}

View File

@ -3443,8 +3443,6 @@ gimp_image_merge_layers (GimpImage *gimage,
gimp_drawable_width (GIMP_DRAWABLE (merge_layer)),
gimp_drawable_height (GIMP_DRAWABLE (merge_layer)));
/*reinit_layer_idlerender (gimage, merge_layer);*/
return merge_layer;
}

View File

@ -3443,8 +3443,6 @@ gimp_image_merge_layers (GimpImage *gimage,
gimp_drawable_width (GIMP_DRAWABLE (merge_layer)),
gimp_drawable_height (GIMP_DRAWABLE (merge_layer)));
/*reinit_layer_idlerender (gimage, merge_layer);*/
return merge_layer;
}

View File

@ -3443,8 +3443,6 @@ gimp_image_merge_layers (GimpImage *gimage,
gimp_drawable_width (GIMP_DRAWABLE (merge_layer)),
gimp_drawable_height (GIMP_DRAWABLE (merge_layer)));
/*reinit_layer_idlerender (gimage, merge_layer);*/
return merge_layer;
}

View File

@ -3443,8 +3443,6 @@ gimp_image_merge_layers (GimpImage *gimage,
gimp_drawable_width (GIMP_DRAWABLE (merge_layer)),
gimp_drawable_height (GIMP_DRAWABLE (merge_layer)));
/*reinit_layer_idlerender (gimage, merge_layer);*/
return merge_layer;
}

View File

@ -57,7 +57,9 @@ floating_sel_attach (GimpLayer *layer,
floating_sel = gimage->floating_sel;
floating_sel_anchor (gimp_image_floating_sel (gimage));
/* if we were pasting to the old floating selection, paste now to the drawable */
/* if we were pasting to the old floating selection, paste now
* to the drawable
*/
if (drawable == GIMP_DRAWABLE (floating_sel))
drawable = gimp_image_active_drawable (gimage);
}
@ -70,9 +72,10 @@ floating_sel_attach (GimpLayer *layer,
GIMP_DRAWABLE (layer)->height,
gimp_drawable_bytes (drawable));
/* because setting the sensitivity in the layers_dialog lock call redraws the
* previews, we need to lock the dialogs before the floating sel is actually added.
* however, they won't lock unless we set the gimage's floating sel pointer
/* because setting the sensitivity in the layers_dialog lock call
* redraws the previews, we need to lock the dialogs before the
* floating sel is actually added. however, they won't lock unless
* we set the gimage's floating sel pointer
*/
gimage->floating_sel = layer;
@ -115,9 +118,11 @@ floating_sel_anchor (GimpLayer *layer)
if (! (gimage = gimp_drawable_gimage (GIMP_DRAWABLE (layer))))
return;
if (! gimp_layer_is_floating_sel (layer))
{
g_message (_("Cannot anchor this layer because\nit is not a floating selection."));
g_message (_("Cannot anchor this layer because\n"
"it is not a floating selection."));
return;
}
@ -191,8 +196,8 @@ floating_sel_to_layer (GimpLayer *layer)
if (GIMP_IS_CHANNEL (layer->fs.drawable))
{
g_message (_("Cannot create a new layer from the floating\n"
"selection because it belongs to a\n"
"layer mask or channel."));
"selection because it belongs to a\n"
"layer mask or channel."));
return;
}
@ -208,11 +213,6 @@ floating_sel_to_layer (GimpLayer *layer)
width = gimp_drawable_width (layer->fs.drawable);
height = gimp_drawable_height (layer->fs.drawable);
/* update the fs drawable--this updates the gimage composite preview
* as well as the underlying drawable's
*/
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (layer));
/* allocate the undo structure */
fsu = g_new (FStoLayerUndo, 1);
fsu->layer = layer;
@ -228,22 +228,11 @@ floating_sel_to_layer (GimpLayer *layer)
gimage->floating_sel = NULL;
gimp_drawable_set_visible (GIMP_DRAWABLE (layer), TRUE);
/* if the floating selection exceeds the attached layer's extents,
update the new layer */
/* I don't think that the preview is ever valid as is, since the layer
will be added on top of the others. Revert this if I'm wrong.
msw@gimp.org
*/
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
GIMP_DRAWABLE (layer)->width,
GIMP_DRAWABLE (layer)->height);
/* This may be undesirable when invoked non-interactively... we'll see. */
/*reinit_layer_idlerender (gimage, layer);*/
gimp_image_floating_selection_changed (gimage);
}

View File

@ -419,14 +419,14 @@ gimp_layer_new_from_tiles (GimpImage *gimage,
*/
/* If no image or no tile manager, return NULL */
if (!gimage || !tiles )
if (!gimage || !tiles)
return NULL;
/* the layer_type needs to have alpha */
g_return_val_if_fail (GIMP_IMAGE_TYPE_HAS_ALPHA (layer_type), NULL);
/* Create the new layer */
new_layer = gimp_layer_new (0,
new_layer = gimp_layer_new (gimage,
tile_manager_width (tiles),
tile_manager_height (tiles),
layer_type,

View File

@ -3443,8 +3443,6 @@ gimp_image_merge_layers (GimpImage *gimage,
gimp_drawable_width (GIMP_DRAWABLE (merge_layer)),
gimp_drawable_height (GIMP_DRAWABLE (merge_layer)));
/*reinit_layer_idlerender (gimage, merge_layer);*/
return merge_layer;
}

View File

@ -57,7 +57,9 @@ floating_sel_attach (GimpLayer *layer,
floating_sel = gimage->floating_sel;
floating_sel_anchor (gimp_image_floating_sel (gimage));
/* if we were pasting to the old floating selection, paste now to the drawable */
/* if we were pasting to the old floating selection, paste now
* to the drawable
*/
if (drawable == GIMP_DRAWABLE (floating_sel))
drawable = gimp_image_active_drawable (gimage);
}
@ -70,9 +72,10 @@ floating_sel_attach (GimpLayer *layer,
GIMP_DRAWABLE (layer)->height,
gimp_drawable_bytes (drawable));
/* because setting the sensitivity in the layers_dialog lock call redraws the
* previews, we need to lock the dialogs before the floating sel is actually added.
* however, they won't lock unless we set the gimage's floating sel pointer
/* because setting the sensitivity in the layers_dialog lock call
* redraws the previews, we need to lock the dialogs before the
* floating sel is actually added. however, they won't lock unless
* we set the gimage's floating sel pointer
*/
gimage->floating_sel = layer;
@ -115,9 +118,11 @@ floating_sel_anchor (GimpLayer *layer)
if (! (gimage = gimp_drawable_gimage (GIMP_DRAWABLE (layer))))
return;
if (! gimp_layer_is_floating_sel (layer))
{
g_message (_("Cannot anchor this layer because\nit is not a floating selection."));
g_message (_("Cannot anchor this layer because\n"
"it is not a floating selection."));
return;
}
@ -191,8 +196,8 @@ floating_sel_to_layer (GimpLayer *layer)
if (GIMP_IS_CHANNEL (layer->fs.drawable))
{
g_message (_("Cannot create a new layer from the floating\n"
"selection because it belongs to a\n"
"layer mask or channel."));
"selection because it belongs to a\n"
"layer mask or channel."));
return;
}
@ -208,11 +213,6 @@ floating_sel_to_layer (GimpLayer *layer)
width = gimp_drawable_width (layer->fs.drawable);
height = gimp_drawable_height (layer->fs.drawable);
/* update the fs drawable--this updates the gimage composite preview
* as well as the underlying drawable's
*/
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (layer));
/* allocate the undo structure */
fsu = g_new (FStoLayerUndo, 1);
fsu->layer = layer;
@ -228,22 +228,11 @@ floating_sel_to_layer (GimpLayer *layer)
gimage->floating_sel = NULL;
gimp_drawable_set_visible (GIMP_DRAWABLE (layer), TRUE);
/* if the floating selection exceeds the attached layer's extents,
update the new layer */
/* I don't think that the preview is ever valid as is, since the layer
will be added on top of the others. Revert this if I'm wrong.
msw@gimp.org
*/
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
GIMP_DRAWABLE (layer)->width,
GIMP_DRAWABLE (layer)->height);
/* This may be undesirable when invoked non-interactively... we'll see. */
/*reinit_layer_idlerender (gimage, layer);*/
gimp_image_floating_selection_changed (gimage);
}

View File

@ -34,7 +34,7 @@
#ifndef WAIT_ANY
#define WAIT_ANY -1
#endif /* WAIT_ANY */
#endif
#include <gtk/gtk.h>
@ -48,6 +48,7 @@
#include "libgimp/gimpintl.h"
#ifdef G_OS_WIN32
#include <windows.h>
#else
@ -55,11 +56,6 @@ static void gimp_sigfatal_handler (gint sig_num);
static void gimp_sigchld_handler (gint sig_num);
#endif
/* TODO: this should probably go into a header file */
#ifdef HAVE_ASM_MMX
unsigned long intel_cpu_features (void);
#endif
/* command line options */
gboolean no_interface = FALSE;
@ -80,7 +76,6 @@ gchar **batch_cmds = NULL;
gchar *prog_name = NULL; /* our executable name */
MessageHandlerType message_handler = CONSOLE;
gboolean double_speed = FALSE;
gboolean use_mmx = FALSE;
/*
@ -140,11 +135,6 @@ main (int argc,
use_shm = TRUE;
#endif
#ifdef HAVE_ASM_MMX
use_mmx = (intel_cpu_features() & (1 << 23)) ? 1 : 0;
fprintf(stderr, "MMX : %s\n", use_mmx ? "yes" : "no");
#endif
batch_cmds = g_new (char *, argc);
batch_cmds[0] = NULL;

View File

@ -140,11 +140,9 @@ static void apply_layer_mode_replace (guchar *src1,
gboolean *affect);
static void rotate_pointers (gpointer *p,
guint32 n);
/* MMX stuff */
extern gboolean use_mmx;
#ifdef HAVE_ASM_MMX
extern int use_mmx;
#define MMX_PIXEL_OP(x) \
void \
@ -168,11 +166,13 @@ x( \
} \
/*fprintf(stderr, "non-MMX: %s(%d, %d, %d, %d)\n", #op, \
bytes1, bytes2, has_alpha1, has_alpha2);*/
#else
#else /* ! HAVE_ASM_MMX */
#define MMX_PIXEL_OP_3A_1A(op)
#define USE_MMX_PIXEL_OP_3A_1A(op)
#endif
#endif /* HAVE_ASM_MMX */
void