| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkGradientShader.h" | 9 #include "SkGradientShader.h" |
| 10 #include "SkImage.h" | 10 #include "SkImage.h" |
| 11 #include "SkPath.h" | 11 #include "SkPath.h" |
| 12 #include "SkSurface.h" | 12 #include "SkSurface.h" |
| 13 | 13 |
| 14 static sk_sp<SkImage> make_image(SkCanvas* origCanvas, int w, int h) { | 14 static sk_sp<SkImage> make_image(SkCanvas* origCanvas, int w, int h) { |
| 15 SkImageInfo info = SkImageInfo::MakeN32Premul(w, h); | 15 SkImageInfo info = SkImageInfo::MakeN32Premul(w, h); |
| 16 SkAutoTUnref<SkSurface> surface(origCanvas->newSurface(info)); | 16 auto surface(origCanvas->makeSurface(info)); |
| 17 if (nullptr == surface) { | 17 if (nullptr == surface) { |
| 18 surface.reset(SkSurface::NewRaster(info)); | 18 surface = SkSurface::MakeRaster(info); |
| 19 } | 19 } |
| 20 SkCanvas* canvas = surface->getCanvas(); | 20 SkCanvas* canvas = surface->getCanvas(); |
| 21 | 21 |
| 22 sk_tool_utils::draw_checkerboard(canvas, SK_ColorRED, SK_ColorGREEN, w/10); | 22 sk_tool_utils::draw_checkerboard(canvas, SK_ColorRED, SK_ColorGREEN, w/10); |
| 23 return surface->makeImageSnapshot(); | 23 return surface->makeImageSnapshot(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace skiagm { | 26 namespace skiagm { |
| 27 | 27 |
| 28 class PerspShadersGM : public GM { | 28 class PerspShadersGM : public GM { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 SkBitmap fBitmap; | 165 SkBitmap fBitmap; |
| 166 | 166 |
| 167 typedef GM INHERITED; | 167 typedef GM INHERITED; |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 ////////////////////////////////////////////////////////////////////////////// | 170 ////////////////////////////////////////////////////////////////////////////// |
| 171 | 171 |
| 172 DEF_GM(return new PerspShadersGM(true);) | 172 DEF_GM(return new PerspShadersGM(true);) |
| 173 DEF_GM(return new PerspShadersGM(false);) | 173 DEF_GM(return new PerspShadersGM(false);) |
| 174 } | 174 } |
| OLD | NEW |