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

Unified Diff: cc/test/skia_common.cc

Issue 1294673006: Update GatherPixelRefDevice to the new SkImage/SkPixelRef API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update cc_unittests Created 5 years, 4 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/test/skia_common.h ('k') | skia/ext/pixel_ref_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/skia_common.cc
diff --git a/cc/test/skia_common.cc b/cc/test/skia_common.cc
index e1336d295e494f8c6845e19e09cab74713cf14ef..a25df8d4ffb36d9523df5a4127e743a0e5b680ab 100644
--- a/cc/test/skia_common.cc
+++ b/cc/test/skia_common.cc
@@ -8,11 +8,22 @@
#include "cc/playback/picture.h"
#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkCanvas.h"
+#include "third_party/skia/include/core/SkImageGenerator.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/skia_util.h"
namespace cc {
+namespace {
+
+class TestImageGenerator : public SkImageGenerator {
+ public:
+ explicit TestImageGenerator(const SkImageInfo& info)
+ : SkImageGenerator(info) {}
+};
+
+} // anonymous namespace
+
void DrawPicture(unsigned char* buffer,
const gfx::Rect& layer_rect,
scoped_refptr<Picture> picture) {
@@ -39,12 +50,10 @@ void DrawDisplayList(unsigned char* buffer,
list->Raster(&canvas, NULL, gfx::Rect(), 1.0f);
}
-void CreateBitmap(const gfx::Size& size, const char* uri, SkBitmap* bitmap) {
- SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height());
-
- bitmap->allocPixels(info);
- bitmap->pixelRef()->setImmutable();
- bitmap->pixelRef()->setURI(uri);
+void CreateDiscardableBitmap(const gfx::Size& size, SkBitmap* bitmap) {
+ const SkImageInfo info =
+ SkImageInfo::MakeN32Premul(size.width(), size.height());
+ SkInstallDiscardablePixelRef(new TestImageGenerator(info), bitmap);
}
} // namespace cc
« no previous file with comments | « cc/test/skia_common.h ('k') | skia/ext/pixel_ref_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698