Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Unified Diff: src/images/SkJpegUtility.cpp

Issue 1820503002: Delete SkImageDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@fix-animator
Patch Set: Include SkImage Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/images/SkJpegUtility.h ('k') | src/images/SkScaledBitmapSampler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkJpegUtility.cpp
diff --git a/src/images/SkJpegUtility.cpp b/src/images/SkJpegUtility.cpp
index f1a32cae1007fa101f53353d8474cd9e709de079..ab8486bcf6261fc40476ec23714bfd6e6f939089 100644
--- a/src/images/SkJpegUtility.cpp
+++ b/src/images/SkJpegUtility.cpp
@@ -8,108 +8,6 @@
#include "SkJpegUtility.h"
-/////////////////////////////////////////////////////////////////////
-static void sk_init_source(j_decompress_ptr cinfo) {
- skjpeg_source_mgr* src = (skjpeg_source_mgr*)cinfo->src;
- src->next_input_byte = (const JOCTET*)src->fBuffer;
- src->bytes_in_buffer = 0;
-#ifdef SK_JPEG_INDEX_SUPPORTED
- src->current_offset = 0;
-#endif
- if (!src->fStream->rewind()) {
- SkDebugf("xxxxxxxxxxxxxx failure to rewind\n");
- cinfo->err->error_exit((j_common_ptr)cinfo);
- }
-}
-
-#ifdef SK_JPEG_INDEX_SUPPORTED
-static boolean sk_seek_input_data(j_decompress_ptr cinfo, long byte_offset) {
- skjpeg_source_mgr* src = (skjpeg_source_mgr*)cinfo->src;
- size_t bo = (size_t) byte_offset;
-
- if (bo > src->current_offset) {
- (void)src->fStream->skip(bo - src->current_offset);
- } else {
- if (!src->fStream->rewind()) {
- SkDebugf("xxxxxxxxxxxxxx failure to rewind\n");
- cinfo->err->error_exit((j_common_ptr)cinfo);
- return false;
- }
- (void)src->fStream->skip(bo);
- }
-
- src->current_offset = bo;
- src->next_input_byte = (const JOCTET*)src->fBuffer;
- src->bytes_in_buffer = 0;
- return true;
-}
-#endif
-
-static boolean sk_fill_input_buffer(j_decompress_ptr cinfo) {
- skjpeg_source_mgr* src = (skjpeg_source_mgr*)cinfo->src;
- if (src->fDecoder != nullptr && src->fDecoder->shouldCancelDecode()) {
- return FALSE;
- }
- size_t bytes = src->fStream->read(src->fBuffer, skjpeg_source_mgr::kBufferSize);
- // note that JPEG is happy with less than the full read,
- // as long as the result is non-zero
- if (bytes == 0) {
- return FALSE;
- }
-
-#ifdef SK_JPEG_INDEX_SUPPORTED
- src->current_offset += bytes;
-#endif
- src->next_input_byte = (const JOCTET*)src->fBuffer;
- src->bytes_in_buffer = bytes;
- return TRUE;
-}
-
-static void sk_skip_input_data(j_decompress_ptr cinfo, long num_bytes) {
- skjpeg_source_mgr* src = (skjpeg_source_mgr*)cinfo->src;
-
- if (num_bytes > (long)src->bytes_in_buffer) {
- size_t bytesToSkip = num_bytes - src->bytes_in_buffer;
- while (bytesToSkip > 0) {
- size_t bytes = src->fStream->skip(bytesToSkip);
- if (bytes <= 0 || bytes > bytesToSkip) {
-// SkDebugf("xxxxxxxxxxxxxx failure to skip request %d returned %d\n", bytesToSkip, bytes);
- cinfo->err->error_exit((j_common_ptr)cinfo);
- return;
- }
-#ifdef SK_JPEG_INDEX_SUPPORTED
- src->current_offset += bytes;
-#endif
- bytesToSkip -= bytes;
- }
- src->next_input_byte = (const JOCTET*)src->fBuffer;
- src->bytes_in_buffer = 0;
- } else {
- src->next_input_byte += num_bytes;
- src->bytes_in_buffer -= num_bytes;
- }
-}
-
-static void sk_term_source(j_decompress_ptr /*cinfo*/) {}
-
-
-///////////////////////////////////////////////////////////////////////////////
-
-skjpeg_source_mgr::skjpeg_source_mgr(SkStream* stream, SkImageDecoder* decoder)
- : fStream(stream)
- , fDecoder(decoder) {
-
- init_source = sk_init_source;
- fill_input_buffer = sk_fill_input_buffer;
- skip_input_data = sk_skip_input_data;
- resync_to_restart = jpeg_resync_to_restart;
- term_source = sk_term_source;
-#ifdef SK_JPEG_INDEX_SUPPORTED
- seek_input_data = sk_seek_input_data;
-#endif
-// SkDebugf("**************** use memorybase %p %d\n", fMemoryBase, fMemoryBaseSize);
-}
-
///////////////////////////////////////////////////////////////////////////////
static void sk_init_destination(j_compress_ptr cinfo) {
« no previous file with comments | « src/images/SkJpegUtility.h ('k') | src/images/SkScaledBitmapSampler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698