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

Side by Side Diff: tests/SkLinearBitmapPipelineTest.cpp

Issue 1704583003: Simplified linear pipeline. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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
« src/core/SkLinearBitmapPipeline.cpp ('K') | « src/core/SkNx.h ('k') | 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
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7 #include "SkLinearBitmapPipeline.h"
8
9 #include "SkColor.h"
10
11 #include "Test.h"
12
13 struct SinkBilerpProcessor final : public PointProcessorInterface {
14 void pointListFew(int n, Sk4f x, Sk4f y) override { fXs = x; fYs = y; }
15 void pointList4(Sk4f Xs, Sk4f Ys) override { fXs = Xs; fYs = Ys; }
16
17 Sk4f fXs;
18 Sk4f fYs;
19 };
20
21 using Pixel = float[4];
22 DEF_TEST(SkBitmapFP, reporter) {
23
24 int width = 10;
25 int height = 10;
26 uint32_t bitmap[width * height];
27 for (int y = 0; y < height; y++) {
28 for (int x = 0; x < width; x++) {
29 bitmap[y * width + x] = (y << 8) + x + (128<<24);
30 }
31 }
32
33 SkPM4f FPbuffer[width * height];
34
35 SkMatrix m = SkMatrix::I();
36 //m.setRotate(30.0f, 1.0f, 1.0f);
37 SkMatrix invert;
38 (void)m.invert(&invert);
39
40 const SkImageInfo info =
41 SkImageInfo::MakeN32Premul(width, height, kLinear_SkColorProfileType);
42
43 SkLinearBitmapPipeline pipeline{invert, SkShader::kClamp_TileMode,
44 SkShader::kClamp_TileMode, info, bitmap};
45
46 int count = 10;
47
48 pipeline.shadeSpan4f(3, 6, FPbuffer, count);
49
50 Pixel* pixelBuffer = (Pixel*)FPbuffer;
51 for (int i = 0; i < count; i++) {
52 printf("i: %d - (%g, %g, %g, %g)\n", i,
53 pixelBuffer[i][0] * 255.0f,
54 pixelBuffer[i][1] * 255.0f,
55 pixelBuffer[i][2] * 255.0f,
56 pixelBuffer[i][3] * 255.0f);
57 }
58 }
59
OLDNEW
« src/core/SkLinearBitmapPipeline.cpp ('K') | « src/core/SkNx.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698