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

Side by Side Diff: gm/gamma.cpp

Issue 1917303002: Remove unmatched restore call in gamma GM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 | no next file » | 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 textPaint); 77 textPaint);
78 canvas->drawText(dstText.c_str(), dstText.size(), 0, sz + 3 * textPaint. getFontSpacing(), 78 canvas->drawText(dstText.c_str(), dstText.size(), 0, sz + 3 * textPaint. getFontSpacing(),
79 textPaint); 79 textPaint);
80 advance(); 80 advance();
81 }; 81 };
82 82
83 // Necessary for certain Xfermode tests to work (ie some of them output whit e @ 50% alpha): 83 // Necessary for certain Xfermode tests to work (ie some of them output whit e @ 50% alpha):
84 canvas->clear(SK_ColorBLACK); 84 canvas->clear(SK_ColorBLACK);
85 85
86 // *Everything* should be perceptually 50% grey. Only the first rectangle 86 // *Everything* should be perceptually 50% grey. Only the first rectangle
87 // is guaranteed to draw that way, though. 87 // is guaranteed to draw that way, though.
robertphillips 2016/04/26 21:27:53 Doesn't it match this save ?
88 canvas->save(); 88 canvas->save();
89 89
90 // Black/white dither, pixel perfect. This is ground truth. 90 // Black/white dither, pixel perfect. This is ground truth.
91 p.setShader(SkShader::MakeBitmapShader(ditherBmp, rpt, rpt)); 91 p.setShader(SkShader::MakeBitmapShader(ditherBmp, rpt, rpt));
92 p.setFilterQuality(SkFilterQuality::kNone_SkFilterQuality); 92 p.setFilterQuality(SkFilterQuality::kNone_SkFilterQuality);
93 nextRect("Dither", "Reference"); 93 nextRect("Dither", "Reference");
94 94
95 // Black/white dither, sampled at half-texel offset. Tests bilerp. 95 // Black/white dither, sampled at half-texel offset. Tests bilerp.
96 // NOTE: We need to apply a non-identity scale and/or rotation to trick 96 // NOTE: We need to apply a non-identity scale and/or rotation to trick
97 // the raster pipeline into *not* snapping to nearest. 97 // the raster pipeline into *not* snapping to nearest.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 p.setShader(SkShader::MakeBitmapShader(linearGreyBmp, rpt, rpt)); 132 p.setShader(SkShader::MakeBitmapShader(linearGreyBmp, rpt, rpt));
133 p.setFilterQuality(SkFilterQuality::kMedium_SkFilterQuality); 133 p.setFilterQuality(SkFilterQuality::kMedium_SkFilterQuality);
134 nextRect("Lnr BMP", "Shader"); 134 nextRect("Lnr BMP", "Shader");
135 135
136 // Bitmap wrapped in a shader (sRGB): 136 // Bitmap wrapped in a shader (sRGB):
137 p.setShader(SkShader::MakeBitmapShader(srgbGreyBmp, rpt, rpt)); 137 p.setShader(SkShader::MakeBitmapShader(srgbGreyBmp, rpt, rpt));
138 p.setFilterQuality(SkFilterQuality::kMedium_SkFilterQuality); 138 p.setFilterQuality(SkFilterQuality::kMedium_SkFilterQuality);
139 nextRect("sRGB BMP", "Shader"); 139 nextRect("sRGB BMP", "Shader");
140 140
141 // Carriage return. 141 // Carriage return.
142 canvas->restore(); 142 canvas->restore();
Brian Osman 2016/04/26 21:31:20 Nope, this one does.
143 canvas->translate(0, 2 * sz); 143 canvas->translate(0, 2 * sz);
144 144
145 const U8CPU sqrtHalf = 0xB4; 145 const U8CPU sqrtHalf = 0xB4;
146 const SkColor sqrtHalfAlpha = SkColorSetARGB(sqrtHalf, 0, 0, 0); 146 const SkColor sqrtHalfAlpha = SkColorSetARGB(sqrtHalf, 0, 0, 0);
147 const SkColor sqrtHalfWhite = SkColorSetARGB(0xFF, sqrtHalf, sqrtHalf, sqrtH alf); 147 const SkColor sqrtHalfWhite = SkColorSetARGB(0xFF, sqrtHalf, sqrtHalf, sqrtH alf);
148 148
149 // Xfermode tests, all done off-screen so certain modes work... 149 // Xfermode tests, all done off-screen so certain modes work...
150 150
151 canvas->saveLayer(nullptr, nullptr); 151 canvas->saveLayer(nullptr, nullptr);
152 152
153 nextXferRect(0x7fffffff, SkXfermode::kSrcOver_Mode, SK_ColorBLACK); 153 nextXferRect(0x7fffffff, SkXfermode::kSrcOver_Mode, SK_ColorBLACK);
154 nextXferRect(0x7f000000, SkXfermode::kSrcOver_Mode, SK_ColorWHITE); 154 nextXferRect(0x7f000000, SkXfermode::kSrcOver_Mode, SK_ColorWHITE);
155 155
156 nextXferRect(SK_ColorBLACK, SkXfermode::kDstOver_Mode, 0x7fffffff); 156 nextXferRect(SK_ColorBLACK, SkXfermode::kDstOver_Mode, 0x7fffffff);
157 nextXferRect(SK_ColorWHITE, SkXfermode::kSrcIn_Mode, 0x7fff00ff); 157 nextXferRect(SK_ColorWHITE, SkXfermode::kSrcIn_Mode, 0x7fff00ff);
158 nextXferRect(0x7fff00ff, SkXfermode::kDstIn_Mode, SK_ColorWHITE); 158 nextXferRect(0x7fff00ff, SkXfermode::kDstIn_Mode, SK_ColorWHITE);
159 nextXferRect(sqrtHalfWhite, SkXfermode::kSrcIn_Mode, sqrtHalfAlpha); 159 nextXferRect(sqrtHalfWhite, SkXfermode::kSrcIn_Mode, sqrtHalfAlpha);
160 nextXferRect(sqrtHalfAlpha, SkXfermode::kDstIn_Mode, sqrtHalfWhite); 160 nextXferRect(sqrtHalfAlpha, SkXfermode::kDstIn_Mode, sqrtHalfWhite);
161 161
162 nextXferRect(0xff3f3f3f, SkXfermode::kPlus_Mode, 0xff3f3f3f); 162 nextXferRect(0xff3f3f3f, SkXfermode::kPlus_Mode, 0xff3f3f3f);
163 nextXferRect(sqrtHalfWhite, SkXfermode::kModulate_Mode, sqrtHalfWhite); 163 nextXferRect(sqrtHalfWhite, SkXfermode::kModulate_Mode, sqrtHalfWhite);
164 164
165 canvas->restore(); 165 canvas->restore();
166
167 canvas->restore();
168 } 166 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698