diff options
-rw-r--r-- | samplecode/SampleApp.cpp | 8 | ||||
-rw-r--r-- | tests/ApplyGammaTest.cpp | 10 | ||||
-rw-r--r-- | tests/DeviceTest.cpp | 5 |
3 files changed, 7 insertions, 16 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index a1dabc2f65..3919c244a2 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -18,8 +18,6 @@ #include "SkDocument.h" #include "SkGammaColorFilter.h" #include "SkGraphics.h" -#include "SkImage_Base.h" -#include "SkImageEncoder.h" #include "SkOSFile.h" #include "SkOSPath.h" #include "SkPaint.h" @@ -345,10 +343,6 @@ public: SkBitmap bm; bm.allocPixels(offscreenInfo); renderingCanvas->readPixels(&bm, 0, 0); - SkPixmap pm; - bm.peekPixels(&pm); - sk_sp<SkImage> image(SkImage::MakeTextureFromPixmap(fCurContext, pm, - SkBudgeted::kNo)); SkCanvas* gpuCanvas = fGpuSurface->getCanvas(); @@ -363,7 +357,7 @@ public: gammaPaint.setColorFilter(SkGammaColorFilter::Make(1.0f / 2.2f)); } - gpuCanvas->drawImage(image, 0, 0, &gammaPaint); + gpuCanvas->drawBitmap(bm, 0, 0, &gammaPaint); } fGpuSurface->prepareForExternalIO(); diff --git a/tests/ApplyGammaTest.cpp b/tests/ApplyGammaTest.cpp index ec790f5280..4f1f828966 100644 --- a/tests/ApplyGammaTest.cpp +++ b/tests/ApplyGammaTest.cpp @@ -13,7 +13,6 @@ #include "SkCanvas.h" #include "SkGammaColorFilter.h" -#include "SkPixmap.h" #include "SkSurface.h" #include "SkUtils.h" @@ -87,7 +86,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ApplyGamma, reporter, ctxInfo) { srcPixels.get()[i] = i; } - SkPixmap pm(ii, srcPixels.get(), kRowBytes); + SkBitmap bm; + bm.installPixels(ii, srcPixels.get(), kRowBytes); SkAutoTMalloc<uint32_t> read(kW * kH); @@ -96,12 +96,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ApplyGamma, reporter, ctxInfo) { for (auto dOrigin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }) { for (auto gamma : { 1.0f, 1.0f / 1.8f, 1.0f / 2.2f }) { - sk_sp<SkImage> src(SkImage::MakeTextureFromPixmap(context, pm, SkBudgeted::kNo)); - sk_sp<SkSurface> dst(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, ii, 0, dOrigin, nullptr)); - if (!src || !dst) { + if (!dst) { ERRORF(reporter, "Could not create surfaces for copy surface test."); continue; } @@ -115,7 +113,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ApplyGamma, reporter, ctxInfo) { gammaPaint.setBlendMode(SkBlendMode::kSrc); gammaPaint.setColorFilter(SkGammaColorFilter::Make(gamma)); - dstCanvas->drawImage(src, 0, 0, &gammaPaint); + dstCanvas->drawBitmap(bm, 0, 0, &gammaPaint); dstCanvas->flush(); sk_memset32(read.get(), 0, kW * kH); diff --git a/tests/DeviceTest.cpp b/tests/DeviceTest.cpp index 9fb4fa2eac..dd1a9f2379 100644 --- a/tests/DeviceTest.cpp +++ b/tests/DeviceTest.cpp @@ -106,9 +106,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_GPUDevice, reporter, ctxInfo) { SkASSERT(SkIRect::MakeWH(kWidth, kHeight) == special->subset()); // Create a gpu-backed special image from a gpu-backed SkImage - SkPixmap pixmap; - bm.peekPixels(&pixmap); - image = SkImage::MakeTextureFromPixmap(context, pixmap, SkBudgeted::kNo); + sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, bm.info())); + image = surface->makeImageSnapshot(); special = DeviceTestingAccess::MakeSpecial(gpuDev.get(), image.get()); SkASSERT(special->isTextureBacked()); SkASSERT(kWidth == special->width()); |