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

Unified Diff: tests/ReadPixelsTest.cpp

Issue 355193006: stop calling SkCanvas::getDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: guard gpu code in no-gpu build Created 6 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 | « tests/DeferredCanvasTest.cpp ('k') | tests/WritePixelsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ReadPixelsTest.cpp
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index 3e22f7c73c681956e4b58c96a3f3a720fc4340e1..d0bf9031f0f6fe09a36bd7933f85cd2137cf8bab 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -10,6 +10,7 @@
#include "SkColorPriv.h"
#include "SkMathPriv.h"
#include "SkRegion.h"
+#include "SkSurface.h"
#include "Test.h"
#if SK_SUPPORT_GPU
@@ -297,11 +298,11 @@ DEF_GPUTEST(ReadPixels, reporter, factory) {
glCtxTypeCnt = GrContextFactory::kGLContextTypeCnt;
}
#endif
+ const SkImageInfo info = SkImageInfo::MakeN32Premul(DEV_W, DEV_H);
for (int glCtxType = 0; glCtxType < glCtxTypeCnt; ++glCtxType) {
- SkAutoTUnref<SkBaseDevice> device;
+ SkAutoTUnref<SkSurface> surface;
if (0 == dtype) {
- SkImageInfo info = SkImageInfo::MakeN32Premul(DEV_W, DEV_H);
- device.reset(SkBitmapDevice::Create(info));
+ surface.reset(SkSurface::NewRaster(info));
} else {
#if SK_SUPPORT_GPU
GrContextFactory::GLContextType type =
@@ -318,16 +319,15 @@ DEF_GPUTEST(ReadPixels, reporter, factory) {
desc.fWidth = DEV_W;
desc.fHeight = DEV_H;
desc.fConfig = kSkia8888_GrPixelConfig;
- desc.fOrigin = 1 == dtype ? kBottomLeft_GrSurfaceOrigin
- : kTopLeft_GrSurfaceOrigin;
+ desc.fOrigin = 1 == dtype ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOrigin;
GrAutoScratchTexture ast(context, desc, GrContext::kExact_ScratchTexMatch);
SkAutoTUnref<GrTexture> tex(ast.detach());
- device.reset(new SkGpuDevice(context, tex));
+ surface.reset(SkSurface::NewRenderTargetDirect(tex->asRenderTarget()));
#else
continue;
#endif
}
- SkCanvas canvas(device);
+ SkCanvas& canvas = *surface->getCanvas();
fillCanvas(&canvas);
static const struct {
@@ -353,9 +353,9 @@ DEF_GPUTEST(ReadPixels, reporter, factory) {
if (startsWithPixels) {
fillBitmap(&bmp);
}
- uint32_t idBefore = canvas.getDevice()->accessBitmap(false).getGenerationID();
+ uint32_t idBefore = surface->generationID();
bool success = canvas.readPixels(&bmp, srcRect.fLeft, srcRect.fTop);
- uint32_t idAfter = canvas.getDevice()->accessBitmap(false).getGenerationID();
+ uint32_t idAfter = surface->generationID();
// we expect to succeed when the read isn't fully clipped
// out.
« no previous file with comments | « tests/DeferredCanvasTest.cpp ('k') | tests/WritePixelsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698