replace setConfig+allocPixels with alloc-or-install-pixels
BUG=skia:
R=scroggo@google.com, halcanary@google.com, reed@google.com
Author: reed@chromium.org
Review URL: https://codereview.chromium.org/164203003
git-svn-id: http://skia.googlecode.com/svn/trunk@13442 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp
index 2cf1bc5..e7f7005 100644
--- a/tests/DrawPathTest.cpp
+++ b/tests/DrawPathTest.cpp
@@ -11,20 +11,10 @@
#include "SkSurface.h"
#include "Test.h"
-static SkCanvas* create(SkBitmap::Config config, int w, int h, int rb,
- void* addr = NULL) {
- SkBitmap bm;
- bm.setConfig(config, w, h, rb);
- if (addr) {
- bm.setPixels(addr);
- } else {
- bm.allocPixels();
- }
- return new SkCanvas(bm);
-}
-
static SkCanvas* new_canvas(int w, int h) {
- return create(SkBitmap::kARGB_8888_Config, w, h, 0, NULL);
+ SkBitmap bm;
+ bm.allocN32Pixels(w, h);
+ return new SkCanvas(bm);
}
///////////////////////////////////////////////////////////////////////////////
@@ -33,8 +23,8 @@
static void test_big_aa_rect(skiatest::Reporter* reporter) {
SkBitmap output;
SkPMColor pixel[1];
- output.setConfig(SkBitmap::kARGB_8888_Config, 1, 1, 4);
- output.setPixels(pixel);
+ output.installPixels(SkImageInfo::MakeN32Premul(1, 1),
+ pixel, 4, NULL, NULL);
SkSurface* surf = SkSurface::NewRasterPMColor(300, 33300);
SkCanvas* canvas = surf->getCanvas();
@@ -125,8 +115,7 @@
// stepper for the quadratic. Now we bias that value by 1/2 so we don't overflow
static void test_crbug_140803() {
SkBitmap bm;
- bm.setConfig(SkBitmap::kARGB_8888_Config, 2700, 30*1024);
- bm.allocPixels();
+ bm.allocN32Pixels(2700, 30*1024);
SkCanvas canvas(bm);
SkPath path;