| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkColorShader.h" | 10 #include "SkColorShader.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 39 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 40 GrContext* context = canvas->getGrContext(); | 40 GrContext* context = canvas->getGrContext(); |
| 41 if (NULL == context) { | 41 if (NULL == context) { |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 | 44 |
| 45 SkISize size = this->getISize(); | 45 SkISize size = this->getISize(); |
| 46 size.fWidth /= 10; | 46 size.fWidth /= 10; |
| 47 size.fHeight /= 10; | 47 size.fHeight /= 10; |
| 48 SkImageInfo info = SkImageInfo::MakeN32Premul(size); | 48 SkImageInfo info = SkImageInfo::MakeN32Premul(size); |
| 49 SkSurface* surface = SkSurface::NewRenderTarget(context, info); | 49 SkSurface* surface = SkSurface::NewRenderTarget(context, SkSurface::kNo_
Budgeted, info); |
| 50 | 50 |
| 51 if (NULL == surface) { | 51 if (NULL == surface) { |
| 52 return; | 52 return; |
| 53 } | 53 } |
| 54 | 54 |
| 55 canvas->clear(SK_ColorBLACK); | 55 canvas->clear(SK_ColorBLACK); |
| 56 | 56 |
| 57 SkRandom rand; | 57 SkRandom rand; |
| 58 for (int x = 0; x < 10; ++x) { | 58 for (int x = 0; x < 10; ++x) { |
| 59 for (int y = 0; y < 10; ++y) { | 59 for (int y = 0; y < 10; ++y) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 86 typedef GM INHERITED; | 86 typedef GM INHERITED; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 ////////////////////////////////////////////////////////////////////////////// | 89 ////////////////////////////////////////////////////////////////////////////// |
| 90 | 90 |
| 91 DEF_GM( return SkNEW(DiscardGM); ) | 91 DEF_GM( return SkNEW(DiscardGM); ) |
| 92 | 92 |
| 93 } // end namespace | 93 } // end namespace |
| 94 | 94 |
| 95 #endif | 95 #endif |
| OLD | NEW |