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

Side by Side Diff: src/codec/SkJpegCodec.cpp

Issue 1674913002: Use size_t for get_row_bytes() in SkJpegCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkCodec.h" 8 #include "SkCodec.h"
9 #include "SkJpegCodec.h" 9 #include "SkJpegCodec.h"
10 #include "SkJpegDecoderMgr.h" 10 #include "SkJpegDecoderMgr.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 SkJpegCodec::SkJpegCodec(const SkImageInfo& srcInfo, SkStream* stream, 77 SkJpegCodec::SkJpegCodec(const SkImageInfo& srcInfo, SkStream* stream,
78 JpegDecoderMgr* decoderMgr) 78 JpegDecoderMgr* decoderMgr)
79 : INHERITED(srcInfo, stream) 79 : INHERITED(srcInfo, stream)
80 , fDecoderMgr(decoderMgr) 80 , fDecoderMgr(decoderMgr)
81 , fReadyState(decoderMgr->dinfo()->global_state) 81 , fReadyState(decoderMgr->dinfo()->global_state)
82 {} 82 {}
83 83
84 /* 84 /*
85 * Return the row bytes of a particular image type and width 85 * Return the row bytes of a particular image type and width
86 */ 86 */
87 static int get_row_bytes(const j_decompress_ptr dinfo) { 87 static size_t get_row_bytes(const j_decompress_ptr dinfo) {
88 int colorBytes = (dinfo->out_color_space == JCS_RGB565) ? 2 : dinfo->out_col or_components; 88 size_t colorBytes = (dinfo->out_color_space == JCS_RGB565) ? 2 : dinfo->out_ color_components;
89 return dinfo->output_width * colorBytes; 89 return dinfo->output_width * colorBytes;
90 90
91 } 91 }
92 92
93 /* 93 /*
94 * Calculate output dimensions based on the provided factors. 94 * Calculate output dimensions based on the provided factors.
95 * 95 *
96 * Not to be used on the actual jpeg_decompress_struct used for decoding, since it will 96 * Not to be used on the actual jpeg_decompress_struct used for decoding, since it will
97 * incorrectly modify num_components. 97 * incorrectly modify num_components.
98 */ 98 */
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 641
642 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); 642 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock);
643 if (linesRead < remainingRows) { 643 if (linesRead < remainingRows) {
644 // FIXME: Handle incomplete YUV decodes without signalling an error. 644 // FIXME: Handle incomplete YUV decodes without signalling an error.
645 return kInvalidInput; 645 return kInvalidInput;
646 } 646 }
647 } 647 }
648 648
649 return kSuccess; 649 return kSuccess;
650 } 650 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698