Fix perspective version of dftext GM

Review URL: https://codereview.chromium.org/634923002
This commit is contained in:
jvanverth 2014-10-07 07:59:45 -07:00 committed by Commit bot
parent d14e1a2764
commit f9669f43bf

View File

@ -56,10 +56,11 @@ protected:
SkSurfaceProps::kLegacyFontHost_InitType); SkSurfaceProps::kLegacyFontHost_InitType);
SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, info, 0, &props)); SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, info, 0, &props));
SkCanvas* canvas = surface.get() ? surface->getCanvas() : inputCanvas; SkCanvas* canvas = surface.get() ? surface->getCanvas() : inputCanvas;
// init our new canvas with the old canvas's matrix
canvas->setMatrix(inputCanvas->getTotalMatrix());
#else #else
SkCanvas* canvas = inputCanvas; SkCanvas* canvas = inputCanvas;
#endif #endif
// apply global scale to test glyph positioning // apply global scale to test glyph positioning
canvas->scale(1.05f, 1.05f); canvas->scale(1.05f, 1.05f);
canvas->clear(0xffffffff); canvas->clear(0xffffffff);
@ -187,6 +188,9 @@ protected:
#if SK_SUPPORT_GPU #if SK_SUPPORT_GPU
// render offscreen buffer // render offscreen buffer
if (surface) { if (surface) {
SkAutoCanvasRestore acr(inputCanvas, true);
// since we prepended this matrix already, we blit using identity
inputCanvas->resetMatrix();
SkImage* image = surface->newImageSnapshot(); SkImage* image = surface->newImageSnapshot();
inputCanvas->drawImage(image, 0, 0, NULL); inputCanvas->drawImage(image, 0, 0, NULL);
image->unref(); image->unref();