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