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

Side by Side Diff: printing/image.cc

Issue 2812263002: clean up printing::Image and printing::Metafile (Closed)
Patch Set: return Created 3 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
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 "printing/image.h" 5 #include "printing/image.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/md5.h" 12 #include "base/md5.h"
13 #include "base/numerics/safe_conversions.h" 13 #include "base/numerics/safe_conversions.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "printing/metafile.h" 15 #include "printing/metafile.h"
16 #include "third_party/skia/include/core/SkColor.h" 16 #include "third_party/skia/include/core/SkColor.h"
17 #include "ui/gfx/codec/png_codec.h" 17 #include "ui/gfx/codec/png_codec.h"
18 18
19 namespace printing { 19 namespace printing {
20 20
21 Image::Image(const Metafile& metafile) 21 Image::Image(const void* metafile_src_buffer, size_t metafile_src_buffer_size)
22 : row_length_(0), 22 : row_length_(0), ignore_alpha_(true) {
23 ignore_alpha_(true) { 23 LoadMetafile(metafile_src_buffer, metafile_src_buffer_size);
24 LoadMetafile(metafile);
25 } 24 }
26 25
27 Image::Image(const Image& image) 26 Image::Image(const Image& image)
28 : size_(image.size_), 27 : size_(image.size_),
29 row_length_(image.row_length_), 28 row_length_(image.row_length_),
30 data_(image.data_), 29 data_(image.data_),
31 ignore_alpha_(image.ignore_alpha_) { 30 ignore_alpha_(image.ignore_alpha_) {
32 } 31 }
33 32
34 Image::~Image() {} 33 Image::~Image() {}
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 int h; 122 int h;
124 bool success = gfx::PNGCodec::Decode( 123 bool success = gfx::PNGCodec::Decode(
125 reinterpret_cast<const unsigned char*>(compressed.c_str()), 124 reinterpret_cast<const unsigned char*>(compressed.c_str()),
126 compressed.size(), gfx::PNGCodec::FORMAT_BGRA, &data_, &w, &h); 125 compressed.size(), gfx::PNGCodec::FORMAT_BGRA, &data_, &w, &h);
127 size_.SetSize(w, h); 126 size_.SetSize(w, h);
128 row_length_ = size_.width() * sizeof(uint32_t); 127 row_length_ = size_.width() * sizeof(uint32_t);
129 return success; 128 return success;
130 } 129 }
131 130
132 } // namespace printing 131 } // namespace printing
OLDNEW
« printing/image.h ('K') | « printing/image.h ('k') | printing/image_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698