diff options
Diffstat (limited to 'printing')
-rw-r--r-- | printing/image.cc | 9 | ||||
-rw-r--r-- | printing/image.h | 7 |
2 files changed, 8 insertions, 8 deletions
diff --git a/printing/image.cc b/printing/image.cc index d12d3d60..77f5d5e 100644 --- a/printing/image.cc +++ b/printing/image.cc @@ -60,16 +60,15 @@ class DisableFontSmoothing { namespace printing { -Image::Image(const std::wstring& filename) +Image::Image(const FilePath& path) : row_length_(0), ignore_alpha_(true) { std::string data; - file_util::ReadFileToString(filename, &data); - std::wstring ext = file_util::GetFileExtensionFromPath(filename); + file_util::ReadFileToString(path, &data); bool success = false; - if (LowerCaseEqualsASCII(ext, "png")) { + if (path.MatchesExtension(FILE_PATH_LITERAL(".png"))) { success = LoadPng(data); - } else if (LowerCaseEqualsASCII(ext, "emf")) { + } else if (path.MatchesExtension(FILE_PATH_LITERAL(".emf"))) { success = LoadMetafile(data); } else { DCHECK(false); diff --git a/printing/image.h b/printing/image.h index ed2820b..5f4746d 100644 --- a/printing/image.h +++ b/printing/image.h @@ -9,21 +9,22 @@ #include <vector> #include "base/basictypes.h" -#include "base/file_path.h" #include "base/logging.h" #include "gfx/size.h" #include "printing/native_metafile.h" +class FilePath; + namespace printing { // Lightweight raw-bitmap management. The image, once initialized, is immutable. // The main purpose is testing image contents. class Image { public: - // Creates the image from the given filename on disk. Uses extension to + // Creates the image from the given file on disk. Uses extension to // defer file type. PNG and EMF (on Windows) currently supported. // If image loading fails size().IsEmpty() will be true. - explicit Image(const std::wstring& filename); + explicit Image(const FilePath& path); // Creates the image from the metafile. Deduces bounds based on bounds in // metafile. If loading fails size().IsEmpty() will be true. |