📄 unichrome.h
字号:
* @see MemoryBlock for an explanation of such memory blocks */ MemoryBlock* allocateMemoryBlock(size_t size); /** * Indicate if hardware flipping is used. */ bool usingHWFlipping(); /** * Stop the flipper thread, if running. */ void stop(); /** * Set the given mode. */ void setMode(const Mode& mode); /** * Set the given aspect ratio. */ void setAspectRatio(aspectRatio_t ar); /** * Get the output dimensions. */ void getOutputSize(size_t& width, size_t& height); /** * Get the frame buffer. */ volatile unsigned char* getFrameBuffer(); /** * Get the (gross) size of the frame buffer (it is also the * offset of the 2nd frame buffer). */ size_t getFrameBufferSize() const; /** * Reset the base address of the source to the main frame buffer. */ void resetSourceBase(); /** * Set the base address of the source to the given offset within * the board's memory. * The last 3 bits are not used! */ void setSourceBase(size_t offset); /** * Reset the base address of the destination to the main frame buffer. */ void resetDestinationBase(); /** * Set the base address of the destination to the given offset within * the board's memory. * The last 3 bits are not used! */ void setDestinationBase(size_t offset); /** * Set the foreground colour. */ void setForeground(uint32_t color); /** * Set the background colour. */ void setBackground(uint32_t color); /** * Disable colour keying. */ void disableKeying(); /** * Enable source colour keying. * * @param invert invert the key, i.e. copy only those pixels that * are equal to the source key, but only their alpha * values. */ void enableSourceKeying(bool invert = false); /** * Set the source colour key. */ void setSourceKey(uint32_t color); /** * Reset the source and destination pitches to match the screen resolution. */ void resetPitch(); /** * Set the source and destination pitches. Note, that is perhaps * useful only for blits, and for all other operations you should * reset them. */ void setPitch(size_t source, size_t destination); /** * Reset the source pitch to match the screen resolution. */ void resetSourcePitch(); /** * Set the source pitch. */ void setSourcePitch(size_t pitch); /** * Reset the destination pitch to match the screen resolution. */ void resetDestinationPitch(); /** * Set the destination pitch. */ void setDestinationPitch(size_t pitch); /** * Setup a monochrome pattern. */ void setMonoPattern(const uint32_t pattern[2], size_t xOffset, size_t yOffset); /** * Draw a line. */ void drawLine(size_t x1, size_t y1, size_t x2, size_t y2); /** * Fill rectangle. */ void fillRectangle(size_t x, size_t y, size_t width, size_t height); /** * Blit from the given starting position and size to the given * destination position. */ void blit(size_t x, size_t y, size_t width, size_t height, size_t dx, size_t dy, Window::blitType_t blitType = Window::BLIT_COPY); /** * Flush any previous 2D/3D commands. It will interruptably * wait for the command regulator. */ void flush(); /** * Wait for the graphics engine to finish. It may be interrupted. * * @return if the waiting could be completed without having been interrupted */ bool waitGraphicsEngine(); /** * Get the MPEG decoder. */ MPEGDecoder& getMPEGDecoder(); /** * Wait until the currently pending hardware field flipping has been * performed. */ millis_t waitHWFlipFinished(size_t& fieldNumber); /** * Initiate a hardware flip for the given field number. */ void startHWFlip(size_t fieldNumber, ssize_t fieldCompensation); /** * Set the SPU palette. */ void setSPUPalette(const unsigned* palette); /** * Get the SPU buffer. */ volatile unsigned char* getSPUBuffer(size_t& width, size_t& height); /** * Enable SPU. */ void enableSPU(); /** * Disable SPU. */ void disableSPU(); private: /** * Enable the MMIO. */ void enableMMIO(); /** * Unlock extended register. */ void unlockExtendedRegister(); /** * Turn of the screen. */ void turnOffScreen(); /** * Unlock the CRT. */ void unlockCRT(); /** * Setup the CRT. */ void setupCRT(const CRTSettings& horizontal, const CRTSettings& vertical); /** * Lock the CRT. */ void lockCRT(); /** * Setup the IGA1. */ void setupIGA1(size_t width, size_t bpp); /** * Open the screen. */ void openScreen(); /** * Set the VCLK. */ void setVCLK(size_t vclk); /** * Set the registers. */ void setRegisters(); /** * Init the 2D engine. */ void init2D(size_t width, size_t height, size_t bpp); /** * Init the 3D engine. */ void init3D(); /** * Setup the V1 video layer with the given sizes. The format will * be YUV 4:2:0. * * @return the base offset of buffers the caller can use */ size_t setupV1(ssize_t sourceWidth, ssize_t sourceHeight, ssize_t realSourceWidth, ssize_t realSourceHeight, ssize_t destX, ssize_t destY, ssize_t destWidth, ssize_t destHeight); /** * Set the video buffer. */ void setV1Buffer(size_t yOffset, size_t cbOffset, size_t crOffset); /** * Find a divider for the given source and destination sizes. * * @param source should contain the original size, will contain * the new size when the divider is applied * * @return the divider exponent or 0 if no divider is necessary, * -1 on error */ int findDividerAndZoom(ssize_t& source, ssize_t dest, ssize_t& zoom, ssize_t zoomFactor); /** * Calculate the horizontal zoom and minifying paramaters needed for * the given source and destination sizes. */ void calculateHorizontalZoom(size_t sourceSize, size_t destSize, uint32_t& mini, uint32_t& displayCount, uint32_t& zoom, uint32_t& hqvFilter, uint32_t& hqvMinify); /** * Calculate the vertical zoom and minifying paramaters needed for * the given source and destination sizes. */ void calculateVerticalZoom(size_t sourceSize, size_t destSize, uint32_t& mini, uint32_t& zoom, uint32_t& hqvFilter, uint32_t& hqvMinify); /** * Calculate zooming settings. * * @param zoom will contain the zooming bits for register * V1_ZOOM_CONTROL. It should be shifted left 16 bits * for horizontal zoom and the ZOOM_ENABLE bits should * be set properly. * @param mini will contain the minifying bits for register * V1_MINI_CONTROL. It should be shifted left by 16 * bits for vertical and 24 bits for horizontal * minifying. The INTERPOLY bits should also be set. * @param hqvFilter HQV filter parameters. Should be shifted left * 16 bits for vertical filtering. * @param hqvMinify HQV minifying parameters. Should be shifted * left 16 bits for vertical minifying. */ void calculateZoom(size_t sourceSize, size_t destSize, uint32_t& mini, uint32_t& zoom, uint32_t& hqvFilter, uint32_t& hqvMinify, size_t zoomFactor); /** * Determine if a HQV flip is in progress. */ bool isHQVFlipping(); /** * Deallocate the given memory block. It should succeed only, if * that is the last memory block. */ void deallocateMemoryBlock(MemoryBlock* memoryBlock); friend class MPEGDecoder; friend class MemoryBlock;};//------------------------------------------------------------------------------// Inline definitions//------------------------------------------------------------------------------inline Window& Unichrome::getFrameBufferWindow(){ return frameBufferWindow;}//------------------------------------------------------------------------------} /* namespace unichrome *///------------------------------------------------------------------------------#endif // DXR3PLAYER_UNICHROME_UNICHROME_H// Local variables:// mode: c++// End:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -