aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision/render_manager.h
diff options
context:
space:
mode:
authorMarisa-Chan2014-01-07 18:39:16 +0700
committerMarisa-Chan2014-01-07 18:39:16 +0700
commit1428cb8950e5bdcfad9d15d0fb2e32ff1dbc0bae (patch)
tree5baeb94cd7e5249f5416c9af9a0e5e59443bfafa /engines/zvision/render_manager.h
parent48156debaf148b50acd3eb6e3de7020498016a5f (diff)
downloadscummvm-rg350-1428cb8950e5bdcfad9d15d0fb2e32ff1dbc0bae.tar.gz
scummvm-rg350-1428cb8950e5bdcfad9d15d0fb2e32ff1dbc0bae.tar.bz2
scummvm-rg350-1428cb8950e5bdcfad9d15d0fb2e32ff1dbc0bae.zip
ZVISION: Refactoring of renderManager.
Diffstat (limited to 'engines/zvision/render_manager.h')
-rw-r--r--engines/zvision/render_manager.h320
1 files changed, 80 insertions, 240 deletions
diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h
index e16d3562dc..de53481be0 100644
--- a/engines/zvision/render_manager.h
+++ b/engines/zvision/render_manager.h
@@ -51,39 +51,66 @@ public:
~RenderManager();
private:
- struct AlphaDataEntry {
- Graphics::Surface *data;
- uint16 alphaColor;
- uint16 destX;
- uint16 destY;
- uint16 width;
- uint16 height;
+ struct oneSub {
+ Common::Rect _r;
+ Common::String _txt;
+ int16 timer;
+ bool todelete;
+ bool redraw;
};
-
- typedef Common::HashMap<uint32, AlphaDataEntry> AlphaEntryMap;
+// struct AlphaDataEntry {
+// Graphics::Surface *data;
+// uint16 alphaColor;
+// uint16 destX;
+// uint16 destY;
+// uint16 width;
+// uint16 height;
+// };
+//
+ typedef Common::HashMap<uint16, oneSub> subMap;
private:
OSystem *_system;
const Graphics::PixelFormat _pixelFormat;
+ // A buffer for blitting background image to working window
+ Graphics::Surface _wrkWnd;
+
+ Common::Rect _wrkWndDirtyRect;
+
+ Graphics::Surface _outWnd;
+
+ Common::Rect _outWndDirtyRect;
+
+ Common::Rect _bkgDirtyRect;
+
+ Graphics::Surface _subWnd;
+
+ Common::Rect _subWndDirtyRect;
+
+ Graphics::Surface _menuWnd;
+
+ Common::Rect _menuWndDirtyRect;
+
+
// A buffer the exact same size as the workingWindow
// This buffer stores everything un-warped, then does a warp at the end of the frame
- Graphics::Surface _workingWindowBuffer;
+ //Graphics::Surface _workingWindowBuffer;
// A buffer representing the entire screen. Any graphical updates are first done with this buffer
// before actually being blitted to the screen
- Graphics::Surface _backBuffer;
+ //Graphics::Surface _backBuffer;
// A list of Alpha Entries that need to be blitted to the backbuffer
- AlphaEntryMap _alphaDataEntries;
+ //AlphaEntryMap _alphaDataEntries;
// A rectangle representing the portion of the working window where the pixels have been changed since last frame
- Common::Rect _workingWindowDirtyRect;
+ //Common::Rect _workingWindowDirtyRect;
// A rectangle representing the portion of the backbuffer where the pixels have been changed since last frame
- Common::Rect _backBufferDirtyRect;
+ //Common::Rect _backBufferDirtyRect;
/** Width of the working window. Saved to prevent extraneous calls to _workingWindow.width() */
- const int _workingWidth;
+ const int _wrkWidth;
/** Height of the working window. Saved to prevent extraneous calls to _workingWindow.height() */
- const int _workingHeight;
+ const int _wrkHeight;
/** Center of the screen in the x direction */
const int _screenCenterX;
/** Center of the screen in the y direction */
@@ -95,33 +122,36 @@ private:
* edges of this Rectangle
*/
const Common::Rect _workingWindow;
+
+ Common::Rect _subWndRect;
+
+ Common::Rect _menuWndRect;
+
/** Used to warp the background image */
RenderTable _renderTable;
- Graphics::Surface _currentBackground;
+ Graphics::Surface _curBkg;
/** The (x1,y1) coordinates of the subRectangle of the background that is currently displayed on the screen */
- Common::Point _backgroundOffset;
+ int16 _bkgOff;
/** The width of the current background image */
- uint16 _backgroundWidth;
+ uint16 _bkgWidth;
/** The height of the current background image */
- uint16 _backgroundHeight;
+ uint16 _bkgHeight;
+
+ uint16 _subid;
+
+ subMap _subsList;
/**
* The "velocity" at which the background image is panning. We actually store the inverse of velocity (ms/pixel instead of pixels/ms)
* because it allows you to accumulate whole pixels 'steps' instead of rounding pixels every frame
*/
- int _backgroundInverseVelocity;
+ //int _backgroundInverseVelocity;
/** Holds any 'leftover' milliseconds between frames */
- uint _accumulatedVelocityMilliseconds;
+ //uint _accumulatedVelocityMilliseconds;
public:
void initialize();
- /**
- * Rotates the background image in accordance to the current _backgroundInverseVelocity
- *
- * @param deltaTimeInMillis The amount of time that has passed since the last frame
- */
- void update(uint deltaTimeInMillis);
/**
* Renders the current state of the backbuffer to the screen
@@ -129,137 +159,6 @@ public:
void renderBackbufferToScreen();
/**
- * Renders all AlphaEntries to the backbuffer
- */
- void processAlphaEntries();
- /**
- * Clears the AlphaEntry list
- */
- void clearAlphaEntries() {
- _alphaDataEntries.clear();
- }
- /**
- * Removes a specific AlphaEntry from the list
- *
- * @param idNumber The id number identifing the AlphaEntry
- */
- void removeAlphaEntry(uint32 idNumber) {
- _alphaDataEntries.erase(idNumber);
- }
-
- /**
- * Copies a sub-rectangle of a buffer to the working window
- *
- * @param buffer The pixel data to copy to the working window
- * @param destX The X destination in the working window where the subRect of data should be put
- * @param destY The Y destination in the working window where the subRect of data should be put
- * @param imageWidth The width of the source image
- * @param width The width of the sub rectangle
- * @param height The height of the sub rectangle
- */
- void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height);
- /**
- * Copies a sub-rectangle of a buffer to the working window with binary alpha support.
- *
- * @param buffer The pixel data to copy to the working window
- * @param destX The X destination in the working window where the subRect of data should be put
- * @param destY The Y destination in the working window where the subRect of data should be put
- * @param imageWidth The width of the source image
- * @param width The width of the sub rectangle
- * @param height The height of the sub rectangle
- * @param alphaColor The color to interpret as meaning 'transparent'
- * @param idNumber A unique identifier for the data being copied over.
- */
- void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height, int16 alphaColor, uint32 idNumber);
-
- /**
- * Renders the supplied text to the working window
- *
- * @param idNumber A unique identifier for the text
- * @param text The text to be rendered
- * @param font The font to use to render the text
- * @param destX The X destination in the working window where the text should be rendered
- * @param destY The Y destination in the working window where the text should be rendered
- * @param textColor The color to render the text with (in RBG 565)
- * @param maxWidth The max width the text should take up.
- * @param maxHeight The max height the text should take up.
- * @param align The alignment of the text within the bounds of maxWidth
- * @param wrap If true, any words extending past maxWidth will wrap to a new line. If false, ellipses will be rendered to show that the text didn't fit
- * @return A rectangle representing where the text was drawn in the working window
- */
- Common::Rect renderTextToWorkingWindow(uint32 idNumber, const Common::String &text, TruetypeFont *font, int destX, int destY, uint16 textColor, int maxWidth, int maxHeight = -1, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool wrap = true);
-
- /**
- * Fills the entire workingWindow with the specified color. Internally, the color
- * will be converted to RGB 565 and then blitted.
- *
- * @param color The color to fill the working window with. (In RGB 555)
- */
- void clearWorkingWindowTo555Color(uint16 color);
-
- /**
- * Blits the image or a portion of the image to the backbuffer. Actual screen updates won't happen until the end of the frame.
- * The image will be clipped to fit inside the working window. Coords are in working window space, not screen space!
- *
- * @param fileName Name of the image file
- * @param destinationX X position where the image should be put. Coords are in working window space, not screen space!
- * @param destinationY Y position where the image should be put. Coords are in working window space, not screen space!
- */
- void renderImageToScreen(const Common::String &fileName, int16 destinationX, int16 destinationY, bool wrap = false);
-
- /**
- * Blits the image or a portion of the image to the backbuffer. Actual screen updates won't happen until the end of the frame.
- * The image will be clipped to fit inside the working window. Coords are in working window space, not screen space!
- *
- * @param stream Surface to read the image data from
- * @param destinationX X position where the image should be put. Coords are in working window space, not screen space!
- * @param destinationY Y position where the image should be put. Coords are in working window space, not screen space!
- */
- void renderImageToScreen(Graphics::Surface &surface, int16 destinationX, int16 destinationY, bool wrap = false);
-
- /**
- * Copies a rectangla of source surface and copy to destination rect.
- *
- * @param src Source surface
- * @param dst Destenation surface
- * @param srcRect Rect of source surface
- * @param dstRect Rect for destenation surface
- */
- void copyRectToSurface(const Graphics::Surface &src, Graphics::Surface &dst, const Common::Rect &srcRect, const Common::Rect &dstRect);
-
- /**
- * Copies a rectangla of source surface and copy to destination rect.
- *
- * @param src Source surface
- * @param dst Destenation surface
- * @param srcRect Rect of source surface
- * @param dstRect Rect for destenation surface
- * @param colorkey Transparent color
- */
- void copyRectToSurface(const Graphics::Surface &src, Graphics::Surface &dst, const Common::Rect &srcRect, const Common::Rect &dstRect, uint32 colorkey);
-
- /**
- * Copies a rectangla of source surface and copy to destination rect.
- *
- * @param src Source surface
- * @param dst Destenation surface
- * @param srcRect Rect of source surface
- * @param dstPt Point for destenation surface
- */
- void copyRectToSurface(const Graphics::Surface &src, Graphics::Surface &dst, const Common::Rect &srcRect, const Common::Point &dstPt);
-
- /**
- * Copies a rectangla of source surface and copy to destination rect.
- *
- * @param src Source surface
- * @param dst Destenation surface
- * @param srcRect Rect of source surface
- * @param dstPt Point for destenation surface
- * @param colorkey Transparent color
- */
- void copyRectToSurface(const Graphics::Surface &src, Graphics::Surface &dst, const Common::Rect &srcRect, const Common::Point &dstPt, uint32 colorkey);
-
- /**
* Blits the image or a portion of the image to the background.
*
* @param fileName Name of the image file
@@ -271,15 +170,6 @@ public:
/**
* Blits the image or a portion of the image to the background.
*
- * @param surface Surface to read the image data from
- * @param destinationX X position where the image should be put. Coords are in working window space, not screen space!
- * @param destinationY Y position where the image should be put. Coords are in working window space, not screen space!
- */
- void renderImageToBackground(const Graphics::Surface &surface, int16 destinationX, int16 destinationY);
-
- /**
- * Blits the image or a portion of the image to the background.
- *
* @param fileName Name of the image file
* @param destinationX X position where the image should be put. Coords are in working window space, not screen space!
* @param destinationY Y position where the image should be put. Coords are in working window space, not screen space!
@@ -288,16 +178,6 @@ public:
void renderImageToBackground(const Common::String &fileName, int16 destX, int16 destY, uint32 colorkey);
/**
- * Blits the image or a portion of the image to the background.
- *
- * @param surface Surface to read the image data from
- * @param destinationX X position where the image should be put. Coords are in working window space, not screen space!
- * @param destinationY Y position where the image should be put. Coords are in working window space, not screen space!
- * @param colorkey Transparent color
- */
- void renderImageToBackground(const Graphics::Surface &surface, int16 destX, int16 destY, uint32 colorkey);
-
- /**
* Sets the current background image to be used by the RenderManager and immediately
* blits it to the screen. (It won't show up until the end of the frame)
*
@@ -318,43 +198,15 @@ public:
void setBackgroundPosition(int offset);
/**
- * Set the background scroll velocity. Negative velocities correspond to left / up scrolling and
- * positive velocities correspond to right / down scrolling
- *
- * @param velocity Velocity
- */
- void setBackgroundVelocity(int velocity);
-
- /**
* Converts a point in screen coordinate space to image coordinate space
*
* @param point Point in screen coordinate space
* @return Point in image coordinate space
*/
const Common::Point screenSpaceToImageSpace(const Common::Point &point);
- /**
- * Converts a point in image coordinate space to ***PRE-WARP***
- * working window coordinate space
- *
- * @param point Point in image coordinate space
- * @return Point in PRE-WARP working window coordinate space
- */
- const Common::Point imageSpaceToWorkingWindowSpace(const Common::Point &point);
-
- /**
- * Clip a rectangle to the working window. If it returns false, the original rect
- * is not inside the working window.
- *
- * @param rect The rectangle to clip against the working window
- * @return Is rect at least partially inside the working window (true) or completely outside (false)
- */
- bool clipRectToWorkingWindow(Common::Rect &rect);
RenderTable *getRenderTable();
uint32 getCurrentBackgroundOffset();
- const Graphics::Surface *getBackBuffer() {
- return &_backBuffer;
- }
/**
* Creates a copy of surface and transposes the data.
@@ -369,31 +221,32 @@ public:
void scaleBuffer(const void *src, void *dst, uint32 srcWidth, uint32 srcHeight, byte bytesPerPixel, uint32 dstWidth, uint32 dstHeight);
- void blitSurfaceToSurface(Graphics::Surface &src, Graphics::Surface &dst, int x, int y);
- void blitSurfaceToSurface(Graphics::Surface &src, Graphics::Surface &dst, int x, int y, uint32 colorkey);
- void blitSurfaceToBkg(Graphics::Surface &src, int x, int y);
- void blitSurfaceToBkg(Graphics::Surface &src, int x, int y, uint32 colorkey);
- void blitSurfaceUpBkg(Graphics::Surface &src, int x, int y);
- void blitSurfaceUpBkg(Graphics::Surface &src, int x, int y, uint32 colorkey);
+
+ void blitSurfaceToSurface(const Graphics::Surface &src, const Common::Rect &_srcRect , Graphics::Surface &dst, int x, int y);
+ void blitSurfaceToSurface(const Graphics::Surface &src, const Common::Rect &_srcRect , Graphics::Surface &dst, int _x, int _y, uint32 colorkey);
+ void blitSurfaceToSurface(const Graphics::Surface &src, Graphics::Surface &dst, int x, int y);
+ void blitSurfaceToSurface(const Graphics::Surface &src, Graphics::Surface &dst, int x, int y, uint32 colorkey);
+ void blitSurfaceToBkg(const Graphics::Surface &src, int x, int y);
+ void blitSurfaceToBkg(const Graphics::Surface &src, int x, int y, uint32 colorkey);
+ void blitSurfaceToMenu(const Graphics::Surface &src, int x, int y);
+ void blitSurfaceToMenu(const Graphics::Surface &src, int x, int y, uint32 colorkey);
+
+ uint16 createSubArea(const Common::Rect &area);
+ void deleteSubArea(uint16 id);
+ void deleteSubArea(uint16 id, int16 delay);
+ void updateSubArea(uint16 id, const Common::String &txt);
+ void renderSubsToScreen();
+
+ Common::Point getBkgSize();
+
Graphics::Surface *getBkgRect(Common::Rect &rect);
Graphics::Surface *loadImage(const char *file);
Graphics::Surface *loadImage(Common::String &file);
-private:
- /**
- * Renders a subRectangle of an image to the backbuffer. The destinationRect and SubRect
- * will be clipped to image bound and to working window bounds
- *
- * @param buffer Pointer to (0, 0) of the image data
- * @param imageWidth The width of the original image (not of the subRectangle)
- * @param imageHeight The width of the original image (not of the subRectangle)
- * @param horizontalPitch The horizontal pitch of the original image
- * @param destinationX The x coordinate (in working window space) of where to put the final image
- * @param destinationY The y coordinate (in working window space) of where to put the final image
- * @param subRectangle A rectangle representing the part of the image that should be rendered
- * @param wrap Should the image wrap (tile) if it doesn't completely fill the screen?
- */
- void renderSubRectToScreen(Graphics::Surface &surface, int16 destinationX, int16 destinationY, bool wrap);
+ void clearMenuSurface();
+ void renderMenuToScreen();
+
+ void prepareBkg();
/**
* Reads an image file pixel data into a Surface buffer. In the process
@@ -406,19 +259,6 @@ private:
* @param destination A reference to the Surface to store the pixel data in
*/
void readImageToSurface(const Common::String &fileName, Graphics::Surface &destination);
-
- /**
- * Move the background image by an offset. If we are currently in Panorama mode,
- * the offset will correspond to a horizontal motion. If we are currently in Tilt mode,
- * the offset will correspond to a vertical motion. This function should not be called
- * if we are in Flat mode.
- *
- * The RenderManager will take care of wrapping the image.
- * Ex: If the image has width 1400px, it is legal to offset 1500px.
- *
- * @param offset The amount to move the background
- */
- void moveBackground(int offset);
};
} // End of namespace ZVision