When method_ is not set, assume it means the default dither algorithm, set it to NULL in disable(). This can also avoid possible segfaults. Bump revision.
34 lines
1.2 KiB
Text
34 lines
1.2 KiB
Text
$NetBSD: patch-av,v 1.2 2006/02/27 15:49:56 joerg Exp $
|
|
|
|
--- color-mono.cc.orig 1995-11-14 02:14:31.000000000 +0000
|
|
+++ color-mono.cc
|
|
@@ -200,7 +200,7 @@ public:
|
|
~MonoColorModel();
|
|
virtual int alloc_grays();
|
|
virtual int command(int argc, const char*const* argv);
|
|
- inline white(void) { return (white_); }
|
|
+ inline int white(void) { return (white_); }
|
|
private:
|
|
int white_;
|
|
};
|
|
@@ -243,14 +243,17 @@ typedef void (MonoWindowRenderer::*MonoM
|
|
class MonoWindowRenderer : public WindowDitherer {
|
|
public:
|
|
MonoWindowRenderer(VideoWindow* vw, int decimation, MonoColorModel& cm) :
|
|
- WindowDitherer(vw, decimation), cm_(cm) { }
|
|
+ WindowDitherer(vw, decimation), cm_(cm), method_(NULL) { }
|
|
void render(const u_char* frm, int off, int x, int w, int h) {
|
|
- (this->*method_)(frm, off, x, w, h);
|
|
+ if (this->method_)
|
|
+ (this->*method_)(frm, off, x, w, h);
|
|
+ else
|
|
+ dither_null(frm, off, x, w, h);
|
|
}
|
|
protected:
|
|
MonoColorModel& cm_;
|
|
virtual void update();
|
|
- virtual void disable() { method_ = WindowDitherer::dither_null; }
|
|
+ virtual void disable() { method_ = NULL; }
|
|
MonoMethod method_;
|
|
void dither(const u_char* frm, u_int off, u_int x,
|
|
u_int width, u_int height) const;
|