| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/gfx/codec/png_codec.h" | 5 #include "ui/gfx/codec/png_codec.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "ui/gfx/size.h" | 10 #include "ui/gfx/size.h" |
| 11 #include "ui/gfx/skia_util.h" | 11 #include "ui/gfx/skia_util.h" |
| 12 #include "third_party/libpng/png.h" |
| 12 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
| 13 #include "third_party/skia/include/core/SkUnPreMultiply.h" | 14 #include "third_party/skia/include/core/SkUnPreMultiply.h" |
| 14 #include "third_party/skia/include/core/SkColorPriv.h" | 15 #include "third_party/skia/include/core/SkColorPriv.h" |
| 15 | |
| 16 extern "C" { | |
| 17 #include "third_party/libpng/png.h" | |
| 18 | |
| 19 #if defined(USE_SYSTEM_ZLIB) | |
| 20 #include <zlib.h> | |
| 21 #else | |
| 22 #include "third_party/zlib/zlib.h" | 16 #include "third_party/zlib/zlib.h" |
| 23 #endif | |
| 24 } | |
| 25 | 17 |
| 26 namespace gfx { | 18 namespace gfx { |
| 27 | 19 |
| 28 namespace { | 20 namespace { |
| 29 | 21 |
| 30 // Converts BGRA->RGBA and RGBA->BGRA. | 22 // Converts BGRA->RGBA and RGBA->BGRA. |
| 31 void ConvertBetweenBGRAandRGBA(const unsigned char* input, int pixel_width, | 23 void ConvertBetweenBGRAandRGBA(const unsigned char* input, int pixel_width, |
| 32 unsigned char* output, bool* is_opaque) { | 24 unsigned char* output, bool* is_opaque) { |
| 33 for (int x = 0; x < pixel_width; x++) { | 25 for (int x = 0; x < pixel_width; x++) { |
| 34 const unsigned char* pixel_in = &input[x * 4]; | 26 const unsigned char* pixel_in = &input[x * 4]; |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 } | 771 } |
| 780 | 772 |
| 781 PNGCodec::Comment::Comment(const std::string& k, const std::string& t) | 773 PNGCodec::Comment::Comment(const std::string& k, const std::string& t) |
| 782 : key(k), text(t) { | 774 : key(k), text(t) { |
| 783 } | 775 } |
| 784 | 776 |
| 785 PNGCodec::Comment::~Comment() { | 777 PNGCodec::Comment::~Comment() { |
| 786 } | 778 } |
| 787 | 779 |
| 788 } // namespace gfx | 780 } // namespace gfx |
| OLD | NEW |