| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/md5.h" | 8 #include "base/md5.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "gfx/codec/png_codec.h" | |
| 11 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| 11 #include "ui/gfx/codec/png_codec.h" |
| 12 | 12 |
| 13 namespace printing { | 13 namespace printing { |
| 14 | 14 |
| 15 Image::Image(const FilePath& path) | 15 Image::Image(const FilePath& path) |
| 16 : row_length_(0), | 16 : row_length_(0), |
| 17 ignore_alpha_(true) { | 17 ignore_alpha_(true) { |
| 18 std::string data; | 18 std::string data; |
| 19 file_util::ReadFileToString(path, &data); | 19 file_util::ReadFileToString(path, &data); |
| 20 bool success = false; | 20 bool success = false; |
| 21 if (path.MatchesExtension(FILE_PATH_LITERAL(".png"))) { | 21 if (path.MatchesExtension(FILE_PATH_LITERAL(".png"))) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool Image::LoadMetafile(const std::string& data) { | 145 bool Image::LoadMetafile(const std::string& data) { |
| 146 DCHECK(!data.empty()); | 146 DCHECK(!data.empty()); |
| 147 NativeMetafile metafile; | 147 NativeMetafile metafile; |
| 148 metafile.Init(data.data(), data.size()); | 148 metafile.Init(data.data(), data.size()); |
| 149 return LoadMetafile(metafile); | 149 return LoadMetafile(metafile); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace printing | 152 } // namespace printing |
| OLD | NEW |