| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/gfx/size.h" | 6 #include "base/gfx/size.h" |
| 7 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
| 8 | 8 |
| 9 class SkBitmap; | 9 class SkBitmap; |
| 10 | 10 |
| 11 namespace webkit_glue { | 11 namespace webkit_glue { |
| 12 | 12 |
| 13 // Provides an interface to WebKit's image decoders. | 13 // Provides an interface to WebKit's image decoders. |
| 14 // | 14 // |
| 15 // Note to future: This class should be deleted. We should have our own nice | 15 // Note to future: This class should be deleted. We should have our own nice |
| 16 // image decoders in base/gfx, and our port should use those. Currently, it's | 16 // image decoders in base/gfx, and our port should use those. Currently, it's |
| 17 // the other way around. | 17 // the other way around. |
| 18 class ImageDecoder { | 18 class ImageDecoder { |
| 19 public: | 19 public: |
| 20 // Use the constructor with desired_size when you think you may have an .ico | 20 // Use the constructor with desired_size when you think you may have an .ico |
| 21 // format and care about which size you get back. Otherwise, use the 0-arg | 21 // format and care about which size you get back. Otherwise, use the 0-arg |
| 22 // constructor. | 22 // constructor. |
| 23 ImageDecoder(); | 23 ImageDecoder(); |
| 24 ImageDecoder(const gfx::Size& desired_icon_size); | 24 ImageDecoder(const gfx::Size& desired_icon_size); |
| 25 ~ImageDecoder(); | 25 ~ImageDecoder(); |
| 26 | 26 |
| 27 // Call this function to decode the image. If successful, the decoded image | 27 // Call this function to decode the image. If successful, the decoded image |
| 28 // will be returned. Otherwise, an empty bitmap will be returned. | 28 // will be returned. Otherwise, an empty bitmap will be returned. |
| 29 SkBitmap Decode(const unsigned char* data, size_t size); | 29 SkBitmap Decode(const unsigned char* data, size_t size) const; |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 // Size will be empty to get the largest possible size. | 32 // Size will be empty to get the largest possible size. |
| 33 gfx::Size desired_icon_size_; | 33 gfx::Size desired_icon_size_; |
| 34 | 34 |
| 35 DISALLOW_EVIL_CONSTRUCTORS(ImageDecoder); | 35 DISALLOW_EVIL_CONSTRUCTORS(ImageDecoder); |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 } // namespace webkit_glue | 38 } // namespace webkit_glue |
| 39 | 39 |
| OLD | NEW |