diff options
author | 2014-10-22 13:06:00 -0700 | |
---|---|---|
committer | 2014-10-22 13:06:00 -0700 | |
commit | f0b1710bdb0c1a434228b5354d948fec696316ac (patch) | |
tree | b9c1e3e35565c1e145b9f59c9c47752790d5ab32 /experimental | |
parent | 2a1208017dd676f94a53bbb228197c3978dbdd8a (diff) |
fix some bit-rot in the ios port of sampleapp
BUG=skia:
Review URL: https://codereview.chromium.org/637263004
Diffstat (limited to 'experimental')
-rw-r--r-- | experimental/iOSSampleApp/Shared/SkUIDetailViewController.mm | 3 | ||||
-rw-r--r-- | experimental/iOSSampleApp/SkSampleUIView.mm | 43 |
2 files changed, 16 insertions, 30 deletions
diff --git a/experimental/iOSSampleApp/Shared/SkUIDetailViewController.mm b/experimental/iOSSampleApp/Shared/SkUIDetailViewController.mm index 7c2aef4d4f..0ab71d9b1e 100644 --- a/experimental/iOSSampleApp/Shared/SkUIDetailViewController.mm +++ b/experimental/iOSSampleApp/Shared/SkUIDetailViewController.mm @@ -104,6 +104,8 @@ } - (void)printContent { + /* comment out until we rev. this to use SkDocument + UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController]; UIPrintInfo *printInfo = [UIPrintInfo printInfo]; printInfo.jobName = @"Skia iOS SampleApp"; @@ -132,6 +134,7 @@ } else { [controller presentAnimated:YES completionHandler:SkCompletionHandler]; } + */ } - (void)presentOptions { diff --git a/experimental/iOSSampleApp/SkSampleUIView.mm b/experimental/iOSSampleApp/SkSampleUIView.mm index a9defbe610..41bf91d4e9 100644 --- a/experimental/iOSSampleApp/SkSampleUIView.mm +++ b/experimental/iOSSampleApp/SkSampleUIView.mm @@ -7,6 +7,7 @@ #include "SkCanvas.h" #include "SkCGUtils.h" +#include "SkSurface.h" #include "SampleApp.h" #if SK_SUPPORT_GPU @@ -119,36 +120,16 @@ public: fBackend = SampleWindow::kNone_BackEndType; } - virtual SkCanvas* createCanvas(SampleWindow::DeviceType dType, - SampleWindow* win) { - switch (dType) { - case SampleWindow::kRaster_DeviceType: - // fallthrough - case SampleWindow::kPicture_DeviceType: - // fallthrough -#if SK_ANGLE - case SampleWindow::kANGLE_DeviceType: -#endif - break; + virtual SkSurface* createSurface(SampleWindow::DeviceType dType, SampleWindow* win) SK_OVERRIDE{ #if SK_SUPPORT_GPU - case SampleWindow::kGPU_DeviceType: - case SampleWindow::kNullGPU_DeviceType: - if (fCurContext) { - SkAutoTUnref<SkBaseDevice> device(new SkGpuDevice(fCurContext, - fCurRenderTarget)); - return new SkCanvas(device); - } else { - return NULL; - } - break; -#endif - default: - SkASSERT(false); - return NULL; + if (SampleWindow::IsGpuDeviceType(dType) && fCurContext) { + SkSurfaceProps props(win->getSurfaceProps()); + return SkSurface::NewRenderTargetDirect(fCurRenderTarget, &props); } +#endif return NULL; } - + virtual void publishCanvas(SampleWindow::DeviceType dType, SkCanvas* canvas, SampleWindow* win) SK_OVERRIDE { @@ -419,23 +400,25 @@ static FPSState gFPS; glViewport(0, 0, fGL.fWidth, fGL.fHeight); - SkAutoTUnref<SkCanvas> canvas(fWind->createCanvas()); + SkAutoTUnref<SkSurface> surface(fWind->createSurface()); + SkCanvas* canvas = surface->getCanvas(); + // if we're not "retained", then we have to always redraw everything. // This call forces us to ignore the fDirtyRgn, and draw everywhere. // If we are "retained", we can skip this call (as the raster case does) fWind->forceInvalAll(); [self drawWithCanvas:canvas]; - + // This application only creates a single color renderbuffer which is already bound at this point. // This call is redundant, but needed if dealing with multiple renderbuffers. glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer); [fGL.fContext presentRenderbuffer:GL_RENDERBUFFER]; - } - (void)drawInRaster { - SkAutoTUnref<SkCanvas> canvas(fWind->createCanvas()); + SkAutoTUnref<SkSurface> surface(fWind->createSurface()); + SkCanvas* canvas = surface->getCanvas(); [self drawWithCanvas:canvas]; CGImageRef cgimage = SkCreateCGImageRef(fWind->getBitmap()); fRasterLayer.contents = (id)cgimage; |