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

Side by Side Diff: gm/gamma.cpp

Issue 2396953002: Revert[8] "replace SkXfermode obj with SkBlendMode enum in paints" (Closed)
Patch Set: add tmp virtual to unroll legacy arithmodes Created 4 years, 2 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/dstreadshuffle.cpp ('k') | gm/gm.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 2015 Google Inc. 2 * Copyright 2015 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 9
10 #include "Resources.h" 10 #include "Resources.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 advance(); 69 advance();
70 }; 70 };
71 71
72 auto nextBitmap = [&](const SkBitmap& bmp, const char* label) { 72 auto nextBitmap = [&](const SkBitmap& bmp, const char* label) {
73 canvas->drawBitmap(bmp, 0, 0); 73 canvas->drawBitmap(bmp, 0, 0);
74 canvas->drawText(label, strlen(label), 0, sz + textPaint.getFontSpacing( ), textPaint); 74 canvas->drawText(label, strlen(label), 0, sz + textPaint.getFontSpacing( ), textPaint);
75 advance(); 75 advance();
76 }; 76 };
77 77
78 auto nextXferRect = [&](SkColor srcColor, SkXfermode::Mode mode, SkColor dst Color) { 78 auto nextXferRect = [&](SkColor srcColor, SkBlendMode mode, SkColor dstColor ) {
79 p.setColor(dstColor); 79 p.setColor(dstColor);
80 canvas->drawRect(r, p); 80 canvas->drawRect(r, p);
81 p.setColor(srcColor); 81 p.setColor(srcColor);
82 p.setXfermodeMode(mode); 82 p.setBlendMode(mode);
83 canvas->drawRect(r, p); 83 canvas->drawRect(r, p);
84 84
85 SkString srcText = SkStringPrintf("%08X", srcColor); 85 SkString srcText = SkStringPrintf("%08X", srcColor);
86 SkString dstText = SkStringPrintf("%08X", dstColor); 86 SkString dstText = SkStringPrintf("%08X", dstColor);
87 canvas->drawText(srcText.c_str(), srcText.size(), 0, sz + textPaint.getF ontSpacing(), 87 canvas->drawText(srcText.c_str(), srcText.size(), 0, sz + textPaint.getF ontSpacing(),
88 textPaint); 88 textPaint);
89 const char* modeName = SkXfermode::ModeName(mode); 89 const char* modeName = SkXfermode::ModeName(mode);
90 canvas->drawText(modeName, strlen(modeName), 0, sz + 2 * textPaint.getFo ntSpacing(), 90 canvas->drawText(modeName, strlen(modeName), 0, sz + 2 * textPaint.getFo ntSpacing(),
91 textPaint); 91 textPaint);
92 canvas->drawText(dstText.c_str(), dstText.size(), 0, sz + 3 * textPaint. getFontSpacing(), 92 canvas->drawText(dstText.c_str(), dstText.size(), 0, sz + 3 * textPaint. getFontSpacing(),
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 nextRect("sRGB BMP", "Shader"); 200 nextRect("sRGB BMP", "Shader");
201 201
202 // Carriage return. 202 // Carriage return.
203 canvas->restore(); 203 canvas->restore();
204 canvas->translate(0, 2 * sz); 204 canvas->translate(0, 2 * sz);
205 205
206 // Xfermode tests, all done off-screen so certain modes work... 206 // Xfermode tests, all done off-screen so certain modes work...
207 207
208 canvas->saveLayer(nullptr, nullptr); 208 canvas->saveLayer(nullptr, nullptr);
209 209
210 nextXferRect(0x7fffffff, SkXfermode::kSrcOver_Mode, SK_ColorBLACK); 210 nextXferRect(0x7fffffff, SkBlendMode::kSrcOver, SK_ColorBLACK);
211 nextXferRect(0x7f000000, SkXfermode::kSrcOver_Mode, SK_ColorWHITE); 211 nextXferRect(0x7f000000, SkBlendMode::kSrcOver, SK_ColorWHITE);
212 212
213 nextXferRect(SK_ColorBLACK, SkXfermode::kDstOver_Mode, 0x7fffffff); 213 nextXferRect(SK_ColorBLACK, SkBlendMode::kDstOver, 0x7fffffff);
214 nextXferRect(SK_ColorWHITE, SkXfermode::kSrcIn_Mode, 0x7fff00ff); 214 nextXferRect(SK_ColorWHITE, SkBlendMode::kSrcIn, 0x7fff00ff);
215 nextXferRect(0x7fff00ff, SkXfermode::kDstIn_Mode, SK_ColorWHITE); 215 nextXferRect(0x7fff00ff, SkBlendMode::kDstIn, SK_ColorWHITE);
216 216
217 // 0x89 = 255 * linear_to_srgb(0.25) 217 // 0x89 = 255 * linear_to_srgb(0.25)
218 nextXferRect(0xff898989, SkXfermode::kPlus_Mode, 0xff898989); 218 nextXferRect(0xff898989, SkBlendMode::kPlus, 0xff898989);
219 219
220 // 0xDB = 255 * linear_to_srgb(sqrt(0.5)) 220 // 0xDB = 255 * linear_to_srgb(sqrt(0.5))
221 nextXferRect(0xffdbdbdb, SkXfermode::kModulate_Mode, 0xffdbdbdb); 221 nextXferRect(0xffdbdbdb, SkBlendMode::kModulate, 0xffdbdbdb);
222 222
223 canvas->restore(); 223 canvas->restore();
224 } 224 }
OLDNEW
« no previous file with comments | « gm/dstreadshuffle.cpp ('k') | gm/gm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698