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

Unified Diff: tests/CanvasTest.cpp

Issue 791763002: Revert of remove (dumb) canvas::NewRaster, and rename surface::NewRasterPMColor to N32Premul (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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/SkCanvas.cpp ('k') | tests/DeferredCanvasTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/CanvasTest.cpp
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index 1f8f2760b5c150355920134af12f87063491965c..d5ddfe6fb05221c3b94848ccbe759ffef808a6b0 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -73,7 +73,7 @@
}
static SkSurface* createSurface(SkColor color) {
- SkSurface* surface = SkSurface::NewRasterN32Premul(kWidth, kHeight);
+ SkSurface* surface = SkSurface::NewRasterPMColor(kWidth, kHeight);
surface->getCanvas()->clear(color);
return surface;
}
@@ -748,13 +748,7 @@
static void test_newraster(skiatest::Reporter* reporter) {
SkImageInfo info = SkImageInfo::MakeN32Premul(10, 10);
- const size_t minRowBytes = info.minRowBytes();
- const size_t size = info.getSafeSize(minRowBytes);
- SkAutoMalloc storage(size);
- SkPMColor* baseAddr = static_cast<SkPMColor*>(storage.get());
- sk_bzero(baseAddr, size);
-
- SkCanvas* canvas = SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes);
+ SkCanvas* canvas = SkCanvas::NewRaster(info);
REPORTER_ASSERT(reporter, canvas);
SkImageInfo info2;
@@ -762,7 +756,6 @@
const SkPMColor* addr = (const SkPMColor*)canvas->peekPixels(&info2, &rowBytes);
REPORTER_ASSERT(reporter, addr);
REPORTER_ASSERT(reporter, info == info2);
- REPORTER_ASSERT(reporter, minRowBytes == rowBytes);
for (int y = 0; y < info.height(); ++y) {
for (int x = 0; x < info.width(); ++x) {
REPORTER_ASSERT(reporter, 0 == addr[x]);
@@ -773,19 +766,19 @@
// now try a deliberately bad info
info = info.makeWH(-1, info.height());
- REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes));
+ REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRaster(info));
// too big
info = info.makeWH(1 << 30, 1 << 30);
- REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes));
+ REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRaster(info));
// not a valid pixel type
info = SkImageInfo::Make(10, 10, kUnknown_SkColorType, info.alphaType());
- REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes));
+ REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRaster(info));
// We should succeed with a zero-sized valid info
info = SkImageInfo::MakeN32Premul(0, 0);
- canvas = SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes);
+ canvas = SkCanvas::NewRaster(info);
REPORTER_ASSERT(reporter, canvas);
SkDELETE(canvas);
}
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | tests/DeferredCanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698