From 2c56cb858f9227599746828d1a06b1b1588b44f0 Mon Sep 17 00:00:00 2001 From: "bungeman@google.com" Date: Mon, 17 Feb 2014 17:02:17 +0000 Subject: [PATCH] Use factories instead of directly creating SkImageInfo. R=reed@google.com Review URL: https://codereview.chromium.org/169363007 git-svn-id: http://skia.googlecode.com/svn/trunk@13480 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkSurface.h | 5 +---- tests/DeferredCanvasTest.cpp | 14 ++------------ 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h index 74c5f083f4..8e430d8f47 100644 --- a/include/core/SkSurface.h +++ b/include/core/SkSurface.h @@ -52,10 +52,7 @@ public: * pixels in SkPMColor format. */ static SkSurface* NewRasterPMColor(int width, int height) { - SkImageInfo info = { - width, height, kPMColor_SkColorType, kPremul_SkAlphaType - }; - return NewRaster(info); + return NewRaster(SkImageInfo::MakeN32Premul(width, height)); } /** diff --git a/tests/DeferredCanvasTest.cpp b/tests/DeferredCanvasTest.cpp index 4b67f199fc..62b1b17ffe 100644 --- a/tests/DeferredCanvasTest.cpp +++ b/tests/DeferredCanvasTest.cpp @@ -692,12 +692,7 @@ static PixelPtr getSurfacePixelPtr(SkSurface* surface, bool useGpu) { } static void TestDeferredCanvasSurface(skiatest::Reporter* reporter, GrContextFactory* factory) { - SkImageInfo imageSpec = { - 10, // width - 10, // height - kPMColor_SkColorType, - kPremul_SkAlphaType - }; + SkImageInfo imageSpec = SkImageInfo::MakeN32Premul(10, 10); SkSurface* surface; bool useGpu = NULL != factory; #if SK_SUPPORT_GPU @@ -763,12 +758,7 @@ static void TestDeferredCanvasSurface(skiatest::Reporter* reporter, GrContextFac } static void TestDeferredCanvasSetSurface(skiatest::Reporter* reporter, GrContextFactory* factory) { - SkImageInfo imageSpec = { - 10, // width - 10, // height - kPMColor_SkColorType, - kPremul_SkAlphaType - }; + SkImageInfo imageSpec = SkImageInfo::MakeN32Premul(10, 10); SkSurface* surface; SkSurface* alternateSurface; bool useGpu = NULL != factory;