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

Unified Diff: src/codec/SkJpegUtility_codec.cpp

Issue 1836493002: Rename encoders to Sk*ImageEncoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/codec/SkJpegUtility_codec.h ('k') | src/images/SkARGBImageEncoder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkJpegUtility_codec.cpp
diff --git a/src/codec/SkJpegUtility_codec.cpp b/src/codec/SkJpegUtility_codec.cpp
deleted file mode 100644
index 19ece5e6adf9387b1750ee91789c4f67584bf1cb..0000000000000000000000000000000000000000
--- a/src/codec/SkJpegUtility_codec.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkCodecPriv.h"
-#include "SkJpegUtility_codec.h"
-
-/*
- * Initialize the source manager
- */
-static void sk_init_source(j_decompress_ptr dinfo) {
- skjpeg_source_mgr* src = (skjpeg_source_mgr*) dinfo->src;
- src->next_input_byte = (const JOCTET*) src->fBuffer;
- src->bytes_in_buffer = 0;
-}
-
-/*
- * Fill the input buffer from the stream
- */
-static boolean sk_fill_input_buffer(j_decompress_ptr dinfo) {
- skjpeg_source_mgr* src = (skjpeg_source_mgr*) dinfo->src;
- size_t bytes = src->fStream->read(src->fBuffer, skjpeg_source_mgr::kBufferSize);
-
- // libjpeg is still happy with a less than full read, as long as the result is non-zero
- if (bytes == 0) {
- return false;
- }
-
- src->next_input_byte = (const JOCTET*) src->fBuffer;
- src->bytes_in_buffer = bytes;
- return true;
-}
-
-/*
- * Skip a certain number of bytes in the stream
- */
-static void sk_skip_input_data(j_decompress_ptr dinfo, long numBytes) {
- skjpeg_source_mgr* src = (skjpeg_source_mgr*) dinfo->src;
- size_t bytes = (size_t) numBytes;
-
- if (bytes > src->bytes_in_buffer) {
- size_t bytesToSkip = bytes - src->bytes_in_buffer;
- if (bytesToSkip != src->fStream->skip(bytesToSkip)) {
- SkCodecPrintf("Failure to skip.\n");
- dinfo->err->error_exit((j_common_ptr) dinfo);
- return;
- }
-
- src->next_input_byte = (const JOCTET*) src->fBuffer;
- src->bytes_in_buffer = 0;
- } else {
- src->next_input_byte += numBytes;
- src->bytes_in_buffer -= numBytes;
- }
-}
-
-/*
- * We do not need to do anything to terminate our stream
- */
-static void sk_term_source(j_decompress_ptr dinfo)
-{
- // The current implementation of SkJpegCodec does not call
- // jpeg_finish_decompress(), so this function is never called.
- // If we want to modify this function to do something, we also
- // need to modify SkJpegCodec to call jpeg_finish_decompress().
-}
-
-/*
- * Constructor for the source manager that we provide to libjpeg
- * We provide skia implementations of all of the stream processing functions required by libjpeg
- */
-skjpeg_source_mgr::skjpeg_source_mgr(SkStream* stream)
- : fStream(stream)
-{
- 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;
-}
-
-/*
- * Call longjmp to continue execution on an error
- */
-void skjpeg_err_exit(j_common_ptr dinfo) {
- // Simply return to Skia client code
- // JpegDecoderMgr will take care of freeing memory
- skjpeg_error_mgr* error = (skjpeg_error_mgr*) dinfo->err;
- (*error->output_message) (dinfo);
- longjmp(error->fJmpBuf, 1);
-}
« no previous file with comments | « src/codec/SkJpegUtility_codec.h ('k') | src/images/SkARGBImageEncoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698