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

Side by Side Diff: ui/gfx/codec/jpeg_codec.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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 | « ui/gfx/chromeos/codec/jpeg_codec_robust_slow.cc ('k') | ui/gfx/color_analysis.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/codec/jpeg_codec.h" 5 #include "ui/gfx/codec/jpeg_codec.h"
6 6
7 #include <setjmp.h> 7 #include <setjmp.h>
8 8
9 #include <memory>
10
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
12 #include "third_party/skia/include/core/SkColorPriv.h" 13 #include "third_party/skia/include/core/SkColorPriv.h"
13 14
14 extern "C" { 15 extern "C" {
15 #if defined(USE_SYSTEM_LIBJPEG) 16 #if defined(USE_SYSTEM_LIBJPEG)
16 #include <jpeglib.h> 17 #include <jpeglib.h>
17 #elif defined(USE_LIBJPEG_TURBO) 18 #elif defined(USE_LIBJPEG_TURBO)
18 #include "third_party/libjpeg_turbo/jpeglib.h" 19 #include "third_party/libjpeg_turbo/jpeglib.h"
19 #else 20 #else
20 #include "third_party/libjpeg/jpeglib.h" 21 #include "third_party/libjpeg/jpeglib.h"
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 row_write_stride = cinfo.output_width * 4; 581 row_write_stride = cinfo.output_width * 4;
581 converter = RGBtoBGRA; 582 converter = RGBtoBGRA;
582 } else { 583 } else {
583 NOTREACHED() << "Invalid pixel format"; 584 NOTREACHED() << "Invalid pixel format";
584 jpeg_destroy_decompress(&cinfo); 585 jpeg_destroy_decompress(&cinfo);
585 return false; 586 return false;
586 } 587 }
587 588
588 output->resize(row_write_stride * cinfo.output_height); 589 output->resize(row_write_stride * cinfo.output_height);
589 590
590 scoped_ptr<unsigned char[]> row_data(new unsigned char[row_read_stride]); 591 std::unique_ptr<unsigned char[]> row_data(
592 new unsigned char[row_read_stride]);
591 unsigned char* rowptr = row_data.get(); 593 unsigned char* rowptr = row_data.get();
592 for (int row = 0; row < static_cast<int>(cinfo.output_height); row++) { 594 for (int row = 0; row < static_cast<int>(cinfo.output_height); row++) {
593 if (!jpeg_read_scanlines(&cinfo, &rowptr, 1)) 595 if (!jpeg_read_scanlines(&cinfo, &rowptr, 1))
594 return false; 596 return false;
595 converter(rowptr, *w, &(*output)[row * row_write_stride]); 597 converter(rowptr, *w, &(*output)[row * row_write_stride]);
596 } 598 }
597 } 599 }
598 #endif 600 #endif
599 601
600 jpeg_finish_decompress(&cinfo); 602 jpeg_finish_decompress(&cinfo);
(...skipping 13 matching lines...) Expand all
614 int data_length = w * h * 4; 616 int data_length = w * h * 4;
615 617
616 std::unique_ptr<SkBitmap> bitmap(new SkBitmap()); 618 std::unique_ptr<SkBitmap> bitmap(new SkBitmap());
617 bitmap->allocN32Pixels(w, h); 619 bitmap->allocN32Pixels(w, h);
618 memcpy(bitmap->getAddr32(0, 0), &data_vector[0], data_length); 620 memcpy(bitmap->getAddr32(0, 0), &data_vector[0], data_length);
619 621
620 return bitmap; 622 return bitmap;
621 } 623 }
622 624
623 } // namespace gfx 625 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/chromeos/codec/jpeg_codec_robust_slow.cc ('k') | ui/gfx/color_analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698