| 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 11 matching lines...) Expand all Loading... |
| 22 class PeekPixelsGM : public skiagm::GM { | 22 class PeekPixelsGM : public skiagm::GM { |
| 23 public: | 23 public: |
| 24 PeekPixelsGM() {} | 24 PeekPixelsGM() {} |
| 25 | 25 |
| 26 protected: | 26 protected: |
| 27 virtual SkString onShortName() SK_OVERRIDE { | 27 virtual SkString onShortName() SK_OVERRIDE { |
| 28 return SkString("peekpixels"); | 28 return SkString("peekpixels"); |
| 29 } | 29 } |
| 30 | 30 |
| 31 virtual SkISize onISize() SK_OVERRIDE { | 31 virtual SkISize onISize() SK_OVERRIDE { |
| 32 return SkISize::Make(640, 480); | 32 return SkISize::Make(360, 120); |
| 33 } | 33 } |
| 34 | 34 |
| 35 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 35 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 36 SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100); | 36 SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100); |
| 37 SkAutoTUnref<SkSurface> surface(canvas->newSurface(info)); | 37 SkAutoTUnref<SkSurface> surface(canvas->newSurface(info)); |
| 38 if (surface.get()) { | 38 if (surface.get()) { |
| 39 SkCanvas* surfCanvas = surface->getCanvas(); | 39 SkCanvas* surfCanvas = surface->getCanvas(); |
| 40 | 40 |
| 41 draw_content(surfCanvas); | 41 draw_content(surfCanvas); |
| 42 SkBitmap bitmap; | 42 SkBitmap bitmap; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 69 // we explicitly test peekPixels and readPixels, neither of which | 69 // we explicitly test peekPixels and readPixels, neither of which |
| 70 // return something for a picture-backed canvas, so we skip that test. | 70 // return something for a picture-backed canvas, so we skip that test. |
| 71 return kSkipPicture_Flag; | 71 return kSkipPicture_Flag; |
| 72 } | 72 } |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 typedef skiagm::GM INHERITED; | 75 typedef skiagm::GM INHERITED; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 DEF_GM( return SkNEW(PeekPixelsGM); ) | 78 DEF_GM( return SkNEW(PeekPixelsGM); ) |
| OLD | NEW |