summaryrefslogtreecommitdiffstats
path: root/cc/test/skia_common.cc
diff options
context:
space:
mode:
authorreed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-12 21:33:17 +0000
committerreed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-12 21:33:17 +0000
commite4f9ce3344dd2b52d34a943cc9a97b9205b1d400 (patch)
treec0112ea27cc4badce57b9f217a86e80f012d260d /cc/test/skia_common.cc
parent48c21631008649ad2575b16fe33b336858dcdde9 (diff)
downloadchromium_src-e4f9ce3344dd2b52d34a943cc9a97b9205b1d400.zip
chromium_src-e4f9ce3344dd2b52d34a943cc9a97b9205b1d400.tar.gz
chromium_src-e4f9ce3344dd2b52d34a943cc9a97b9205b1d400.tar.bz2
use SkImageInfo parameter for SkPixelRef constructor
BUG= Review URL: https://codereview.chromium.org/102063005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240426 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/skia_common.cc')
-rw-r--r--cc/test/skia_common.cc22
1 files changed, 14 insertions, 8 deletions
diff --git a/cc/test/skia_common.cc b/cc/test/skia_common.cc
index 49c984d..d8d61a8 100644
--- a/cc/test/skia_common.cc
+++ b/cc/test/skia_common.cc
@@ -12,8 +12,8 @@
namespace cc {
-TestPixelRef::TestPixelRef(int width, int height)
- : pixels_(new char[4 * width * height]) {}
+TestPixelRef::TestPixelRef(const SkImageInfo& info)
+ : SkPixelRef(info), pixels_(new char[4 * info.fWidth * info.fHeight]) {}
TestPixelRef::~TestPixelRef() {}
@@ -31,8 +31,9 @@ SkPixelRef* TestPixelRef::deepCopy(
}
-TestLazyPixelRef::TestLazyPixelRef(int width, int height)
- : pixels_(new char[4 * width * height]) {}
+TestLazyPixelRef::TestLazyPixelRef(const SkImageInfo& info)
+ : skia::LazyPixelRef(info),
+ pixels_(new char[4 * info.fWidth * info.fHeight]) {}
TestLazyPixelRef::~TestLazyPixelRef() {}
@@ -72,13 +73,18 @@ void DrawPicture(unsigned char* buffer,
}
void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap) {
+ SkImageInfo info = {
+ size.width(),
+ size.height(),
+ kPMColor_SkColorType,
+ kPremul_SkAlphaType
+ };
+
skia::RefPtr<TestLazyPixelRef> lazy_pixel_ref =
- skia::AdoptRef(new TestLazyPixelRef(size.width(), size.height()));
+ skia::AdoptRef(new TestLazyPixelRef(info));
lazy_pixel_ref->setURI(uri);
- bitmap->setConfig(SkBitmap::kARGB_8888_Config,
- size.width(),
- size.height());
+ bitmap->setConfig(info);
bitmap->setPixelRef(lazy_pixel_ref.get());
}