Skip to content

Commit

Permalink
Sample app set up to demonstrate problems with JPG decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
davemorrissey committed Jan 11, 2015
1 parent 5770dd7 commit cbef2b3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
Binary file added sample/assets/card_jpg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sample/assets/squirrel_large.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
import com.davemorrissey.labs.subscaleview.sample.R.id;
import com.davemorrissey.labs.subscaleview.sample.R.layout;
import com.davemorrissey.labs.subscaleview.sample.imagedisplay.decoders.RapidImageRegionDecoder;

import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -84,7 +85,9 @@ public boolean onOptionsItemSelected(MenuItem item) {

private void initialiseImage() {
SubsamplingScaleImageView imageView = (SubsamplingScaleImageView)findViewById(id.imageView);
imageView.setImageAsset("squirrel.jpg");
imageView.setDecoderClass(RapidImageRegionDecoder.class);
imageView.setDebug(true);
imageView.setImageAsset("squirrel_large.jpg");
}

private void updateNotes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.davemorrissey.labs.subscaleview.sample.R.id;
import com.davemorrissey.labs.subscaleview.sample.R.layout;
import com.davemorrissey.labs.subscaleview.sample.extension.ExtensionActivity;
import com.davemorrissey.labs.subscaleview.sample.imagedisplay.decoders.RapidImageRegionDecoder;

public class ImageDisplayLargeFragment extends Fragment {

Expand All @@ -39,7 +40,9 @@ public void onClick(View view) {
}
});
SubsamplingScaleImageView imageView = (SubsamplingScaleImageView)rootView.findViewById(id.imageView);
imageView.setImageAsset("card.png");
imageView.setDecoderClass(RapidImageRegionDecoder.class);
imageView.setDebug(true);
imageView.setImageAsset("card_jpg.jpg");
return rootView;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ private BitmapDecoder newDecoder() throws Exception {
} else {
decoder = BitmapDecoder.from(context, uri);
}
// RapidDecoder's PNG library works well, the JPG library has serious problems. This is a crude check,
// and won't work for resources. An app should not use this decoder for JPGs.
return decoder.useBuiltInDecoder(uriString.toLowerCase().endsWith(".png"));
decoder.useBuiltInDecoder(true);
return decoder;
}

@Override
Expand Down

0 comments on commit cbef2b3

Please sign in to comment.