Skip to content
This repository was archived by the owner on Nov 13, 2024. It is now read-only.
This repository was archived by the owner on Nov 13, 2024. It is now read-only.

improvement of getScratchedRatio #20

@razgrizbw

Description

@razgrizbw

The performance will have much improve if using Bitmap.getpixels in getScratchedRation()

replace the code with

final int width = mScratchedTestBitmap.getWidth();
final int height = mScratchedTestBitmap.getHeight();
int[] pixels = new int[width*height];
mScratchedTestBitmap.getPixels(pixels, 0, width, 0, 0, width, height);
for (int i=0;i<pixels.length;i++) {
  if (0 == Color.alpha(pixels[i])) {
    count++;
  }
}
float completed = (float) count / ((width / speed) * (height / speed)) * 100;
return completed;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions