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

Side by Side Diff: tests/PaintTest.cpp

Issue 1832223002: switch xfermodes over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "SkBlurMask.h" 8 #include "SkBlurMask.h"
9 #include "SkBlurMaskFilter.h" 9 #include "SkBlurMaskFilter.h"
10 #include "SkLayerDrawLooper.h" 10 #include "SkLayerDrawLooper.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 REPORTER_ASSERT(reporter, r.isEmpty()); 285 REPORTER_ASSERT(reporter, r.isEmpty());
286 } 286 }
287 287
288 #define ASSERT(expr) REPORTER_ASSERT(r, expr) 288 #define ASSERT(expr) REPORTER_ASSERT(r, expr)
289 289
290 DEF_TEST(Paint_MoreFlattening, r) { 290 DEF_TEST(Paint_MoreFlattening, r) {
291 SkPaint paint; 291 SkPaint paint;
292 paint.setColor(0x00AABBCC); 292 paint.setColor(0x00AABBCC);
293 paint.setTextScaleX(1.0f); // Default value, ignored. 293 paint.setTextScaleX(1.0f); // Default value, ignored.
294 paint.setTextSize(19); 294 paint.setTextSize(19);
295 paint.setXfermode(SkXfermode::Create(SkXfermode::kModulate_Mode))->unref(); 295 paint.setXfermode(SkXfermode::Make(SkXfermode::kModulate_Mode));
296 paint.setLooper(nullptr); // Default value, ignored. 296 paint.setLooper(nullptr); // Default value, ignored.
297 297
298 SkWriteBuffer writer; 298 SkWriteBuffer writer;
299 paint.flatten(writer); 299 paint.flatten(writer);
300 300
301 SkReadBuffer reader(writer.getWriter32()->contiguousArray(), writer.bytesWri tten()); 301 SkReadBuffer reader(writer.getWriter32()->contiguousArray(), writer.bytesWri tten());
302 SkPaint other; 302 SkPaint other;
303 other.unflatten(reader); 303 other.unflatten(reader);
304 ASSERT(reader.offset() == writer.bytesWritten()); 304 ASSERT(reader.offset() == writer.bytesWritten());
305 305
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 360
361 SkColorMatrix cm; 361 SkColorMatrix cm;
362 cm.setIdentity(); // does not change alpha 362 cm.setIdentity(); // does not change alpha
363 paint.setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat)); 363 paint.setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat));
364 REPORTER_ASSERT(r, paint.nothingToDraw()); 364 REPORTER_ASSERT(r, paint.nothingToDraw());
365 365
366 cm.postTranslate(0, 0, 0, 1); // wacks alpha 366 cm.postTranslate(0, 0, 0, 1); // wacks alpha
367 paint.setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat)); 367 paint.setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat));
368 REPORTER_ASSERT(r, !paint.nothingToDraw()); 368 REPORTER_ASSERT(r, !paint.nothingToDraw());
369 } 369 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698