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

Side by Side Diff: gm/simpleaaclip.cpp

Issue 1182403003: Revert of Revert of make gm background colors 565 compatible (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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 | « gm/shadows.cpp ('k') | gm/tinybitmap.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8
9 #include "gm.h" 9 #include "gm.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 fBase.set(100.65f, 57 fBase.set(100.65f,
58 100.65f, 58 100.65f,
59 150.65f, 59 150.65f,
60 150.65f); 60 150.65f);
61 fRect = fBase; 61 fRect = fBase;
62 fRect.inset(5, 5); 62 fRect.inset(5, 5);
63 fRect.offset(25, 25); 63 fRect.offset(25, 25);
64 64
65 fBasePath.addRoundRect(fBase, SkIntToScalar(5), SkIntToScalar(5)); 65 fBasePath.addRoundRect(fBase, SkIntToScalar(5), SkIntToScalar(5));
66 fRectPath.addRoundRect(fRect, SkIntToScalar(5), SkIntToScalar(5)); 66 fRectPath.addRoundRect(fRect, SkIntToScalar(5), SkIntToScalar(5));
67 INHERITED::setBGColor(0xFFDDDDDD); 67 INHERITED::setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD));
68 } 68 }
69 69
70 void buildRgn(SkAAClip* clip, SkRegion::Op op) { 70 void buildRgn(SkAAClip* clip, SkRegion::Op op) {
71 clip->setPath(fBasePath, NULL, true); 71 clip->setPath(fBasePath, NULL, true);
72 72
73 SkAAClip clip2; 73 SkAAClip clip2;
74 clip2.setPath(fRectPath, NULL, true); 74 clip2.setPath(fRectPath, NULL, true);
75 clip->op(clip2, op); 75 clip->op(clip2, op);
76 } 76 }
77 77
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 { SK_ColorBLACK, "Difference", SkRegion::kDifference_Op }, 149 { SK_ColorBLACK, "Difference", SkRegion::kDifference_Op },
150 { SK_ColorRED, "Intersect", SkRegion::kIntersect_Op }, 150 { SK_ColorRED, "Intersect", SkRegion::kIntersect_Op },
151 { 0xFF008800, "Union", SkRegion::kUnion_Op }, 151 { 0xFF008800, "Union", SkRegion::kUnion_Op },
152 { SK_ColorGREEN, "Rev Diff", SkRegion::kReverseDifference_Op }, 152 { SK_ColorGREEN, "Rev Diff", SkRegion::kReverseDifference_Op },
153 { SK_ColorYELLOW, "Replace", SkRegion::kReplace_Op }, 153 { SK_ColorYELLOW, "Replace", SkRegion::kReplace_Op },
154 { SK_ColorBLUE, "XOR", SkRegion::kXOR_Op }, 154 { SK_ColorBLUE, "XOR", SkRegion::kXOR_Op },
155 }; 155 };
156 156
157 SkPaint textPaint; 157 SkPaint textPaint;
158 textPaint.setAntiAlias(true); 158 textPaint.setAntiAlias(true);
159 sk_tool_utils::set_portable_typeface(&textPaint); 159 sk_tool_utils::set_portable_typeface_always(&textPaint);
160 textPaint.setTextSize(SK_Scalar1*24); 160 textPaint.setTextSize(SK_Scalar1*24);
161 int xOff = 0; 161 int xOff = 0;
162 162
163 for (size_t op = 0; op < SK_ARRAY_COUNT(gOps); op++) { 163 for (size_t op = 0; op < SK_ARRAY_COUNT(gOps); op++) {
164 canvas->drawText(gOps[op].fName, strlen(gOps[op].fName), 164 canvas->drawText(gOps[op].fName, strlen(gOps[op].fName),
165 SkIntToScalar(75), SkIntToScalar(50), 165 SkIntToScalar(75), SkIntToScalar(50),
166 textPaint); 166 textPaint);
167 167
168 if (kAAClip_GeomType == fGeomType) { 168 if (kAAClip_GeomType == fGeomType) {
169 this->drawRgnOped(canvas, gOps[op].fOp, gOps[op].fColor); 169 this->drawRgnOped(canvas, gOps[op].fOp, gOps[op].fColor);
(...skipping 24 matching lines...) Expand all
194 }; 194 };
195 195
196 ////////////////////////////////////////////////////////////////////////////// 196 //////////////////////////////////////////////////////////////////////////////
197 197
198 // rects 198 // rects
199 DEF_GM( return new SimpleClipGM(SimpleClipGM::kRect_GeomType); ) 199 DEF_GM( return new SimpleClipGM(SimpleClipGM::kRect_GeomType); )
200 DEF_GM( return new SimpleClipGM(SimpleClipGM::kPath_GeomType); ) 200 DEF_GM( return new SimpleClipGM(SimpleClipGM::kPath_GeomType); )
201 DEF_GM( return new SimpleClipGM(SimpleClipGM::kAAClip_GeomType); ) 201 DEF_GM( return new SimpleClipGM(SimpleClipGM::kAAClip_GeomType); )
202 202
203 } 203 }
OLDNEW
« no previous file with comments | « gm/shadows.cpp ('k') | gm/tinybitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698