OLD | NEW |
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 #include "SkLinearBitmapPipeline.h" | 7 #include "SkLinearBitmapPipeline.h" |
8 | 8 |
9 #include "SkColor.h" | 9 #include "SkColor.h" |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 SkMatrix m = SkMatrix::I(); | 35 SkMatrix m = SkMatrix::I(); |
36 //m.setRotate(30.0f, 1.0f, 1.0f); | 36 //m.setRotate(30.0f, 1.0f, 1.0f); |
37 SkMatrix invert; | 37 SkMatrix invert; |
38 bool trash = m.invert(&invert); | 38 bool trash = m.invert(&invert); |
39 sk_ignore_unused_variable(trash); | 39 sk_ignore_unused_variable(trash); |
40 | 40 |
41 const SkImageInfo info = | 41 const SkImageInfo info = |
42 SkImageInfo::MakeN32Premul(width, height, kLinear_SkColorProfileType); | 42 SkImageInfo::MakeN32Premul(width, height, kLinear_SkColorProfileType); |
43 | 43 |
| 44 SkPixmap srcPixmap{info, bitmap, static_cast<size_t>(4 * width)}; |
| 45 |
44 SkLinearBitmapPipeline pipeline{invert, kNone_SkFilterQuality, SkShader::kCl
amp_TileMode, | 46 SkLinearBitmapPipeline pipeline{invert, kNone_SkFilterQuality, SkShader::kCl
amp_TileMode, |
45 SkShader::kClamp_TileMode, info, bitmap}; | 47 SkShader::kClamp_TileMode, srcPixmap}; |
46 | 48 |
47 int count = 10; | 49 int count = 10; |
48 | 50 |
49 pipeline.shadeSpan4f(3, 6, FPbuffer, count); | 51 pipeline.shadeSpan4f(3, 6, FPbuffer, count); |
50 | 52 #if 0 |
51 Pixel* pixelBuffer = (Pixel*)FPbuffer; | 53 Pixel* pixelBuffer = (Pixel*)FPbuffer; |
52 for (int i = 0; i < count; i++) { | 54 for (int i = 0; i < count; i++) { |
53 printf("i: %d - (%g, %g, %g, %g)\n", i, | 55 printf("i: %d - (%g, %g, %g, %g)\n", i, |
54 pixelBuffer[i][0] * 255.0f, | 56 pixelBuffer[i][0] * 255.0f, |
55 pixelBuffer[i][1] * 255.0f, | 57 pixelBuffer[i][1] * 255.0f, |
56 pixelBuffer[i][2] * 255.0f, | 58 pixelBuffer[i][2] * 255.0f, |
57 pixelBuffer[i][3] * 255.0f); | 59 pixelBuffer[i][3] * 255.0f); |
58 } | 60 } |
| 61 #endif |
59 | 62 |
60 delete [] bitmap; | 63 delete [] bitmap; |
61 delete [] FPbuffer; | 64 delete [] FPbuffer; |
62 } | 65 } |
63 | 66 |
OLD | NEW |