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

Side by Side Diff: printing/image.cc

Issue 516833002: Removed NativeMetafile and PreviewMetafile typedef as it's always PdfMetafileSkia. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_pdf
Patch Set: Thu Aug 28 17:07:38 PDT 2014 Created 6 years, 3 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/BUILD.gn ('k') | printing/metafile_impl.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 // 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/md5.h" 10 #include "base/md5.h"
11 #include "base/numerics/safe_conversions.h" 11 #include "base/numerics/safe_conversions.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "printing/metafile.h" 13 #include "printing/metafile.h"
14 #include "printing/metafile_impl.h" 14 #include "printing/pdf_metafile_skia.h"
15 #include "third_party/skia/include/core/SkColor.h" 15 #include "third_party/skia/include/core/SkColor.h"
16 #include "ui/gfx/codec/png_codec.h" 16 #include "ui/gfx/codec/png_codec.h"
17 17
18 namespace printing { 18 namespace printing {
19 19
20 Image::Image(const base::FilePath& path) 20 Image::Image(const base::FilePath& path)
21 : row_length_(0), 21 : row_length_(0),
22 ignore_alpha_(true) { 22 ignore_alpha_(true) {
23 std::string data; 23 std::string data;
24 base::ReadFileToString(path, &data); 24 base::ReadFileToString(path, &data);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 bool success = gfx::PNGCodec::Decode( 143 bool success = gfx::PNGCodec::Decode(
144 reinterpret_cast<const unsigned char*>(compressed.c_str()), 144 reinterpret_cast<const unsigned char*>(compressed.c_str()),
145 compressed.size(), gfx::PNGCodec::FORMAT_BGRA, &data_, &w, &h); 145 compressed.size(), gfx::PNGCodec::FORMAT_BGRA, &data_, &w, &h);
146 size_.SetSize(w, h); 146 size_.SetSize(w, h);
147 row_length_ = size_.width() * sizeof(uint32); 147 row_length_ = size_.width() * sizeof(uint32);
148 return success; 148 return success;
149 } 149 }
150 150
151 bool Image::LoadMetafile(const std::string& data) { 151 bool Image::LoadMetafile(const std::string& data) {
152 DCHECK(!data.empty()); 152 DCHECK(!data.empty());
153 NativeMetafile metafile; 153 PdfMetafileSkia metafile;
154 if (!metafile.InitFromData(data.data(), 154 if (!metafile.InitFromData(data.data(),
155 base::checked_cast<uint32>(data.size()))) 155 base::checked_cast<uint32>(data.size())))
156 return false; 156 return false;
157 return LoadMetafile(metafile); 157 return LoadMetafile(metafile);
158 } 158 }
159 159
160 } // namespace printing 160 } // namespace printing
OLDNEW
« no previous file with comments | « printing/BUILD.gn ('k') | printing/metafile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698