Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c8a75c2 authored by Jean-Baptiste Queru's avatar Jean-Baptiste Queru Committed by Android Git Automerger
Browse files

am 9039f65c: am b6039811: am 05e97e81: am 0be33f2d: Merge "Add shortcut to...

am 9039f65c: am b6039811: am 05e97e81: am 0be33f2d: Merge "Add shortcut to avoid potential divide by zero in some case"

* commit '9039f65c':
  Add shortcut to avoid potential divide by zero in some case
parents b38cb4da 9039f65c
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -963,6 +963,11 @@ void FontRenderer::appendRotatedMeshQuad(float x1, float y1, float u1, float v1,
uint32_t FontRenderer::getRemainingCacheCapacity() {
uint32_t FontRenderer::getRemainingCacheCapacity() {
    uint32_t remainingCapacity = 0;
    uint32_t remainingCapacity = 0;
    float totalPixels = 0;
    float totalPixels = 0;

    //avoid divide by zero if the size is 0
    if (mCacheLines.size() == 0) {
        return 0;
    }
    for(uint32_t i = 0; i < mCacheLines.size(); i ++) {
    for(uint32_t i = 0; i < mCacheLines.size(); i ++) {
         remainingCapacity += (mCacheLines[i]->mMaxWidth - mCacheLines[i]->mCurrentCol);
         remainingCapacity += (mCacheLines[i]->mMaxWidth - mCacheLines[i]->mCurrentCol);
         totalPixels += mCacheLines[i]->mMaxWidth;
         totalPixels += mCacheLines[i]->mMaxWidth;