Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: cc/resources/picture_pile_impl_unittest.cc

Issue 15004024: Only use skia::RefPtr for refcounting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment changes, SharePtr Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/cc_tests.gyp ('k') | cc/resources/picture_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/picture_pile_impl_unittest.cc
diff --git a/cc/resources/picture_pile_impl_unittest.cc b/cc/resources/picture_pile_impl_unittest.cc
index 0fde59e3766480149b4cbf5dcd5763c4699e055a..10c859e8f5016c3a7713b3db2d228638fcfcfaa9 100644
--- a/cc/resources/picture_pile_impl_unittest.cc
+++ b/cc/resources/picture_pile_impl_unittest.cc
@@ -4,7 +4,9 @@
#include "base/memory/scoped_ptr.h"
#include "cc/test/fake_picture_pile_impl.h"
+#include "cc/test/skia_common.h"
#include "skia/ext/lazy_pixel_ref.h"
+#include "skia/ext/refptr.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkPixelRef.h"
#include "third_party/skia/include/core/SkShader.h"
@@ -13,61 +15,6 @@
namespace cc {
namespace {
-class TestPixelRef : public SkPixelRef {
- public:
- // Pure virtual implementation.
- TestPixelRef(int width, int height)
- : pixels_(new char[4 * width * height]) {}
- virtual SkFlattenable::Factory getFactory() OVERRIDE { return NULL; }
- virtual void* onLockPixels(SkColorTable** color_table) OVERRIDE {
- return pixels_.get();
- }
- virtual void onUnlockPixels() OVERRIDE {}
- virtual SkPixelRef* deepCopy(
- SkBitmap::Config config,
- const SkIRect* subset) OVERRIDE {
- this->ref();
- return this;
- }
- private:
- scoped_ptr<char[]> pixels_;
-};
-
-class TestLazyPixelRef : public skia::LazyPixelRef {
- public:
- // Pure virtual implementation.
- TestLazyPixelRef(int width, int height)
- : pixels_(new char[4 * width * height]) {}
- virtual SkFlattenable::Factory getFactory() OVERRIDE { return NULL; }
- virtual void* onLockPixels(SkColorTable** color_table) OVERRIDE {
- return pixels_.get();
- }
- virtual void onUnlockPixels() OVERRIDE {}
- virtual bool PrepareToDecode(const PrepareParams& params) OVERRIDE {
- return true;
- }
- virtual SkPixelRef* deepCopy(
- SkBitmap::Config config,
- const SkIRect* subset) OVERRIDE {
- this->ref();
- return this;
- }
- virtual void Decode() OVERRIDE {}
- private:
- scoped_ptr<char[]> pixels_;
-};
-
-void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap) {
- SkAutoTUnref<TestLazyPixelRef> lazy_pixel_ref;
- lazy_pixel_ref.reset(new TestLazyPixelRef(size.width(), size.height()));
- lazy_pixel_ref->setURI(uri);
-
- bitmap->setConfig(SkBitmap::kARGB_8888_Config,
- size.width(),
- size.height());
- bitmap->setPixelRef(lazy_pixel_ref);
-}
-
TEST(PicturePileImplTest, AnalyzeIsSolidUnscaled) {
gfx::Size tile_size(100, 100);
gfx::Size layer_bounds(400, 400);
« no previous file with comments | « cc/cc_tests.gyp ('k') | cc/resources/picture_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698