Loading libs/rs/rsContext.cpp +24 −0 Original line number Diff line number Diff line Loading @@ -472,6 +472,30 @@ void Context::setSurface(uint32_t w, uint32_t h, RsNativeWindow sur) { } } uint32_t Context::getCurrentSurfaceWidth() const { for (uint32_t i = 0; i < mFBOCache.mHal.state.colorTargetsCount; i ++) { if (mFBOCache.mHal.state.colorTargets[i] != NULL) { return mFBOCache.mHal.state.colorTargets[i]->getType()->getDimX(); } } if (mFBOCache.mHal.state.depthTarget != NULL) { return mFBOCache.mHal.state.depthTarget->getType()->getDimX(); } return mWidth; } uint32_t Context::getCurrentSurfaceHeight() const { for (uint32_t i = 0; i < mFBOCache.mHal.state.colorTargetsCount; i ++) { if (mFBOCache.mHal.state.colorTargets[i] != NULL) { return mFBOCache.mHal.state.colorTargets[i]->getType()->getDimY(); } } if (mFBOCache.mHal.state.depthTarget != NULL) { return mFBOCache.mHal.state.depthTarget->getType()->getDimY(); } return mHeight; } void Context::pause() { rsAssert(mIsGraphicsContext); mPaused = true; Loading libs/rs/rsContext.h +3 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,9 @@ public: uint32_t getWidth() const {return mWidth;} uint32_t getHeight() const {return mHeight;} uint32_t getCurrentSurfaceWidth() const; uint32_t getCurrentSurfaceHeight() const; mutable ThreadIO mIO; // Timers Loading libs/rs/rsFont.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -654,11 +654,7 @@ void FontState::appendMeshQuad(float x1, float y1, float z1, const uint32_t floatsPerVert = 6; float *currentPos = mTextMeshPtr + mCurrentQuadIndex * vertsPerQuad * floatsPerVert; // Cull things that are off the screen float width = (float)mRSC->getWidth(); float height = (float)mRSC->getHeight(); if (x1 > width || y1 < 0.0f || x2 < 0 || y4 > height) { if (x1 > mSurfaceWidth || y1 < 0.0f || x2 < 0 || y4 > mSurfaceHeight) { return; } Loading Loading @@ -750,6 +746,10 @@ void FontState::renderText(const char *text, uint32_t len, int32_t x, int32_t y, return; } // Cull things that are off the screen mSurfaceWidth = (float)mRSC->getCurrentSurfaceWidth(); mSurfaceHeight = (float)mRSC->getCurrentSurfaceHeight(); currentFont->renderUTF(text, len, x, y, startIndex, numGlyphs, mode, bounds, bitmap, bitmapW, bitmapH); Loading libs/rs/rsFont.h +3 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,9 @@ public: protected: float mSurfaceWidth; float mSurfaceHeight; friend class Font; struct CacheTextureLine { Loading libs/rs/rsProgramVertex.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -206,8 +206,11 @@ void ProgramVertexState::init(Context *rsc) { void ProgramVertexState::updateSize(Context *rsc) { float *f = static_cast<float *>(mDefaultAlloc->getPtr()); float surfaceWidth = (float)rsc->getCurrentSurfaceWidth(); float surfaceHeight = (float)rsc->getCurrentSurfaceHeight(); Matrix4x4 m; m.loadOrtho(0,rsc->getWidth(), rsc->getHeight(),0, -1,1); m.loadOrtho(0, surfaceWidth, surfaceHeight, 0, -1, 1); memcpy(&f[RS_PROGRAM_VERTEX_PROJECTION_OFFSET], m.m, sizeof(m)); memcpy(&f[RS_PROGRAM_VERTEX_MVP_OFFSET], m.m, sizeof(m)); Loading Loading
libs/rs/rsContext.cpp +24 −0 Original line number Diff line number Diff line Loading @@ -472,6 +472,30 @@ void Context::setSurface(uint32_t w, uint32_t h, RsNativeWindow sur) { } } uint32_t Context::getCurrentSurfaceWidth() const { for (uint32_t i = 0; i < mFBOCache.mHal.state.colorTargetsCount; i ++) { if (mFBOCache.mHal.state.colorTargets[i] != NULL) { return mFBOCache.mHal.state.colorTargets[i]->getType()->getDimX(); } } if (mFBOCache.mHal.state.depthTarget != NULL) { return mFBOCache.mHal.state.depthTarget->getType()->getDimX(); } return mWidth; } uint32_t Context::getCurrentSurfaceHeight() const { for (uint32_t i = 0; i < mFBOCache.mHal.state.colorTargetsCount; i ++) { if (mFBOCache.mHal.state.colorTargets[i] != NULL) { return mFBOCache.mHal.state.colorTargets[i]->getType()->getDimY(); } } if (mFBOCache.mHal.state.depthTarget != NULL) { return mFBOCache.mHal.state.depthTarget->getType()->getDimY(); } return mHeight; } void Context::pause() { rsAssert(mIsGraphicsContext); mPaused = true; Loading
libs/rs/rsContext.h +3 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,9 @@ public: uint32_t getWidth() const {return mWidth;} uint32_t getHeight() const {return mHeight;} uint32_t getCurrentSurfaceWidth() const; uint32_t getCurrentSurfaceHeight() const; mutable ThreadIO mIO; // Timers Loading
libs/rs/rsFont.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -654,11 +654,7 @@ void FontState::appendMeshQuad(float x1, float y1, float z1, const uint32_t floatsPerVert = 6; float *currentPos = mTextMeshPtr + mCurrentQuadIndex * vertsPerQuad * floatsPerVert; // Cull things that are off the screen float width = (float)mRSC->getWidth(); float height = (float)mRSC->getHeight(); if (x1 > width || y1 < 0.0f || x2 < 0 || y4 > height) { if (x1 > mSurfaceWidth || y1 < 0.0f || x2 < 0 || y4 > mSurfaceHeight) { return; } Loading Loading @@ -750,6 +746,10 @@ void FontState::renderText(const char *text, uint32_t len, int32_t x, int32_t y, return; } // Cull things that are off the screen mSurfaceWidth = (float)mRSC->getCurrentSurfaceWidth(); mSurfaceHeight = (float)mRSC->getCurrentSurfaceHeight(); currentFont->renderUTF(text, len, x, y, startIndex, numGlyphs, mode, bounds, bitmap, bitmapW, bitmapH); Loading
libs/rs/rsFont.h +3 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,9 @@ public: protected: float mSurfaceWidth; float mSurfaceHeight; friend class Font; struct CacheTextureLine { Loading
libs/rs/rsProgramVertex.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -206,8 +206,11 @@ void ProgramVertexState::init(Context *rsc) { void ProgramVertexState::updateSize(Context *rsc) { float *f = static_cast<float *>(mDefaultAlloc->getPtr()); float surfaceWidth = (float)rsc->getCurrentSurfaceWidth(); float surfaceHeight = (float)rsc->getCurrentSurfaceHeight(); Matrix4x4 m; m.loadOrtho(0,rsc->getWidth(), rsc->getHeight(),0, -1,1); m.loadOrtho(0, surfaceWidth, surfaceHeight, 0, -1, 1); memcpy(&f[RS_PROGRAM_VERTEX_PROJECTION_OFFSET], m.m, sizeof(m)); memcpy(&f[RS_PROGRAM_VERTEX_MVP_OFFSET], m.m, sizeof(m)); Loading