| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 canvas->translate(SK_Scalar1 / 5, SK_Scalar1 / 5); | 99 canvas->translate(SK_Scalar1 / 5, SK_Scalar1 / 5); |
| 100 canvas->translate(SkIntToScalar(50), 0); | 100 canvas->translate(SkIntToScalar(50), 0); |
| 101 draw_rect_tests(canvas); | 101 draw_rect_tests(canvas); |
| 102 } | 102 } |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 typedef skiagm::GM INHERITED; | 105 typedef skiagm::GM INHERITED; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 DEF_GM( return SkNEW(AAClipGM); ) | 108 DEF_GM(return new AAClipGM;) |
| 109 | 109 |
| 110 ///////////////////////////////////////////////////////////////////////// | 110 ///////////////////////////////////////////////////////////////////////// |
| 111 | 111 |
| 112 #ifdef SK_BUILD_FOR_MAC | 112 #ifdef SK_BUILD_FOR_MAC |
| 113 | 113 |
| 114 static SkCanvas* make_canvas(const SkBitmap& bm) { | 114 static SkCanvas* make_canvas(const SkBitmap& bm) { |
| 115 const SkImageInfo& info = bm.info(); | 115 const SkImageInfo& info = bm.info(); |
| 116 if (info.bytesPerPixel() == 4) { | 116 if (info.bytesPerPixel() == 4) { |
| 117 return SkCanvas::NewRasterDirectN32(info.width(), info.height(), | 117 return SkCanvas::NewRasterDirectN32(info.width(), info.height(), |
| 118 (SkPMColor*)bm.getPixels(), | 118 (SkPMColor*)bm.getPixels(), |
| 119 bm.rowBytes()); | 119 bm.rowBytes()); |
| 120 } else { | 120 } else { |
| 121 return SkNEW_ARGS(SkCanvas, (bm)); | 121 return new SkCanvas(bm); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 #include "SkCGUtils.h" | 125 #include "SkCGUtils.h" |
| 126 static void test_image(SkCanvas* canvas, const SkImageInfo& info) { | 126 static void test_image(SkCanvas* canvas, const SkImageInfo& info) { |
| 127 SkBitmap bm; | 127 SkBitmap bm; |
| 128 bm.allocPixels(info); | 128 bm.allocPixels(info); |
| 129 | 129 |
| 130 SkAutoTUnref<SkCanvas> newc(make_canvas(bm)); | 130 SkAutoTUnref<SkCanvas> newc(make_canvas(bm)); |
| 131 if (info.isOpaque()) { | 131 if (info.isOpaque()) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 test_image(canvas, info); | 183 test_image(canvas, info); |
| 184 canvas->translate(info.width() + 10, 0); | 184 canvas->translate(info.width() + 10, 0); |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 | 187 |
| 188 private: | 188 private: |
| 189 typedef skiagm::GM INHERITED; | 189 typedef skiagm::GM INHERITED; |
| 190 }; | 190 }; |
| 191 | 191 |
| 192 #if 0 // Disabled pending fix from reed@ | 192 #if 0 // Disabled pending fix from reed@ |
| 193 DEF_GM( return SkNEW(CGImageGM); ) | 193 DEF_GM( return new CGImageGM; ) |
| 194 #endif | 194 #endif |
| 195 #endif | 195 #endif |
| 196 | 196 |
| 197 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 197 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 198 | 198 |
| 199 // skbug.com/3716 | 199 // skbug.com/3716 |
| 200 class ClipCubicGM : public skiagm::GM { | 200 class ClipCubicGM : public skiagm::GM { |
| 201 const SkScalar W = 100; | 201 const SkScalar W = 100; |
| 202 const SkScalar H = 240; | 202 const SkScalar H = 240; |
| 203 | 203 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 void onDraw(SkCanvas* canvas) override { | 253 void onDraw(SkCanvas* canvas) override { |
| 254 canvas->translate(80, 10); | 254 canvas->translate(80, 10); |
| 255 this->drawAndClip(canvas, fVPath, 200, 0); | 255 this->drawAndClip(canvas, fVPath, 200, 0); |
| 256 canvas->translate(0, 200); | 256 canvas->translate(0, 200); |
| 257 this->drawAndClip(canvas, fHPath, 200, 0); | 257 this->drawAndClip(canvas, fHPath, 200, 0); |
| 258 } | 258 } |
| 259 | 259 |
| 260 private: | 260 private: |
| 261 typedef skiagm::GM INHERITED; | 261 typedef skiagm::GM INHERITED; |
| 262 }; | 262 }; |
| 263 DEF_GM( return SkNEW(ClipCubicGM); ) | 263 DEF_GM(return new ClipCubicGM;) |
| 264 | |
| OLD | NEW |