Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 int w; | 143 int w; |
| 144 int h; | 144 int h; |
| 145 bool success = gfx::PNGCodec::Decode( | 145 bool success = gfx::PNGCodec::Decode( |
| 146 reinterpret_cast<const unsigned char*>(compressed.c_str()), | 146 reinterpret_cast<const unsigned char*>(compressed.c_str()), |
| 147 compressed.size(), gfx::PNGCodec::FORMAT_BGRA, &data_, &w, &h); | 147 compressed.size(), gfx::PNGCodec::FORMAT_BGRA, &data_, &w, &h); |
| 148 size_.SetSize(w, h); | 148 size_.SetSize(w, h); |
| 149 row_length_ = size_.width() * sizeof(uint32_t); | 149 row_length_ = size_.width() * sizeof(uint32_t); |
| 150 return success; | 150 return success; |
| 151 } | 151 } |
| 152 | 152 |
| 153 bool Image::LoadMetafile(const std::string& data) { | 153 bool Image::LoadMetafile(const std::string& data) { |
|
Lei Zhang
2016/06/14 18:02:19
Looks like this is gone now with r399738 landed.
| |
| 154 DCHECK(!data.empty()); | 154 DCHECK(!data.empty()); |
| 155 PdfMetafileSkia metafile; | 155 PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE); |
| 156 if (!metafile.InitFromData(data.data(), | 156 if (!metafile.InitFromData(data.data(), |
| 157 base::checked_cast<uint32_t>(data.size()))) | 157 base::checked_cast<uint32_t>(data.size()))) |
| 158 return false; | 158 return false; |
| 159 return LoadMetafile(metafile); | 159 return LoadMetafile(metafile); |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace printing | 162 } // namespace printing |
| OLD | NEW |