diff options
| author | Eugene Sandulenko | 2005-02-17 23:01:00 +0000 |
|---|---|---|
| committer | Eugene Sandulenko | 2005-02-17 23:01:00 +0000 |
| commit | 78ee0bfdaf00a6d03717bc06112034bcc663c1f0 (patch) | |
| tree | e571fbfd25de3e162ed5a717c2d748caf91ab179 /common | |
| parent | e1323556c3ebda975e304597b1e5fcb2ca7f9d65 (diff) | |
| download | scummvm-rg350-78ee0bfdaf00a6d03717bc06112034bcc663c1f0.tar.gz scummvm-rg350-78ee0bfdaf00a6d03717bc06112034bcc663c1f0.tar.bz2 scummvm-rg350-78ee0bfdaf00a6d03717bc06112034bcc663c1f0.zip | |
Mouse part of big patch #1013937 (OSystem layer with bigger resolution)
svn-id: r16800
Diffstat (limited to 'common')
| -rw-r--r-- | common/scaler.cpp | 40 | ||||
| -rw-r--r-- | common/scaler.h | 1 | ||||
| -rw-r--r-- | common/system.h | 39 |
3 files changed, 71 insertions, 9 deletions
diff --git a/common/scaler.cpp b/common/scaler.cpp index 701afbda90..30de3a7ae6 100644 --- a/common/scaler.cpp +++ b/common/scaler.cpp @@ -169,6 +169,46 @@ void Normal3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPit } } +#define INTERPOLATE INTERPOLATE<bitFormat> +#define Q_INTERPOLATE Q_INTERPOLATE<bitFormat> + +/** + * Trivial nearest-neighbour 1.5x scaler. + */ +template<int bitFormat> +void Normal1o5xTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, + int width, int height) { + uint8 *r; + const uint32 dstPitch2 = dstPitch * 2; + const uint32 dstPitch3 = dstPitch * 3; + const uint32 srcPitch2 = srcPitch * 2; + + assert(((int)dstPtr & 1) == 0); + while (height) { + r = dstPtr; + for (int i = 0; i < width; i += 2, r += 6) { + uint16 color0 = *(((const uint16 *)srcPtr) + i); + uint16 color1 = *(((const uint16 *)srcPtr) + i + 1); + uint16 color2 = *(((const uint16 *)(srcPtr + srcPitch)) + i); + uint16 color3 = *(((const uint16 *)(srcPtr + srcPitch)) + i + 1); + + *(uint16 *)(r + 0) = color0; + *(uint16 *)(r + 2) = INTERPOLATE(color0, color1); + *(uint16 *)(r + 4) = color1; + *(uint16 *)(r + 0 + dstPitch) = INTERPOLATE(color0, color2); + *(uint16 *)(r + 2 + dstPitch) = Q_INTERPOLATE(color0, color1, color2, color3); + *(uint16 *)(r + 4 + dstPitch) = INTERPOLATE(color1, color3); + *(uint16 *)(r + 0 + dstPitch2) = color2; + *(uint16 *)(r + 2 + dstPitch2) = INTERPOLATE(color2, color3); + *(uint16 *)(r + 4 + dstPitch2) = color3; + } + srcPtr += srcPitch2; + dstPtr += dstPitch3; + height -= 2; + } +} +MAKE_WRAPPER(Normal1o5x) + /** * The Scale2x filter, also known as AdvMame2x. * See also http://scale2x.sourceforge.net diff --git a/common/scaler.h b/common/scaler.h index e77b8aedc5..c582e71f79 100644 --- a/common/scaler.h +++ b/common/scaler.h @@ -41,6 +41,7 @@ DECLARE_SCALER(AdvMame3x); DECLARE_SCALER(Normal1x); DECLARE_SCALER(Normal2x); DECLARE_SCALER(Normal3x); +DECLARE_SCALER(Normal1o5x); DECLARE_SCALER(TV2x); DECLARE_SCALER(DotMatrix); DECLARE_SCALER(HQ2x); diff --git a/common/system.h b/common/system.h index 7d3a0ea8f7..fad4e6c841 100644 --- a/common/system.h +++ b/common/system.h @@ -96,7 +96,15 @@ public: * Implementing this is purely optional, and no harm should arise * when not doing so (except for decreased speed in said frontends). */ - kFeatureAutoComputeDirtyRects + kFeatureAutoComputeDirtyRects, + + /** + * This flags determines either cursor can have its own palette or not + * It is currently used only by some Macintosh versions of Humongous + * Entertainment games. If backend doesn't implement this feature then + * engine switches to b/w version of cursors. + */ + kFeatureCursorHasPalette }; /** @@ -274,6 +282,18 @@ public: virtual void setPalette(const byte *colors, uint start, uint num) = 0; /** + * Replace the specified range of cursor the palette with new colors. + * The palette entries from 'start' till (start+num-1) will be replaced - so + * a full palette update is accomplished via start=0, num=256. + * + * Backends which implement it should have kFeatureCursorHasPalette flag set + * + * @see setPalette + * @see kFeatureCursorHasPalette + */ + virtual void setCursorPalette(const byte *colors, uint start, uint num) {}; + + /** * Blit a bitmap to the virtual screen. * The real screen will not immediately be updated to reflect the changes. * Client code has to to call updateScreen to ensure any changes are @@ -365,14 +385,15 @@ public: /** * Set the bitmap used for drawing the cursor. * - * @param buf the pixmap data to be used (8bit/pixel) - * @param w width of the mouse cursor - * @param h height of the mouse cursor - * @param hotspotX horizontal offset from the left side to the hotspot - * @param hotspotY vertical offset from the top side to the hotspot - * @param keycolor transparency color index - */ - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255) = 0; + * @param buf the pixmap data to be used (8bit/pixel) + * @param w width of the mouse cursor + * @param h height of the mouse cursor + * @param hotspotX horizontal offset from the left side to the hotspot + * @param hotspotY vertical offset from the top side to the hotspot + * @param keycolor transparency color index + * @param cursorTargetScale scale factor which cursor is designed for + */ + virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int cursorTargetScale = 1) = 0; //@} |
