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

Unified Diff: cc/resources/picture_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/resources/picture_pile_impl_unittest.cc ('k') | cc/test/skia_common.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/picture_unittest.cc
diff --git a/cc/resources/picture_unittest.cc b/cc/resources/picture_unittest.cc
index c5ddde22f584c8a37e03e8b43762d721bc920d60..7d92582fa04540f871db7742903472555bc5655b 100644
--- a/cc/resources/picture_unittest.cc
+++ b/cc/resources/picture_unittest.cc
@@ -7,6 +7,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "cc/test/fake_content_layer_client.h"
+#include "cc/test/skia_common.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkDevice.h"
@@ -19,55 +20,6 @@
namespace cc {
namespace {
-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 DrawPicture(unsigned char* buffer,
- gfx::Rect layer_rect,
- scoped_refptr<Picture> picture) {
- SkBitmap bitmap;
- bitmap.setConfig(SkBitmap::kARGB_8888_Config,
- layer_rect.width(),
- layer_rect.height());
- bitmap.setPixels(buffer);
- SkDevice device(bitmap);
- SkCanvas canvas(&device);
- canvas.clipRect(gfx::RectToSkRect(layer_rect));
- picture->Raster(&canvas, layer_rect, 1.0f, false);
-}
-
-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(PictureTest, AsBase64String) {
SkGraphics::Init();
« no previous file with comments | « cc/resources/picture_pile_impl_unittest.cc ('k') | cc/test/skia_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698