diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-12 19:35:41 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-12 19:35:41 +0000 |
commit | b0f93406e485bd605c323e9d386fae0e6b86d50c (patch) | |
tree | 4b583c03c77a00a6db050779b4234f8f895d723e /skia | |
parent | 04f3b3a84c1ce914cf468e895cde685470775b49 (diff) | |
download | chromium_src-b0f93406e485bd605c323e9d386fae0e6b86d50c.zip chromium_src-b0f93406e485bd605c323e9d386fae0e6b86d50c.tar.gz chromium_src-b0f93406e485bd605c323e9d386fae0e6b86d50c.tar.bz2 |
Remove WebCore usage from vector_canvas_unittest.cc
R=maruel
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/916001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41460 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ext/vector_canvas_unittest.cc | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/skia/ext/vector_canvas_unittest.cc b/skia/ext/vector_canvas_unittest.cc index 11c6f41..e0a8263 100644 --- a/skia/ext/vector_canvas_unittest.cc +++ b/skia/ext/vector_canvas_unittest.cc @@ -2,17 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "config.h" #include "build/build_config.h" -#include "webkit/tools/test_shell/image_decoder_unittest.h" - #if !defined(OS_WIN) #include <unistd.h> #endif -#include "PNGImageDecoder.h" - #include "app/gfx/codec/png_codec.h" #include "base/command_line.h" #include "base/file_util.h" @@ -86,14 +81,15 @@ class Image { public: // Creates the image from the given filename on disk. explicit Image(const FilePath& filename) : ignore_alpha_(true) { - Vector<char> compressed; - ReadFileToVector(filename, &compressed); + std::string compressed; + file_util::ReadFileToString(filename, &compressed); EXPECT_TRUE(compressed.size()); - WebCore::PNGImageDecoder decoder; - decoder.setData(WebCore::SharedBuffer::adoptVector(compressed).get(), true); - scoped_ptr<NativeImageSkia> image_data( - decoder.frameBufferAtIndex(0)->asNewNativeImage()); - SetSkBitmap(*image_data); + + SkBitmap bitmap; + EXPECT_TRUE(gfx::PNGCodec::Decode( + reinterpret_cast<const unsigned char*>(compressed.data()), + compressed.size(), &bitmap)); + SetSkBitmap(bitmap); } // Loads the image from a canvas. @@ -333,14 +329,14 @@ void Premultiply(SkBitmap bitmap) { void LoadPngFileToSkBitmap(const FilePath& filename, SkBitmap* bitmap, bool is_opaque) { - Vector<char> compressed; - ReadFileToVector(filename, &compressed); - EXPECT_TRUE(compressed.size()); - WebCore::PNGImageDecoder decoder; - decoder.setData(WebCore::SharedBuffer::adoptVector(compressed).get(), true); - scoped_ptr<NativeImageSkia> image_data( - decoder.frameBufferAtIndex(0)->asNewNativeImage()); - *bitmap = *image_data; + std::string compressed; + file_util::ReadFileToString(filename, &compressed); + ASSERT_TRUE(compressed.size()); + + ASSERT_TRUE(gfx::PNGCodec::Decode( + reinterpret_cast<const unsigned char*>(compressed.data()), + compressed.size(), bitmap)); + EXPECT_EQ(is_opaque, bitmap->isOpaque()); Premultiply(*bitmap); } |