Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: gm/patch.cpp

Issue 429343004: Stopped skipping tests in dm of SkPatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added number of points and colors constants Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | include/core/SkCanvas.h » ('j') | src/utils/SkDumpCanvas.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 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 8
9 // This test only works with the GPU backend. 9 // This test only works with the GPU backend.
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 copy.setColor(SK_ColorYELLOW); 55 copy.setColor(SK_ColorYELLOW);
56 canvas->drawPoints(SkCanvas::kPoints_PointMode, 2, left+1, copy); 56 canvas->drawPoints(SkCanvas::kPoints_PointMode, 2, left+1, copy);
57 57
58 copy.setColor(SK_ColorGREEN); 58 copy.setColor(SK_ColorGREEN);
59 canvas->drawPoints(SkCanvas::kPoints_PointMode, 2, right+1, copy); 59 canvas->drawPoints(SkCanvas::kPoints_PointMode, 2, right+1, copy);
60 } 60 }
61 61
62 static void draw_random_patch(SkPoint points[12], SkColor colors[4], SkCanvas* c anvas, 62 static void draw_random_patch(SkPoint points[12], SkColor colors[4], SkCanvas* c anvas,
63 SkPaint& paint, SkRandom* rnd) { 63 SkPaint& paint, SkRandom* rnd) {
64 SkPoint ptsCpy[12]; 64 SkPoint ptsCpy[12];
mtklein 2014/08/04 20:40:47 Seems like we still have many 12's and 4's. It's
dandov 2014/08/04 21:47:54 I think I fixed all of the 12's and 4's that are r
65 memcpy(ptsCpy, points, 12 * sizeof(SkPoint)); 65 memcpy(ptsCpy, points, SkPatch::kNumCtrlPts * sizeof(SkPoint));
66 for (int i = 0; i < 5; i++) { 66 for (int i = 0; i < 5; i++) {
67 int index = rnd->nextRangeU(0, 11); 67 int index = rnd->nextRangeU(0, 11);
68 SkScalar dx = rnd->nextRangeScalar(-50, 50), dy = rnd->nextRangeScalar(- 50, 50); 68 SkScalar dx = rnd->nextRangeScalar(-50, 50), dy = rnd->nextRangeScalar(- 50, 50);
69 ptsCpy[index].offset(dx, dy); 69 ptsCpy[index].offset(dx, dy);
70 } 70 }
71 SkPatch patch(ptsCpy, colors); 71 SkPatch patch(ptsCpy, colors);
72 canvas->drawPatch(patch, paint); 72 canvas->drawPatch(patch, paint);
73 draw_control_points(canvas, patch, paint); 73 draw_control_points(canvas, patch, paint);
74 } 74 }
75 75
(...skipping 11 matching lines...) Expand all
87 protected: 87 protected:
88 virtual SkString onShortName() SK_OVERRIDE { 88 virtual SkString onShortName() SK_OVERRIDE {
89 return SkString("patch_primitive"); 89 return SkString("patch_primitive");
90 } 90 }
91 91
92 virtual SkISize onISize() SK_OVERRIDE { 92 virtual SkISize onISize() SK_OVERRIDE {
93 return SkISize::Make(800, 800); 93 return SkISize::Make(800, 800);
94 } 94 }
95 95
96 virtual uint32_t onGetFlags() const SK_OVERRIDE { 96 virtual uint32_t onGetFlags() const SK_OVERRIDE {
97 return kSkipTiled_Flag | kSkipPipe_Flag | kSkipPicture_Flag; 97 return kSkipTiled_Flag;
98 } 98 }
99 99
100 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 100 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
101 101
102 SkPaint paint; 102 SkPaint paint;
103 SkColor colors[4] = { 103 SkColor colors[4] = {
104 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorCYAN 104 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorCYAN
105 }; 105 };
106 SkPoint points[12] = { 106 SkPoint points[12] = {
107 {50,50},{75,20},{125,80}, {150,50}, 107 {50,50},{75,20},{125,80}, {150,50},
(...skipping 27 matching lines...) Expand all
135 135
136 private: 136 private:
137 typedef GM INHERITED; 137 typedef GM INHERITED;
138 }; 138 };
139 139
140 DEF_GM(return SkNEW(SkPatchGM); ) 140 DEF_GM(return SkNEW(SkPatchGM); )
141 141
142 } 142 }
143 143
144 #endif 144 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkCanvas.h » ('j') | src/utils/SkDumpCanvas.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698