| 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info)); | 30 SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info)); |
| 31 surface->getCanvas()->clear(0); | 31 surface->getCanvas()->clear(0); |
| 32 surface->getCanvas()->drawPicture(pic); | 32 surface->getCanvas()->drawPicture(pic); |
| 33 return surface->newImageSnapshot(); | 33 return surface->newImageSnapshot(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 static SkImage* make_texture(GrContext* ctx, const SkPicture* pic, const SkImage
Info& info) { | 36 static SkImage* make_texture(GrContext* ctx, const SkPicture* pic, const SkImage
Info& info) { |
| 37 if (!ctx) { | 37 if (!ctx) { |
| 38 return nullptr; | 38 return nullptr; |
| 39 } | 39 } |
| 40 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, SkBudgeted::
kNo, | 40 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, SkSurface::k
No_Budgeted, |
| 41 info, 0)); | 41 info, 0)); |
| 42 surface->getCanvas()->clear(0); | 42 surface->getCanvas()->clear(0); |
| 43 surface->getCanvas()->drawPicture(pic); | 43 surface->getCanvas()->drawPicture(pic); |
| 44 return surface->newImageSnapshot(); | 44 return surface->newImageSnapshot(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 static SkImage* make_pict_gen(GrContext*, const SkPicture* pic, const SkImageInf
o& info) { | 47 static SkImage* make_pict_gen(GrContext*, const SkPicture* pic, const SkImageInf
o& info) { |
| 48 return SkImage::NewFromPicture(pic, info.dimensions(), nullptr, nullptr); | 48 return SkImage::NewFromPicture(pic, info.dimensions(), nullptr, nullptr); |
| 49 } | 49 } |
| 50 | 50 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 120 } |
| 121 canvas->translate(120, 0); | 121 canvas->translate(120, 0); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 private: | 125 private: |
| 126 typedef skiagm::GM INHERITED; | 126 typedef skiagm::GM INHERITED; |
| 127 }; | 127 }; |
| 128 DEF_GM( return new ImageShaderGM; ) | 128 DEF_GM( return new ImageShaderGM; ) |
| 129 | 129 |
| OLD | NEW |