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 "SkGradientShader.h" | 9 #include "SkGradientShader.h" |
10 #include "SkPatchUtils.h" | 10 #include "SkPatchUtils.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 paint.setColor(SK_ColorCYAN); | 56 paint.setColor(SK_ColorCYAN); |
57 canvas->drawPoints(SkCanvas::kPoints_PointMode, 2, top + 1, paint); | 57 canvas->drawPoints(SkCanvas::kPoints_PointMode, 2, top + 1, paint); |
58 | 58 |
59 paint.setColor(SK_ColorYELLOW); | 59 paint.setColor(SK_ColorYELLOW); |
60 canvas->drawPoints(SkCanvas::kPoints_PointMode, 2, left + 1, paint); | 60 canvas->drawPoints(SkCanvas::kPoints_PointMode, 2, left + 1, paint); |
61 | 61 |
62 paint.setColor(SK_ColorGREEN); | 62 paint.setColor(SK_ColorGREEN); |
63 canvas->drawPoints(SkCanvas::kPoints_PointMode, 2, right + 1, paint); | 63 canvas->drawPoints(SkCanvas::kPoints_PointMode, 2, right + 1, paint); |
64 } | 64 } |
65 | 65 |
66 DEF_SIMPLE_GM(patch_primitive, canvas, 800, 800) { | 66 DEF_SIMPLE_GM(patch_primitive, canvas, 1500, 1100) { |
67 SkPaint paint; | 67 SkPaint paint; |
68 | 68 |
69 // The order of the colors and points is clockwise starting at upper-lef
t corner. | 69 // The order of the colors and points is clockwise starting at upper-lef
t corner. |
70 const SkPoint cubics[SkPatchUtils::kNumCtrlPts] = { | 70 const SkPoint cubics[SkPatchUtils::kNumCtrlPts] = { |
71 //top points | 71 //top points |
72 {100,100},{150,50},{250,150}, {300,100}, | 72 {100,100},{150,50},{250,150}, {300,100}, |
73 //right points | 73 //right points |
74 {250, 150},{350,250}, | 74 {250, 150},{350,250}, |
75 //bottom points | 75 //bottom points |
76 {300,300},{250,250},{150,350},{100,300}, | 76 {300,300},{250,250},{150,350},{100,300}, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 default: | 120 default: |
121 break; | 121 break; |
122 } | 122 } |
123 | 123 |
124 draw_control_points(canvas, cubics); | 124 draw_control_points(canvas, cubics); |
125 canvas->restore(); | 125 canvas->restore(); |
126 } | 126 } |
127 } | 127 } |
128 canvas->restore(); | 128 canvas->restore(); |
129 } | 129 } |
OLD | NEW |