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

Unified Diff: experimental/iOSSampleApp/SkSampleUIView.mm

Issue 637263004: fix some bit-rot in the ios port of sampleapp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address comments from #1 Created 6 years, 2 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 | « experimental/iOSSampleApp/Shared/SkUIDetailViewController.mm ('k') | samplecode/SampleApp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/iOSSampleApp/SkSampleUIView.mm
diff --git a/experimental/iOSSampleApp/SkSampleUIView.mm b/experimental/iOSSampleApp/SkSampleUIView.mm
index a9defbe610f6bb24b8da9851189702821300fc82..41bf91d4e9360adc0ae2d493a651ee5977339695 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;
« no previous file with comments | « experimental/iOSSampleApp/Shared/SkUIDetailViewController.mm ('k') | samplecode/SampleApp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698