| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
| 10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 p[x] = ((x + y) & 1) ? SK_ColorWHITE : SK_ColorBLACK; | 29 p[x] = ((x + y) & 1) ? SK_ColorWHITE : SK_ColorBLACK; |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 bm.unlockPixels(); | 32 bm.unlockPixels(); |
| 33 return bm; | 33 return bm; |
| 34 } | 34 } |
| 35 | 35 |
| 36 static sk_sp<SkImage> makebm(SkCanvas* origCanvas, SkBitmap* resultBM, int w, in
t h) { | 36 static sk_sp<SkImage> makebm(SkCanvas* origCanvas, SkBitmap* resultBM, int w, in
t h) { |
| 37 SkImageInfo info = SkImageInfo::MakeN32Premul(w, h); | 37 SkImageInfo info = SkImageInfo::MakeN32Premul(w, h); |
| 38 | 38 |
| 39 SkAutoTUnref<SkSurface> surface(origCanvas->newSurface(info)); | 39 auto surface(origCanvas->makeSurface(info)); |
| 40 if (nullptr == surface) { | 40 if (nullptr == surface) { |
| 41 // picture canvas will return null, so fall-back to raster | 41 // picture canvas will return null, so fall-back to raster |
| 42 surface.reset(SkSurface::NewRaster(info)); | 42 surface = SkSurface::MakeRaster(info); |
| 43 } | 43 } |
| 44 | 44 |
| 45 SkCanvas* canvas = surface->getCanvas(); | 45 SkCanvas* canvas = surface->getCanvas(); |
| 46 | 46 |
| 47 canvas->clear(SK_ColorTRANSPARENT); | 47 canvas->clear(SK_ColorTRANSPARENT); |
| 48 | 48 |
| 49 SkScalar wScalar = SkIntToScalar(w); | 49 SkScalar wScalar = SkIntToScalar(w); |
| 50 SkScalar hScalar = SkIntToScalar(h); | 50 SkScalar hScalar = SkIntToScalar(h); |
| 51 | 51 |
| 52 SkPoint pt = { wScalar / 2, hScalar / 2 }; | 52 SkPoint pt = { wScalar / 2, hScalar / 2 }; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 canvas->drawBitmapRect(bm, srcRect, dstRect, &paint); | 220 canvas->drawBitmapRect(bm, srcRect, dstRect, &paint); |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 | 223 |
| 224 private: | 224 private: |
| 225 typedef skiagm::GM INHERITED; | 225 typedef skiagm::GM INHERITED; |
| 226 }; | 226 }; |
| 227 | 227 |
| 228 DEF_GM( return new DrawBitmapRectGM(canvasproc, nullptr); ) | 228 DEF_GM( return new DrawBitmapRectGM(canvasproc, nullptr); ) |
| 229 DEF_GM( return new DrawBitmapRectGM(imageproc, "-imagerect"); ) | 229 DEF_GM( return new DrawBitmapRectGM(imageproc, "-imagerect"); ) |
| OLD | NEW |