| 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 "SkData.h" | 9 #include "SkData.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 typedef skiagm::GM INHERITED; | 192 typedef skiagm::GM INHERITED; |
| 193 }; | 193 }; |
| 194 DEF_GM( return new ImageGM; ) | 194 DEF_GM( return new ImageGM; ) |
| 195 | 195 |
| 196 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 196 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 197 | 197 |
| 198 #include "SkPictureRecorder.h" | 198 #include "SkPictureRecorder.h" |
| 199 | 199 |
| 200 static void draw_pixmap(SkCanvas* canvas, const SkPixmap& pmap) { | 200 static void draw_pixmap(SkCanvas* canvas, const SkPixmap& pmap) { |
| 201 SkBitmap bitmap; | 201 SkBitmap bitmap; |
| 202 bitmap.installPixels(pmap.info(), (void*)pmap.addr(), pmap.rowBytes()); | 202 bitmap.installPixels(pmap); |
| 203 canvas->drawBitmap(bitmap, 0, 0, nullptr); | 203 canvas->drawBitmap(bitmap, 0, 0, nullptr); |
| 204 } | 204 } |
| 205 | 205 |
| 206 static void show_scaled_pixels(SkCanvas* canvas, SkImage* image) { | 206 static void show_scaled_pixels(SkCanvas* canvas, SkImage* image) { |
| 207 SkAutoCanvasRestore acr(canvas, true); | 207 SkAutoCanvasRestore acr(canvas, true); |
| 208 | 208 |
| 209 canvas->drawImage(image, 0, 0, nullptr); | 209 canvas->drawImage(image, 0, 0, nullptr); |
| 210 canvas->translate(110, 10); | 210 canvas->translate(110, 10); |
| 211 | 211 |
| 212 const SkImageInfo info = SkImageInfo::MakeN32Premul(40, 40); | 212 const SkImageInfo info = SkImageInfo::MakeN32Premul(40, 40); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 show_scaled_generator(canvas, gen); | 422 show_scaled_generator(canvas, gen); |
| 423 } | 423 } |
| 424 canvas->translate(0, 120); | 424 canvas->translate(0, 120); |
| 425 } | 425 } |
| 426 } | 426 } |
| 427 | 427 |
| 428 private: | 428 private: |
| 429 typedef skiagm::GM INHERITED; | 429 typedef skiagm::GM INHERITED; |
| 430 }; | 430 }; |
| 431 DEF_GM( return new ScaleGeneratorGM; ) | 431 DEF_GM( return new ScaleGeneratorGM; ) |
| OLD | NEW |