| 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkPath.h" | 10 #include "SkPath.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 draw_content(surfCanvas); | 41 draw_content(surfCanvas); |
| 42 SkBitmap bitmap; | 42 SkBitmap bitmap; |
| 43 | 43 |
| 44 // test peekPixels | 44 // test peekPixels |
| 45 { | 45 { |
| 46 SkImageInfo info; | 46 SkImageInfo info; |
| 47 size_t rowBytes; | 47 size_t rowBytes; |
| 48 const void* addr = surfCanvas->peekPixels(&info, &rowBytes); | 48 const void* addr = surfCanvas->peekPixels(&info, &rowBytes); |
| 49 if (addr && bitmap.installPixels(info, const_cast<void*>(addr),
rowBytes)) { | 49 if (addr && bitmap.installPixels(info, const_cast<void*>(addr),
rowBytes)) { |
| 50 canvas->drawBitmap(bitmap, 0, 0, NULL); | 50 canvas->drawBitmap(bitmap, 0, 0, nullptr); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 // test ROCanvasPixels | 54 // test ROCanvasPixels |
| 55 canvas->translate(120, 0); | 55 canvas->translate(120, 0); |
| 56 SkAutoROCanvasPixels ropixels(surfCanvas); | 56 SkAutoROCanvasPixels ropixels(surfCanvas); |
| 57 if (ropixels.asROBitmap(&bitmap)) { | 57 if (ropixels.asROBitmap(&bitmap)) { |
| 58 canvas->drawBitmap(bitmap, 0, 0, NULL); | 58 canvas->drawBitmap(bitmap, 0, 0, nullptr); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // test Surface | 61 // test Surface |
| 62 canvas->translate(120, 0); | 62 canvas->translate(120, 0); |
| 63 surface->draw(canvas, 0, 0, NULL); | 63 surface->draw(canvas, 0, 0, nullptr); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 typedef skiagm::GM INHERITED; | 68 typedef skiagm::GM INHERITED; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 DEF_GM(return new PeekPixelsGM;) | 71 DEF_GM(return new PeekPixelsGM;) |
| OLD | NEW |