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

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

Issue 1879443002: JPEG decoding: replace ownership comments with std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fixes 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 | « printing/emf_win.cc ('k') | ui/gfx/codec/jpeg_codec.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 #ifndef UI_GFX_CODEC_JPEG_CODEC_H_ 5 #ifndef UI_GFX_CODEC_JPEG_CODEC_H_
6 #define UI_GFX_CODEC_JPEG_CODEC_H_ 6 #define UI_GFX_CODEC_JPEG_CODEC_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9
10 #include <memory>
9 #include <vector> 11 #include <vector>
10 12
11 #include "ui/gfx/gfx_export.h" 13 #include "ui/gfx/gfx_export.h"
12 14
13 class SkBitmap; 15 class SkBitmap;
14 16
15 namespace gfx { 17 namespace gfx {
16 18
17 // Interface for encoding/decoding JPEG data. This is a wrapper around libjpeg, 19 // Interface for encoding/decoding JPEG data. This is a wrapper around libjpeg,
18 // which has an inconvenient interface for callers. This is only used for UI 20 // which has an inconvenient interface for callers. This is only used for UI
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 64
63 // Decodes the JPEG data contained in input of length input_size. The 65 // Decodes the JPEG data contained in input of length input_size. The
64 // decoded data will be placed in *output with the dimensions in *w and *h 66 // decoded data will be placed in *output with the dimensions in *w and *h
65 // on success (returns true). This data will be written in the'format' 67 // on success (returns true). This data will be written in the'format'
66 // format. On failure, the values of these output variables is undefined. 68 // format. On failure, the values of these output variables is undefined.
67 static bool Decode(const unsigned char* input, size_t input_size, 69 static bool Decode(const unsigned char* input, size_t input_size,
68 ColorFormat format, std::vector<unsigned char>* output, 70 ColorFormat format, std::vector<unsigned char>* output,
69 int* w, int* h); 71 int* w, int* h);
70 72
71 // Decodes the JPEG data contained in input of length input_size. If 73 // Decodes the JPEG data contained in input of length input_size. If
72 // successful, a SkBitmap is created and returned. It is up to the caller 74 // successful, a SkBitmap is created and returned.
73 // to delete the returned bitmap. 75 static std::unique_ptr<SkBitmap> Decode(const unsigned char* input,
74 static SkBitmap* Decode(const unsigned char* input, size_t input_size); 76 size_t input_size);
75 }; 77 };
76 78
77 } // namespace gfx 79 } // namespace gfx
78 80
79 #endif // UI_GFX_CODEC_JPEG_CODEC_H_ 81 #endif // UI_GFX_CODEC_JPEG_CODEC_H_
OLDNEW
« no previous file with comments | « printing/emf_win.cc ('k') | ui/gfx/codec/jpeg_codec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698