Fixed canvas creation in SampleApp

https://codereview.appspot.com/6588061/



git-svn-id: http://skia.googlecode.com/svn/trunk@5764 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
robertphillips@google.com 2012-10-02 12:32:22 +00:00
parent 8fdb4c16a1
commit ce9dce0d81

View File

@ -176,14 +176,15 @@ bool SkWindow::update(SkIRect* updateArea)
bm.setPixels(buffer); bm.setPixels(buffer);
#endif #endif
SkCanvas rasterCanvas(bm);
rasterCanvas.clipRegion(fDirtyRgn); SkAutoTUnref<SkCanvas> canvas(this->createCanvas());
canvas->clipRegion(fDirtyRgn);
if (updateArea) if (updateArea)
*updateArea = fDirtyRgn.getBounds(); *updateArea = fDirtyRgn.getBounds();
SkAutoCanvasRestore acr(&rasterCanvas, true); SkAutoCanvasRestore acr(canvas, true);
rasterCanvas.concat(fMatrix); canvas->concat(fMatrix);
// empty this now, so we can correctly record any inval calls that // empty this now, so we can correctly record any inval calls that
// might be made during the draw call. // might be made during the draw call.
@ -191,25 +192,25 @@ bool SkWindow::update(SkIRect* updateArea)
#ifdef TEST_BOUNDER #ifdef TEST_BOUNDER
test_bounder b(bm); test_bounder b(bm);
rasterCanvas.setBounder(&b); canvas->setBounder(&b);
#endif #endif
#ifdef SK_SIMULATE_FAILED_MALLOC #ifdef SK_SIMULATE_FAILED_MALLOC
gEnableControlledThrow = true; gEnableControlledThrow = true;
#endif #endif
#ifdef SK_BUILD_FOR_WIN32 #ifdef SK_BUILD_FOR_WIN32
//try { //try {
this->draw(&rasterCanvas); this->draw(canvas);
//} //}
//catch (...) { //catch (...) {
//} //}
#else #else
this->draw(&rasterCanvas); this->draw(canvas);
#endif #endif
#ifdef SK_SIMULATE_FAILED_MALLOC #ifdef SK_SIMULATE_FAILED_MALLOC
gEnableControlledThrow = false; gEnableControlledThrow = false;
#endif #endif
#ifdef TEST_BOUNDER #ifdef TEST_BOUNDER
rasterCanvas.setBounder(NULL); canvas->setBounder(NULL);
#endif #endif
#if defined(SK_BUILD_FOR_WINCE) && defined(USE_GX_SCREEN) #if defined(SK_BUILD_FOR_WINCE) && defined(USE_GX_SCREEN)