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

Unified Diff: tests/BitmapTest.cpp

Issue 1143173011: use pixmaps for dst in sprites -- NO BITMAPS (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add dox Created 5 years, 6 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 | « src/core/SkSpriteBlitter_RGB16.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/BitmapTest.cpp
diff --git a/tests/BitmapTest.cpp b/tests/BitmapTest.cpp
index f3d8faa967c7ae99c311e63cf4e3d5f73cc260de..256725666781bea5797e5adbc9800b8e504312a7 100644
--- a/tests/BitmapTest.cpp
+++ b/tests/BitmapTest.cpp
@@ -9,6 +9,31 @@
#include "SkMallocPixelRef.h"
#include "Test.h"
+static void test_peekpixels(skiatest::Reporter* reporter) {
+ const SkImageInfo info = SkImageInfo::MakeN32Premul(10, 10);
+
+ SkPixmap pmap;
+ SkBitmap bm;
+
+ // empty should return false
+ REPORTER_ASSERT(reporter, !bm.peekPixels(NULL));
+ REPORTER_ASSERT(reporter, !bm.peekPixels(&pmap));
+
+ // no pixels should return false
+ bm.setInfo(SkImageInfo::MakeN32Premul(10, 10));
+ REPORTER_ASSERT(reporter, !bm.peekPixels(NULL));
+ REPORTER_ASSERT(reporter, !bm.peekPixels(&pmap));
+
+ // real pixels should return true
+ bm.allocPixels(info);
+ REPORTER_ASSERT(reporter, bm.peekPixels(NULL));
+ REPORTER_ASSERT(reporter, bm.peekPixels(&pmap));
+ REPORTER_ASSERT(reporter, pmap.info() == bm.info());
+ REPORTER_ASSERT(reporter, pmap.addr() == bm.getPixels());
+ REPORTER_ASSERT(reporter, pmap.rowBytes() == bm.rowBytes());
+ REPORTER_ASSERT(reporter, pmap.ctable() == bm.getColorTable());
+}
+
// https://code.google.com/p/chromium/issues/detail?id=446164
static void test_bigalloc(skiatest::Reporter* reporter) {
const int width = 0x40000001;
@@ -95,4 +120,5 @@ DEF_TEST(Bitmap, reporter) {
test_bigwidth(reporter);
test_allocpixels(reporter);
test_bigalloc(reporter);
+ test_peekpixels(reporter);
}
« no previous file with comments | « src/core/SkSpriteBlitter_RGB16.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698