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

Side by Side Diff: src/images/SkImageDecoder_libjpeg.cpp

Issue 1673663002: flags and hacks to get MSAN bot going (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: relax assert 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 | « src/codec/SkJpegCodec.cpp ('k') | src/opts/SkXfermode_opts.h » ('j') | 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 2007 The Android Open Source Project 2 * Copyright 2007 The Android Open Source Project
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 8
9 #include "SkImageDecoder.h" 9 #include "SkImageDecoder.h"
10 #include "SkImageEncoder.h" 10 #include "SkImageEncoder.h"
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 502
503 // Possibly skip initial rows [sampler.srcY0] 503 // Possibly skip initial rows [sampler.srcY0]
504 if (!skip_src_rows(&cinfo, srcRow, sampler.srcY0())) { 504 if (!skip_src_rows(&cinfo, srcRow, sampler.srcY0())) {
505 return return_failure(cinfo, *bm, "skip rows"); 505 return return_failure(cinfo, *bm, "skip rows");
506 } 506 }
507 507
508 // now loop through scanlines until y == bm->height() - 1 508 // now loop through scanlines until y == bm->height() - 1
509 for (int y = 0;; y++) { 509 for (int y = 0;; y++) {
510 JSAMPLE* rowptr = (JSAMPLE*)srcRow; 510 JSAMPLE* rowptr = (JSAMPLE*)srcRow;
511 int row_count = jpeg_read_scanlines(&cinfo, &rowptr, 1); 511 int row_count = jpeg_read_scanlines(&cinfo, &rowptr, 1);
512 sk_msan_mark_initialized(srcRow, srcRow + cinfo.output_width * srcBytesP erPixel,
513 "skbug.com/4550");
512 if (0 == row_count) { 514 if (0 == row_count) {
513 // if row_count == 0, then we didn't get a scanline, 515 // if row_count == 0, then we didn't get a scanline,
514 // so return early. We will return a partial image. 516 // so return early. We will return a partial image.
515 fill_below_level(y, bm); 517 fill_below_level(y, bm);
516 cinfo.output_scanline = cinfo.output_height; 518 cinfo.output_scanline = cinfo.output_height;
517 jpeg_finish_decompress(&cinfo); 519 jpeg_finish_decompress(&cinfo);
518 return kPartialSuccess; 520 return kPartialSuccess;
519 } 521 }
520 if (this->shouldCancelDecode()) { 522 if (this->shouldCancelDecode()) {
521 return return_failure(cinfo, *bm, "shouldCancelDecode"); 523 return return_failure(cinfo, *bm, "shouldCancelDecode");
522 } 524 }
523 525
524 if (JCS_CMYK == cinfo.out_color_space) { 526 if (JCS_CMYK == cinfo.out_color_space) {
525 convert_CMYK_to_RGB(srcRow, cinfo.output_width); 527 convert_CMYK_to_RGB(srcRow, cinfo.output_width);
526 } 528 }
527 529
528 sk_msan_mark_initialized(srcRow, srcRow + cinfo.output_width * srcBytesP erPixel,
529 "skbug.com/4550");
530 530
531 sampler.next(srcRow); 531 sampler.next(srcRow);
532 if (bm->height() - 1 == y) { 532 if (bm->height() - 1 == y) {
533 // we're done 533 // we're done
534 break; 534 break;
535 } 535 }
536 536
537 if (!skip_src_rows(&cinfo, srcRow, sampler.srcDY() - 1)) { 537 if (!skip_src_rows(&cinfo, srcRow, sampler.srcDY() - 1)) {
538 return return_failure(cinfo, *bm, "skip rows"); 538 return return_failure(cinfo, *bm, "skip rows");
539 } 539 }
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 return SkImageDecoder::kUnknown_Format; 1028 return SkImageDecoder::kUnknown_Format;
1029 } 1029 }
1030 1030
1031 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { 1031 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) {
1032 return (SkImageEncoder::kJPEG_Type == t) ? new SkJPEGImageEncoder : nullptr; 1032 return (SkImageEncoder::kJPEG_Type == t) ? new SkJPEGImageEncoder : nullptr;
1033 } 1033 }
1034 1034
1035 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory); 1035 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory);
1036 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg); 1036 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg);
1037 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory); 1037 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory);
OLDNEW
« no previous file with comments | « src/codec/SkJpegCodec.cpp ('k') | src/opts/SkXfermode_opts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698