[Libreoffice-commits] core.git: Branch 'feature/chart-opengl2' - 2 commits - chart2/source sfx2/source
chart2/source/view/main/DummyXShape.cxx |2 - chart2/source/view/main/OpenGLRender.cxx |2 - sfx2/source/appl/shutdownicon.cxx| 42 +++ 3 files changed, 23 insertions(+), 23 deletions(-) New commits: commit fce26e7cf30feb714c03b13ba7feae2394c76651 Author: yangzhang yangzh...@multicorewareinc.com Date: Wed Jan 15 16:30:27 2014 +0800 Fix the error of shutdownicon.cxx. Change-Id: I91d62edd72e884a0139d3aca46aff0db88b202be Signed-off-by: shaochunfang shaoc...@multicorewareinc.com diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index ea865f4..2987d39 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -213,9 +213,9 @@ public: class IdleTerminate : Timer { -Reference XDesktop2 m_xDesktop; +::com::sun::star::uno::Reference XDesktop2 m_xDesktop; public: -IdleTerminate (Reference XDesktop2 xDesktop) +IdleTerminate (::com::sun::star::uno::Reference XDesktop2 xDesktop) { m_xDesktop = xDesktop; Start(); @@ -257,7 +257,7 @@ void ShutdownIcon::deInitSystray() } -ShutdownIcon::ShutdownIcon( const Reference XComponentContext rxContext ) : +ShutdownIcon::ShutdownIcon( const ::com::sun::star::uno::Reference XComponentContext rxContext ) : ShutdownIconServiceBase( m_aMutex ), m_bVeto ( false ), m_bListenForTermination ( false ), @@ -285,16 +285,16 @@ void ShutdownIcon::OpenURL( const OUString aURL, const OUString rTarget, const { if ( getInstance() getInstance()-m_xDesktop.is() ) { -Reference XDispatchProvider xDispatchProvider( getInstance()-m_xDesktop, UNO_QUERY ); +::com::sun::star::uno::Reference XDispatchProvider xDispatchProvider( getInstance()-m_xDesktop, UNO_QUERY ); if ( xDispatchProvider.is() ) { com::sun::star::util::URL aDispatchURL; aDispatchURL.Complete = aURL; -Reference util::XURLTransformer xURLTransformer( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); +::com::sun::star::uno::Reference util::XURLTransformer xURLTransformer( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); try { -Reference com::sun::star::frame::XDispatch xDispatch; +::com::sun::star::uno::Reference com::sun::star::frame::XDispatch xDispatch; xURLTransformer-parseStrict( aDispatchURL ); xDispatch = xDispatchProvider-queryDispatch( aDispatchURL, rTarget, 0 ); @@ -330,18 +330,18 @@ void ShutdownIcon::FromTemplate() { if ( getInstance() getInstance()-m_xDesktop.is() ) { -Reference ::com::sun::star::frame::XFramesSupplier xDesktop ( getInstance()-m_xDesktop, UNO_QUERY); -Reference ::com::sun::star::frame::XFrame xFrame( xDesktop-getActiveFrame() ); +::com::sun::star::uno::Reference ::com::sun::star::frame::XFramesSupplier xDesktop ( getInstance()-m_xDesktop, UNO_QUERY); +::com::sun::star::uno::Reference ::com::sun::star::frame::XFrame xFrame( xDesktop-getActiveFrame() ); if ( !xFrame.is() ) -xFrame = Reference ::com::sun::star::frame::XFrame ( xDesktop, UNO_QUERY ); +xFrame = ::com::sun::star::uno::Reference ::com::sun::star::frame::XFrame ( xDesktop, UNO_QUERY ); URL aTargetURL; aTargetURL.Complete = slot:5500; -Reference util::XURLTransformer xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); +::com::sun::star::uno::Reference util::XURLTransformer xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans-parseStrict( aTargetURL ); -Reference ::com::sun::star::frame::XDispatchProvider xProv( xFrame, UNO_QUERY ); -Reference ::com::sun::star::frame::XDispatch xDisp; +::com::sun::star::uno::Reference ::com::sun::star::frame::XDispatchProvider xProv( xFrame, UNO_QUERY ); +::com::sun::star::uno::Reference ::com::sun::star::frame::XDispatch xDisp; if ( xProv.is() ) { if (aTargetURL.Protocol == slot:) @@ -355,7 +355,7 @@ void ShutdownIcon::FromTemplate() PropertyValue* pArg = aArgs.getArray(); pArg[0].Name = Referer; pArg[0].Value = OUString(private:user); -Reference ::com::sun::star::frame::XNotifyingDispatch xNotifyer( xDisp, UNO_QUERY ); +::com::sun::star::uno::Reference ::com::sun::star::frame::XNotifyingDispatch xNotifyer( xDisp, UNO_QUERY ); if ( xNotifyer.is() ) { EnterModalMode(); @@ -424,7 +424,7 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR // use constructor for filling up filters automatically! if ( ERRCODE_NONE == pThis
[Libreoffice-commits] core.git: Branch 'feature/chart-opengl2' - 2 commits - chart2/source
chart2/source/view/main/DummyXShape.cxx| 12 + chart2/source/view/main/OpenGLRender.cxx | 202 + chart2/source/view/main/OpenGLRender.hxx | 13 + chart2/source/view/main/OpenglShapeFactory.cxx |3 4 files changed, 229 insertions(+), 1 deletion(-) New commits: commit 140dc8560947e49ccc78d5ac3bf79d6232b779aa Author: YangZhang yangzh...@multicorewareinc.com Date: Mon Dec 30 17:20:18 2013 +0800 fix linux compilation Change-Id: I1631fe4abfd1a14d39410e6e75883949dfc15c18 Signed-off-by: shaochunfang shaoc...@multicorewareinc.com diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index 6e88010..d76b4fa 100755 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -996,6 +996,7 @@ void OpenGLRender::SetLine2DWidth(int width) m_fLineWidth = (m_fLineWidth 0.001) ? 0.001 : m_fLineWidth; } +#if defined( _WIN32 ) static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) @@ -1106,7 +1107,7 @@ int OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd) DestroyWindow(hWnd); return m_iArbMultisampleSupported; } - +#endif int OpenGLRender::GetMSAASupport() { return m_iArbMultisampleSupported; @@ -1117,6 +1118,7 @@ int OpenGLRender::GetMSAAFormat() return m_iArbMultisampleFormat; } +#if defined( _WIN32 ) int OpenGLRender::InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPfd) { PIXELFORMATDESCRIPTOR pfd = inPfd; @@ -1157,7 +1159,6 @@ int OpenGLRender::InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATD } return 0; } - int OpenGLRender::WGLisExtensionSupported(const char *extension) { const size_t extlen = strlen(extension); @@ -1194,7 +1195,7 @@ int OpenGLRender::WGLisExtensionSupported(const char *extension) } return 1; } - +#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx index 5643bc9..70b05e0 100755 --- a/chart2/source/view/main/OpenGLRender.hxx +++ b/chart2/source/view/main/OpenGLRender.hxx @@ -124,7 +124,9 @@ public: void SetLine2DColor(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b); void SetLine2DWidth(int width); BitmapEx GetAsBitmap(); +#if defined( _WIN32 ) int InitMultisample(PIXELFORMATDESCRIPTOR pfd); +#endif int GetMSAASupport(); int GetMSAAFormat(); private: @@ -134,7 +136,9 @@ private: int CreateFrameBufferObj(); int RenderTexture(GLuint TexID); int RenderTexture2FBO(GLuint TexID); +#if defined( _WIN32 ) int InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPfd); +#endif int WGLisExtensionSupported(const char *extension); private: // Projection matrix : default 45 degree Field of View, 4:3 ratio, display range : 0.1 unit - 100 units commit a0fc1639bd544c48c121a4fff8e6109c8b164484 Author: Peilin pei...@multicorewareinc.com Date: Mon Dec 30 16:44:23 2013 +0800 add anti-aliasing init diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index 335e0e2..64dc65a 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -825,7 +825,17 @@ bool DummyChart::initOpengl() 0, 0, 0 // Layer Masks Ignored }; -int WindowPix = ChoosePixelFormat(GLWin.hDC,PixelFormatFront); +// we must check whether can set the MSAA +int WindowPix; +m_GLRender.InitMultisample(PixelFormatFront); +if (m_GLRender.GetMSAASupport()) +{ +WindowPix = m_GLRender.GetMSAAFormat(); +} +else +{ +WindowPix = ChoosePixelFormat(GLWin.hDC,PixelFormatFront); +} SetPixelFormat(GLWin.hDC,WindowPix,PixelFormatFront); GLWin.hRC = wglCreateContext(GLWin.hDC); wglMakeCurrent(GLWin.hDC,GLWin.hRC); diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index 1d3a9f4..6e88010 100755 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -996,4 +996,205 @@ void OpenGLRender::SetLine2DWidth(int width) m_fLineWidth = (m_fLineWidth 0.001) ? 0.001 : m_fLineWidth; } +static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ +switch (message) +{ +case WM_CREATE: +return 0; +case WM_CLOSE: +PostQuitMessage(0); +return 0; +case WM_DESTROY: +return 0; +case WM_KEYDOWN: +switch(wParam) +{ +case VK_ESCAPE: +PostQuitMessage(0); +return 0; + +case VK_SPACE: +break; +} +default: +return DefWindowProc(hwnd, message, wParam, lParam); +} +} + + +int OpenGLRender::InitMultisample
[Libreoffice-commits] core.git: Branch 'feature/chart-opengl2' - 2 commits - chart2/source
chart2/source/view/main/OpenGLRender.cxx | 216 + chart2/source/view/main/OpenGLRender.hxx | 43 chart2/source/view/main/OpenglShapeFactory.cxx |6 3 files changed, 265 insertions(+) New commits: commit 356fc4ffe09bb804068c5786d3b3c1f38b3a8690 Author: YangZhang yangzh...@multicorewareinc.com Date: Mon Dec 30 19:03:03 2013 +0800 add bubble chart Change-Id: Idfffb7ce8607964ecb71571546bfcc2544b4e00a Signed-off-by: shaochunfang shaoc...@multicorewareinc.com diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index cbb5af8..f039ffd 100755 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -27,6 +27,13 @@ using namespace std; #define OPENGL_SHADER( ... )# __VA_ARGS__ +#define GL_PI 3.14159f + +#if defined( _WIN32 ) +#define WGL_SAMPLE_BUFFERS_ARB 0x2041 +#define WGL_SAMPLES_ARB 0x2042 +#endif + const char *ColorFragmemtShader = OPENGL_SHADER ( varying vec3 fragmentColor; @@ -1226,5 +1233,185 @@ int OpenGLRender::CreateMultiSampleFrameBufObj() return 0; } +int OpenGLRender::Create2DCircle(int detail) +{ +float angle; +int idx = 2; +if (detail = 0) +{ +return -1; +} +m_Bubble2DCircle.bufLen = 2 * (detail + 3)* sizeof(float); +m_Bubble2DCircle.pointBuf = (float *)malloc(m_Bubble2DCircle.bufLen); +memset(m_Bubble2DCircle.pointBuf, 0, m_Bubble2DCircle.bufLen); +for(angle = 2.0f * GL_PI; angle -(2.0f * GL_PI / detail); angle -= (2.0f * GL_PI / detail)) +{ +m_Bubble2DCircle.pointBuf[idx++] = sin(angle); +m_Bubble2DCircle.pointBuf[idx++] = cos(angle); +} +return 0; +} + +int OpenGLRender::Bubble2DShapePoint(float x, float y, float directionX, float directionY) +{ +//check whether to create the circle data +if (!m_Bubble2DCircle.pointBuf) +{ +Create2DCircle(100); +} + +float actualX = (x / 10.0f) - ((float)m_iWidth / 2); +float actualY = (y / 10.0f) - ((float)m_iHeight / 2); +m_Bubble2DPointList.x = actualX; +m_Bubble2DPointList.y = actualY; +m_Bubble2DPointList.xScale = directionX / 10.0f; +m_Bubble2DPointList.yScale = directionY / 10.0f; + +m_fPicLeft = actualX m_fPicLeft ? actualX : m_fPicLeft; + +m_fPicRight = actualX m_fPicRight ? actualX : m_fPicRight; + +m_fPicBottom = actualY m_fPicBottom ? actualY : m_fPicBottom; + +m_fPicTop = actualY m_fPicTop ? actualY : m_fPicTop; + +m_Bubble2DShapePointList.push_back(m_Bubble2DPointList); +return 0; +} + +int OpenGLRender::RenderBubble2FBO(int wholeFlag) +{ +char fileName[256] = {0}; +GLenum status; +glViewport(0, 0, m_iWidth, m_iHeight); +glClearDepth(1.0f); +// Clear the screen +glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +if ((!m_FboID[0]) || (!m_FboID[1])) +{ +// create a texture object +CreateTextureObj(m_iWidth, m_iHeight); +//create render buffer object +CreateRenderObj(m_iWidth, m_iHeight); +//create fbo +CreateFrameBufferObj(); +if (m_iArbMultisampleSupported) +{ +CreateMultiSampleFrameBufObj(); +} +} +//bind fbo +if (m_iArbMultisampleSupported) +{ +glBindFramebuffer(GL_FRAMEBUFFER,m_frameBufferMS); +} +else +{ +glBindFramebuffer(GL_FRAMEBUFFER, m_FboID[m_iFboIdx % 2]); +} +// Clear the screen +glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +if (wholeFlag) +{ +if (m_iFboIdx 0) +{ + RenderTexture2FBO(m_TextureObj[(m_iFboIdx - 1) % 2]); +} +} +int listNum = m_Bubble2DShapePointList.size(); +for (int i = 0; i listNum; i++) +{ +//move the circle to the pos, and scale using the xScale and Y scale +Bubble2DPointList pointList = m_Bubble2DShapePointList.front(); +PosVecf3 trans = {pointList.x, pointList.y, 0.0f}; +PosVecf3 angle = {0.0f, 0.0f, 0.0f}; +PosVecf3 scale = {pointList.xScale, pointList.yScale, 1.0f}; +MoveModelf(trans, angle, scale); +m_MVP = m_Projection * m_View * m_Model; +//render to fbo +//fill vertex buffer +glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer); +if (!m_Bubble2DCircle.pointBuf) +{ +Create2DCircle(100); +} +glBufferData(GL_ARRAY_BUFFER, m_Bubble2DCircle.bufLen, m_Bubble2DCircle.pointBuf, GL_STATIC_DRAW); + +glUseProgram(m_CommonProID); + +glUniform4fv(m_2DColorID, 1, m_2DColor[0]); + +glUniformMatrix4fv(m_MatrixID, 1, GL_FALSE, m_MVP[0][0]); +// 1rst attribute buffer : vertices +glEnableVertexAttribArray(m_2DVertexID); +glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer); +glVertexAttribPointer( +m_2DVertexID, // attribute. No particular reason for 0, but must match
[Libreoffice-commits] core.git: Branch 'feature/chart-opengl' - chart2/source
chart2/source/view/main/OpenGLRender.cxx | 57 +++ 1 file changed, 29 insertions(+), 28 deletions(-) New commits: commit 18f3de78e6bd8583de4de8911c027489f8dfbf11 Author: YangZhang yangzh...@multicorewareinc.com Date: Fri Dec 20 17:41:24 2013 +0800 Fix warning of OpenGL Change-Id: Iceb26e5245470fe9a23c41f0b448481aa7a1a1eb diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index ffe7293..92489c3 100644 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -197,7 +197,7 @@ static const GLfloat g_color_buffer_data[] = { 0.982f, 0.099f, 0.879f }; #endif -int static checkGLError(char *file, int line) +int static checkGLError(const char *file, int line) { GLenum glErr; intretCode = 0; @@ -220,6 +220,13 @@ int static checkGLError(char *file, int line) #define CHECK_GL_ERROR() checkGLError(__FILE__, __LINE__) +#define CHECK_GL_FRAME_BUFFER_STATUS() \ +status = glCheckFramebufferStatus(GL_FRAMEBUFFER);\ +if( status != GL_FRAMEBUFFER_COMPLETE ) {\ +printf( error at line(%d) '%d'\n, __LINE__, status );\ +return -1;\ +} + GLint OpenGLRender::LoadShaders(const char *vertexShader,const char *fragmentShader) { // Create the shaders @@ -439,7 +446,8 @@ int OpenGLRender::RenderModelf2FBO(float *vertexArray, unsigned int vertexArrayS //create render buffer object CreateRenderObj(m_iWidth, m_iHeight); //create fbo -CreateFrameBufferObj(); +if ( CreateFrameBufferObj() !=0 ) +return -1; //fill vertex buffer glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer); glBufferData(GL_ARRAY_BUFFER, vertexArraySize, vertexArray, GL_STATIC_DRAW); @@ -487,12 +495,8 @@ int OpenGLRender::RenderModelf2FBO(float *vertexArray, unsigned int vertexArrayS glDisableVertexAttribArray(m_VertexID); glDisableVertexAttribArray(m_ColorID); glUseProgram(0); -int result = 0; -GLenum fbResult = glCheckFramebufferStatus(GL_FRAMEBUFFER); -if( fbResult != GL_FRAMEBUFFER_COMPLETE ) -{ -result = -1; -} +GLenum status; +CHECK_GL_FRAME_BUFFER_STATUS(); #if 0 sal_uInt8 *buf = (sal_uInt8 *)malloc(m_iWidth * m_iHeight * 3 + BMP_HEADER_LEN); CreateBMPHeader(buf, m_iWidth, -m_iHeight); @@ -515,12 +519,12 @@ int OpenGLRender::RenderModelf2FBO(float *vertexArray, unsigned int vertexArrayS Bitmap::ScopedWriteAccess pAlphaWriteAccess( aAlpha ); size_t nCurPos = 0; -for( size_t y = 0; y m_iHeight; ++y) +for( int y = 0; y m_iHeight; ++y) { Scanline pScan = pWriteAccess-GetScanline(y); Scanline pAlphaScan = pAlphaWriteAccess-GetScanline(y); -for( size_t x = 0; x m_iWidth; ++x ) +for( int x = 0; x m_iWidth; ++x ) { *pScan++ = buf[nCurPos]; *pScan++ = buf[nCurPos+1]; @@ -588,7 +592,8 @@ int OpenGLRender::RenderLine2FBO(int wholeFlag) //create render buffer object CreateRenderObj(m_iWidth, m_iHeight); //create fbo -CreateFrameBufferObj(); +if ( CreateFrameBufferObj() !=0 ) +return -1; } //bind fbo glBindFramebuffer(GL_FRAMEBUFFER, m_FboID[m_iFboIdx % 2]); @@ -633,12 +638,8 @@ int OpenGLRender::RenderLine2FBO(int wholeFlag) free(pointList.pointBuf); } m_iPointNum = 0; -int result = 0; -GLenum fbResult = glCheckFramebufferStatus(GL_FRAMEBUFFER); -if( fbResult != GL_FRAMEBUFFER_COMPLETE ) -{ -result = -1; -} +GLenum status; +CHECK_GL_FRAME_BUFFER_STATUS(); #if 0 sal_uInt8 *buf = (sal_uInt8 *)malloc(m_iWidth * m_iHeight * 3 + BMP_HEADER_LEN); CreateBMPHeader(buf, m_iWidth, m_iHeight); @@ -651,21 +652,21 @@ int OpenGLRender::RenderLine2FBO(int wholeFlag) boost::scoped_arraysal_uInt8 buf(new sal_uInt8[m_iWidth * m_iHeight * 4]); glReadPixels(0, 0, m_iWidth, m_iHeight, GL_BGR, GL_UNSIGNED_BYTE, buf.get()); BitmapEx aBmp; -aBmp.Expand(m_iWidth, m_iHeight); +aBmp.SetSizePixel(Size(m_iWidth, m_iHeight)); -Bitmap aBitmap( Size( m_iWidth, m_iHeight ), 24 ); -Bitmap aAlpha( Size( m_iWidth, m_iHeight ), 24 ); +Bitmap aBitmap( aBmp.GetBitmap() ); +Bitmap aAlpha( aBmp.GetAlpha().GetBitmap() ); Bitmap::ScopedWriteAccess pWriteAccess( aBitmap ); Bitmap::ScopedWriteAccess pAlphaWriteAccess( aAlpha ); size_t nCurPos = 0; -for( size_t y = 0; y m_iHeight; ++y) +for( int y = 0; y m_iHeight; ++y) { Scanline pScan = pWriteAccess-GetScanline(y); Scanline pAlphaScan = pAlphaWriteAccess-GetScanline(y); -for( size_t x = 0; x m_iWidth; ++x ) +for( int x = 0; x m_iWidth; ++x ) { *pScan++ = buf[nCurPos]; *pScan++ = buf[nCurPos+1]; @@ -847,32 +848,32 @@ int OpenGLRender::CreateFrameBufferObj() GLenum status; // create
[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source
sc/qa/unit/data/ods/opencl/math/Abs.ods |binary sc/qa/unit/opencl-test.cxx | 28 +++ sc/source/core/opencl/formulagroupcl.cxx |5 sc/source/core/opencl/op_math.cxx| 32 +++ sc/source/core/opencl/op_math.hxx|8 +++ sc/source/core/tool/token.cxx|1 6 files changed, 74 insertions(+) New commits: commit 01f6f620395a86abe1e7f503ae4b3b5f7124e144 Author: yangzhang yangzh...@multicorewareinc.com Date: Mon Nov 4 15:36:56 2013 +0800 GPU Calc: implement fix for ABS AMLOEXT-47 FIX Change-Id: I438ad01d717dbc34ea8bc45e8f6de4f7d0c2bf2c Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index f0fd68b..d3ad8bc 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1023,6 +1023,11 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( case ocSinHyp: mvSubArguments.push_back(SoPHelper(ts, ft-Children[i],new OpSinh)); +break; +case ocAbs: +mvSubArguments.push_back(SoPHelper(ts, + ft-Children[i], new OpAbs)); +break; case ocExternal: if ( !(pChild-GetExternal().compareTo(OUString( com.sun.star.sheet.addin.Analysis.getEffect diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 32d2eb5..b3afda2 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -110,6 +110,38 @@ void OpSinh::GenSlidingWindowFunction(std::stringstream ss, ss }; } +void OpAbs::GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments) +{ +ss \ndouble sSymName; +ss _ BinFuncName() (; +for (unsigned i = 0; i vSubArguments.size(); i++) +{ +if (i) +ss ,; +vSubArguments[i]-GenSlidingWindowDecl(ss); +} +ss ) {\n; +ss int gid0 = get_global_id(0);\n; +ss double tmp = GetBottom() ;\n; +#ifdef ISNAN +FormulaToken *tmpCur0 = vSubArguments[0]-GetFormulaToken(); +const formula::SingleVectorRefToken*tmpCurDVR0= +dynamic_castconst formula::SingleVectorRefToken *(tmpCur0); +ss int buffer_len = ; +ss tmpCurDVR0-GetArrayLength(); +ss ;\n; +ss if((gid0)=buffer_len || isNan(; +ss vSubArguments[0]-GenSlidingWindowDeclRef(); +ss ))\n; +ss tmp = GetBottom() ;\nelse \n; +#endif +ss tmp = ; +ss vSubArguments[0]-GenSlidingWindowDeclRef(); +ss ;\n; +ss return fabs(tmp);\n; +ss }; +} }} diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx index 7399a6a..1e59c41 100644 --- a/sc/source/core/opencl/op_math.hxx +++ b/sc/source/core/opencl/op_math.hxx @@ -38,6 +38,14 @@ public: const std::string sSymName, SubArguments vSubArguments); virtual std::string BinFuncName(void) const { return Sinh; } }; + +class OpAbs:public Normal{ +public: +virtual void GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments); +virtual std::string GetBottom(void) { return 0.0; } +virtual std::string BinFuncName(void) const { return ScAbs; } +}; }} #endif commit 73cde39d6314fcc426165d1fea204f78de847ffb Author: yangzhang yangzh...@multicorewareinc.com Date: Mon Nov 4 14:58:13 2013 +0800 GPU Calc: unit test cases for ABS Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-47 BUG Change-Id: Ie33b4e5fad47f58a33ecdb0405521e7df694148c Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/qa/unit/data/ods/opencl/math/Abs.ods b/sc/qa/unit/data/ods/opencl/math/Abs.ods new file mode 100644 index 000..2e55c73 Binary files /dev/null and b/sc/qa/unit/data/ods/opencl/math/Abs.ods differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 88232aa..90867ba 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -123,6 +123,7 @@ public: void testFinancialDurationFormula(); void testFinancialCoupnumFormula(); void testMathFormulaSinh(); +void testMathFormulaAbs(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -177,6 +178,7 @@ public: CPPUNIT_TEST(testFinancialDurationFormula); CPPUNIT_TEST(testFinancialCoupnumFormula); CPPUNIT_TEST(testMathFormulaSinh); +CPPUNIT_TEST(testMathFormulaAbs); CPPUNIT_TEST_SUITE_END(); private
[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/ods/opencl/math/Abs.ods |binary sc/qa/unit/opencl-test.cxx | 28 +++ sc/source/core/opencl/formulagroupcl.cxx |5 sc/source/core/opencl/op_math.cxx| 32 +++ sc/source/core/opencl/op_math.hxx|8 +++ sc/source/core/tool/token.cxx|1 6 files changed, 74 insertions(+) New commits: commit bab01caa314a98e715d25c19d719c96b838310b3 Author: yangzhang yangzh...@multicorewareinc.com Date: Mon Nov 4 15:36:56 2013 +0800 GPU Calc: implement fix for ABS AMLOEXT-47 FIX Change-Id: I438ad01d717dbc34ea8bc45e8f6de4f7d0c2bf2c Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 3e80351..0b69d4e 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1023,6 +1023,11 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( case ocSinHyp: mvSubArguments.push_back(SoPHelper(ts, ft-Children[i],new OpSinh)); +break; +case ocAbs: +mvSubArguments.push_back(SoPHelper(ts, + ft-Children[i], new OpAbs)); +break; case ocExternal: if ( !(pChild-GetExternal().compareTo(OUString( com.sun.star.sheet.addin.Analysis.getEffect diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 32d2eb5..b3afda2 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -110,6 +110,38 @@ void OpSinh::GenSlidingWindowFunction(std::stringstream ss, ss }; } +void OpAbs::GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments) +{ +ss \ndouble sSymName; +ss _ BinFuncName() (; +for (unsigned i = 0; i vSubArguments.size(); i++) +{ +if (i) +ss ,; +vSubArguments[i]-GenSlidingWindowDecl(ss); +} +ss ) {\n; +ss int gid0 = get_global_id(0);\n; +ss double tmp = GetBottom() ;\n; +#ifdef ISNAN +FormulaToken *tmpCur0 = vSubArguments[0]-GetFormulaToken(); +const formula::SingleVectorRefToken*tmpCurDVR0= +dynamic_castconst formula::SingleVectorRefToken *(tmpCur0); +ss int buffer_len = ; +ss tmpCurDVR0-GetArrayLength(); +ss ;\n; +ss if((gid0)=buffer_len || isNan(; +ss vSubArguments[0]-GenSlidingWindowDeclRef(); +ss ))\n; +ss tmp = GetBottom() ;\nelse \n; +#endif +ss tmp = ; +ss vSubArguments[0]-GenSlidingWindowDeclRef(); +ss ;\n; +ss return fabs(tmp);\n; +ss }; +} }} diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx index 7399a6a..1e59c41 100644 --- a/sc/source/core/opencl/op_math.hxx +++ b/sc/source/core/opencl/op_math.hxx @@ -38,6 +38,14 @@ public: const std::string sSymName, SubArguments vSubArguments); virtual std::string BinFuncName(void) const { return Sinh; } }; + +class OpAbs:public Normal{ +public: +virtual void GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments); +virtual std::string GetBottom(void) { return 0.0; } +virtual std::string BinFuncName(void) const { return ScAbs; } +}; }} #endif commit e753429f1c51aed08b972367437c87978f12e83a Author: yangzhang yangzh...@multicorewareinc.com Date: Mon Nov 4 14:58:13 2013 +0800 GPU Calc: unit test cases for ABS Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-47 BUG Change-Id: Ie33b4e5fad47f58a33ecdb0405521e7df694148c Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/qa/unit/data/ods/opencl/math/Abs.ods b/sc/qa/unit/data/ods/opencl/math/Abs.ods new file mode 100644 index 000..2e55c73 Binary files /dev/null and b/sc/qa/unit/data/ods/opencl/math/Abs.ods differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index f0d1e88..3a9493b 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -125,6 +125,7 @@ public: void testFinancialDurationFormula(); void testFinancialCoupnumFormula(); void testMathFormulaSinh(); +void testMathFormulaAbs(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -179,6 +180,7 @@ public: CPPUNIT_TEST(testFinancialDurationFormula); CPPUNIT_TEST(testFinancialCoupnumFormula); CPPUNIT_TEST(testMathFormulaSinh); +CPPUNIT_TEST(testMathFormulaAbs); CPPUNIT_TEST_SUITE_END(); private