Use the default resync_to_restart in jpeg.
authorscroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 25 Sep 2013 21:17:41 +0000 (21:17 +0000)
committerscroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 25 Sep 2013 21:17:41 +0000 (21:17 +0000)
Our version requires rewinding the stream, which is not always
supported. Instead, depend on jpeg's default version.

R=djsollen@google.com

Review URL: https://codereview.chromium.org/23464068

git-svn-id: http://skia.googlecode.com/svn/trunk@11458 2bbb7eff-a529-9590-31e7-b0007b416f81

src/images/SkJpegUtility.cpp

index 1ec9f00..bb499e8 100644 (file)
@@ -90,21 +90,6 @@ static void sk_skip_input_data(j_decompress_ptr cinfo, long num_bytes) {
     }
 }
 
-static boolean sk_resync_to_restart(j_decompress_ptr cinfo, int desired) {
-    skjpeg_source_mgr*  src = (skjpeg_source_mgr*)cinfo->src;
-
-    // what is the desired param for???
-
-    if (!src->fStream->rewind()) {
-        SkDebugf("xxxxxxxxxxxxxx failure to rewind\n");
-        cinfo->err->error_exit((j_common_ptr)cinfo);
-        return FALSE;
-    }
-    src->next_input_byte = (const JOCTET*)src->fBuffer;
-    src->bytes_in_buffer = 0;
-    return TRUE;
-}
-
 static void sk_term_source(j_decompress_ptr /*cinfo*/) {}
 
 
@@ -117,7 +102,7 @@ skjpeg_source_mgr::skjpeg_source_mgr(SkStream* stream, SkImageDecoder* decoder)
     init_source = sk_init_source;
     fill_input_buffer = sk_fill_input_buffer;
     skip_input_data = sk_skip_input_data;
-    resync_to_restart = sk_resync_to_restart;
+    resync_to_restart = jpeg_resync_to_restart;
     term_source = sk_term_source;
 #ifdef SK_BUILD_FOR_ANDROID
     seek_input_data = sk_seek_input_data;