| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkLightingImageFilter.h" | 9 #include "SkLightingImageFilter.h" |
| 10 #include "SkOffsetImageFilter.h" | 10 #include "SkOffsetImageFilter.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 SkIntToScalar(fBitmap.width()), SkIntToScalar(fBitmap.height()))); | 51 SkIntToScalar(fBitmap.width()), SkIntToScalar(fBitmap.height()))); |
| 52 canvas->drawBitmap(fBitmap, 0, 0, &paint); | 52 canvas->drawBitmap(fBitmap, 0, 0, &paint); |
| 53 canvas->restore(); | 53 canvas->restore(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void onDraw(SkCanvas* canvas) override { | 56 void onDraw(SkCanvas* canvas) override { |
| 57 if (!fInitialized) { | 57 if (!fInitialized) { |
| 58 make_bitmap(); | 58 make_bitmap(); |
| 59 fInitialized = true; | 59 fInitialized = true; |
| 60 } | 60 } |
| 61 canvas->clear(0xFF101010); | 61 canvas->clear(sk_tool_utils::color_to_565(0xFF101010)); |
| 62 SkPaint checkPaint; | 62 SkPaint checkPaint; |
| 63 checkPaint.setColor(0xFF202020); | 63 checkPaint.setColor(sk_tool_utils::color_to_565(0xFF202020)); |
| 64 for (int y = 0; y < HEIGHT; y += 16) { | 64 for (int y = 0; y < HEIGHT; y += 16) { |
| 65 for (int x = 0; x < WIDTH; x += 16) { | 65 for (int x = 0; x < WIDTH; x += 16) { |
| 66 canvas->save(); | 66 canvas->save(); |
| 67 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); | 67 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); |
| 68 canvas->drawRect(SkRect::MakeXYWH(8, 0, 8, 8), checkPaint); | 68 canvas->drawRect(SkRect::MakeXYWH(8, 0, 8, 8), checkPaint); |
| 69 canvas->drawRect(SkRect::MakeXYWH(0, 8, 8, 8), checkPaint); | 69 canvas->drawRect(SkRect::MakeXYWH(0, 8, 8, 8), checkPaint); |
| 70 canvas->restore(); | 70 canvas->restore(); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 SkPoint3 pointLocation = SkPoint3::Make(0, 0, SkIntToScalar(10)); | 73 SkPoint3 pointLocation = SkPoint3::Make(0, 0, SkIntToScalar(10)); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 SkBitmap fBitmap; | 167 SkBitmap fBitmap; |
| 168 bool fInitialized; | 168 bool fInitialized; |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 ////////////////////////////////////////////////////////////////////////////// | 171 ////////////////////////////////////////////////////////////////////////////// |
| 172 | 172 |
| 173 static GM* MyFactory(void*) { return new ImageLightingGM; } | 173 static GM* MyFactory(void*) { return new ImageLightingGM; } |
| 174 static GMRegistry reg(MyFactory); | 174 static GMRegistry reg(MyFactory); |
| 175 | 175 |
| 176 } | 176 } |
| OLD | NEW |