summaryrefslogtreecommitdiffstats
path: root/printing/image.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-03 03:12:20 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-03 03:12:20 +0000
commit468fec96cd171682405d30b266f71f1766396a07 (patch)
treee3dc28717fa79c7149303d1c9ec6bb8437edfbcc /printing/image.cc
parentdb1faced81ea15604ca67135c5597d35269ff84a (diff)
downloadchromium_src-468fec96cd171682405d30b266f71f1766396a07.zip
chromium_src-468fec96cd171682405d30b266f71f1766396a07.tar.gz
chromium_src-468fec96cd171682405d30b266f71f1766396a07.tar.bz2
Move the JPEG and PNG codecs from base/gfx to app/gfx/codec. Move the classes
into the gfx namespace. Combine the PNGEncoder and PNGDecoder. There were separate when we had different executables for the browser and renderer, and linked the encoder only in one of them (which saved us some space used by libpng). This hasn't been the case for years, so combining them (again) makes sense. TEST=none BUG=none Review URL: http://codereview.chromium.org/243076 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27930 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/image.cc')
-rw-r--r--printing/image.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/printing/image.cc b/printing/image.cc
index 667adae..b9c86dd 100644
--- a/printing/image.cc
+++ b/printing/image.cc
@@ -1,12 +1,11 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "printing/image.h"
+#include "app/gfx/codec/png_codec.h"
#include "base/file_util.h"
-#include "base/gfx/png_decoder.h"
-#include "base/gfx/png_encoder.h"
#include "base/gfx/rect.h"
#include "base/md5.h"
#include "base/string_util.h"
@@ -101,13 +100,13 @@ std::string Image::checksum() const {
bool Image::SaveToPng(const std::wstring& filename) const {
DCHECK(!data_.empty());
std::vector<unsigned char> compressed;
- bool success = PNGEncoder::Encode(&*data_.begin(),
- PNGEncoder::FORMAT_BGRA,
- size_.width(),
- size_.height(),
- row_length_,
- true,
- &compressed);
+ bool success = gfx::PNGCodec::Encode(&*data_.begin(),
+ gfx::PNGCodec::FORMAT_BGRA,
+ size_.width(),
+ size_.height(),
+ row_length_,
+ true,
+ &compressed);
DCHECK(success && compressed.size());
if (success) {
int write_bytes = file_util::WriteFile(
@@ -179,9 +178,9 @@ double Image::PercentageDifferent(const Image& rhs) const {
bool Image::LoadPng(const std::string& compressed) {
int w;
int h;
- bool success = PNGDecoder::Decode(
+ bool success = gfx::PNGCodec::Decode(
reinterpret_cast<const unsigned char*>(compressed.c_str()),
- compressed.size(), PNGDecoder::FORMAT_BGRA, &data_, &w, &h);
+ compressed.size(), gfx::PNGCodec::FORMAT_BGRA, &data_, &w, &h);
size_.SetSize(w, h);
row_length_ = size_.width() * sizeof(uint32);
return success;