| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkBlurMask.h" | 10 #include "SkBlurMask.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 canvas->translate(0, SkIntToScalar(20)); | 100 canvas->translate(0, SkIntToScalar(20)); |
| 101 canvas->drawBitmapMatrix(bm, matrix, &paint); | 101 canvas->drawBitmapMatrix(bm, matrix, &paint); |
| 102 canvas->restore(); | 102 canvas->restore(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } | 105 } |
| 106 private: | 106 private: |
| 107 void setupBitmap(SkBitmap* bm) { | 107 void setupBitmap(SkBitmap* bm) { |
| 108 SkASSERT(bm); | 108 SkASSERT(bm); |
| 109 static const int SIZE = 64; | 109 static const int SIZE = 64; |
| 110 bm->setConfig(SkBitmap::kARGB_8888_Config, SIZE, SIZE); | 110 bm->allocN32Pixels(SIZE, SIZE); |
| 111 bm->allocPixels(); | |
| 112 SkCanvas canvas(*bm); | 111 SkCanvas canvas(*bm); |
| 113 | 112 |
| 114 SkPaint paint; | 113 SkPaint paint; |
| 115 paint.setColor(SK_ColorGREEN); | 114 paint.setColor(SK_ColorGREEN); |
| 116 canvas.drawPaint(paint); | 115 canvas.drawPaint(paint); |
| 117 | 116 |
| 118 paint.setColor(SK_ColorBLUE); | 117 paint.setColor(SK_ColorBLUE); |
| 119 paint.setAntiAlias(true); | 118 paint.setAntiAlias(true); |
| 120 SkRect rect = SkRect::MakeWH(SkIntToScalar(SIZE), SkIntToScalar(SIZE)); | 119 SkRect rect = SkRect::MakeWH(SkIntToScalar(SIZE), SkIntToScalar(SIZE)); |
| 121 SkPath path; | 120 SkPath path; |
| 122 path.addOval(rect); | 121 path.addOval(rect); |
| 123 canvas.drawPath(path, paint); | 122 canvas.drawPath(path, paint); |
| 124 } | 123 } |
| 125 }; | 124 }; |
| 126 | 125 |
| 127 //////////////////////////////////////////////////////////////////////////////// | 126 //////////////////////////////////////////////////////////////////////////////// |
| 128 | 127 |
| 129 static GM* MyFactory(void*) { return new DrawBitmapMatrixGM; } | 128 static GM* MyFactory(void*) { return new DrawBitmapMatrixGM; } |
| 130 static GMRegistry reg(MyFactory); | 129 static GMRegistry reg(MyFactory); |
| 131 | 130 |
| 132 } | 131 } |
| OLD | NEW |