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

Side by Side Diff: tests/GrShapeTest.cpp

Issue 2355483002: abstract name of clipping ops, to transtion to a more restricted set (Closed)
Patch Set: no need for ifdef for globals Created 4 years, 3 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 | « tests/DrawPathTest.cpp ('k') | tests/PictureBBHTest.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 2016 Google Inc. 2 * Copyright 2016 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 <initializer_list> 8 #include <initializer_list>
9 #include <functional> 9 #include <functional>
10 #include "Test.h" 10 #include "Test.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // This tolerance is in units of 1/kRes fractions of the bounds width/height . 45 // This tolerance is in units of 1/kRes fractions of the bounds width/height .
46 static constexpr int kTol = 0; 46 static constexpr int kTol = 0;
47 GR_STATIC_ASSERT(kRes % 4 == 0); 47 GR_STATIC_ASSERT(kRes % 4 == 0);
48 SkImageInfo info = SkImageInfo::MakeA8(kRes, kRes); 48 SkImageInfo info = SkImageInfo::MakeA8(kRes, kRes);
49 sk_sp<SkSurface> surface = SkSurface::MakeRaster(info); 49 sk_sp<SkSurface> surface = SkSurface::MakeRaster(info);
50 surface->getCanvas()->clear(0x0); 50 surface->getCanvas()->clear(0x0);
51 SkRect clip = SkRect::MakeXYWH(kRes/4, kRes/4, kRes/2, kRes/2); 51 SkRect clip = SkRect::MakeXYWH(kRes/4, kRes/4, kRes/2, kRes/2);
52 SkMatrix matrix; 52 SkMatrix matrix;
53 matrix.setRectToRect(bounds, clip, SkMatrix::kFill_ScaleToFit); 53 matrix.setRectToRect(bounds, clip, SkMatrix::kFill_ScaleToFit);
54 clip.outset(SkIntToScalar(kTol), SkIntToScalar(kTol)); 54 clip.outset(SkIntToScalar(kTol), SkIntToScalar(kTol));
55 surface->getCanvas()->clipRect(clip, SkRegion::kDifference_Op); 55 surface->getCanvas()->clipRect(clip, SkCanvas::kDifference_Op);
56 surface->getCanvas()->concat(matrix); 56 surface->getCanvas()->concat(matrix);
57 SkPaint whitePaint; 57 SkPaint whitePaint;
58 whitePaint.setColor(SK_ColorWHITE); 58 whitePaint.setColor(SK_ColorWHITE);
59 surface->getCanvas()->drawPath(path, whitePaint); 59 surface->getCanvas()->drawPath(path, whitePaint);
60 SkPixmap pixmap; 60 SkPixmap pixmap;
61 surface->getCanvas()->peekPixels(&pixmap); 61 surface->getCanvas()->peekPixels(&pixmap);
62 #if defined(SK_BUILD_FOR_WIN) 62 #if defined(SK_BUILD_FOR_WIN)
63 // The static constexpr version in #else causes cl.exe to crash. 63 // The static constexpr version in #else causes cl.exe to crash.
64 const uint8_t* kZeros = reinterpret_cast<uint8_t*>(calloc(kRes, 1)); 64 const uint8_t* kZeros = reinterpret_cast<uint8_t*>(calloc(kRes, 1));
65 #else 65 #else
(...skipping 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 test_volatile_path(reporter, PathGeo(SkPath(), PathGeo::Invert::kNo)); 1890 test_volatile_path(reporter, PathGeo(SkPath(), PathGeo::Invert::kNo));
1891 1891
1892 test_empty_shape(reporter); 1892 test_empty_shape(reporter);
1893 1893
1894 test_lines(reporter); 1894 test_lines(reporter);
1895 1895
1896 test_stroked_lines(reporter); 1896 test_stroked_lines(reporter);
1897 } 1897 }
1898 1898
1899 #endif 1899 #endif
OLDNEW
« no previous file with comments | « tests/DrawPathTest.cpp ('k') | tests/PictureBBHTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698