diff options
author | reed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-15 17:46:55 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-15 17:46:55 +0000 |
commit | 1f2c8f8dc2c709e5ee4e3cfd358a6338abeb14c9 (patch) | |
tree | 4085977ccb92d9b597f86f5d46272ee728fd28bd /cc/test/skia_common.cc | |
parent | 21f913ed182e5dbe0e6bfb00062b3a966a8cf3e1 (diff) | |
download | chromium_src-1f2c8f8dc2c709e5ee4e3cfd358a6338abeb14c9.zip chromium_src-1f2c8f8dc2c709e5ee4e3cfd358a6338abeb14c9.tar.gz chromium_src-1f2c8f8dc2c709e5ee4e3cfd358a6338abeb14c9.tar.bz2 |
replace TestPixelRef with bitmap.allocPixels() -- removing unneeded subclass of pixelref
BUG=
Review URL: https://codereview.chromium.org/136283004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244926 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/skia_common.cc')
-rw-r--r-- | cc/test/skia_common.cc | 45 |
1 files changed, 5 insertions, 40 deletions
diff --git a/cc/test/skia_common.cc b/cc/test/skia_common.cc index d52118b..dfccd64 100644 --- a/cc/test/skia_common.cc +++ b/cc/test/skia_common.cc @@ -6,43 +6,12 @@ #include "cc/resources/picture.h" #include "skia/ext/refptr.h" -#include "third_party/skia/include/core/SkBitmapDevice.h" +#include "third_party/skia/include/core/SkCanvas.h" #include "ui/gfx/rect.h" #include "ui/gfx/skia_util.h" namespace cc { -TestPixelRef::TestPixelRef(const SkImageInfo& info) - : SkPixelRef(info), pixels_(new char[4 * info.fWidth * info.fHeight]) {} - -TestPixelRef::~TestPixelRef() {} - -SkFlattenable::Factory TestPixelRef::getFactory() const { return NULL; } - -#ifdef SK_SUPPORT_LEGACY_ONLOCKPIXELS -void* TestPixelRef::onLockPixels(SkColorTable** color_table) { - return pixels_.get(); -} -#endif - -bool TestPixelRef::onNewLockPixels(LockRec* rec) { - if (pixels_.get()) { - rec->fPixels = pixels_.get(); - rec->fColorTable = NULL; - rec->fRowBytes = 4 * info().fWidth; - return true; - } - return false; -} - -SkPixelRef* TestPixelRef::deepCopy( - SkBitmap::Config config, - const SkIRect* subset) { - this->ref(); - return this; -} - - void DrawPicture(unsigned char* buffer, const gfx::Rect& layer_rect, scoped_refptr<Picture> picture) { @@ -51,8 +20,7 @@ void DrawPicture(unsigned char* buffer, layer_rect.width(), layer_rect.height()); bitmap.setPixels(buffer); - SkBitmapDevice device(bitmap); - SkCanvas canvas(&device); + SkCanvas canvas(bitmap); canvas.clipRect(gfx::RectToSkRect(layer_rect)); picture->Raster(&canvas, NULL, layer_rect, 1.0f); } @@ -65,13 +33,10 @@ void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap) { kPremul_SkAlphaType }; - skia::RefPtr<TestPixelRef> pixel_ref = - skia::AdoptRef(new TestPixelRef(info)); - pixel_ref->setURI(uri); - bitmap->setConfig(info); - bitmap->setPixelRef(pixel_ref.get()); + bitmap->allocPixels(); + bitmap->pixelRef()->setImmutable(); + bitmap->pixelRef()->setURI(uri); } - } // namespace cc |