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 | 7 |
8 #ifndef SkLinearBitmapPipeline_DEFINED | 8 #ifndef SkLinearBitmapPipeline_DEFINED |
9 #define SkLinearBitmapPipeline_DEFINED | 9 #define SkLinearBitmapPipeline_DEFINED |
10 | 10 |
11 #include "SkColor.h" | 11 #include "SkColor.h" |
12 #include "SkImageInfo.h" | 12 #include "SkImageInfo.h" |
13 #include "SkMatrix.h" | 13 #include "SkMatrix.h" |
14 #include "SkShader.h" | 14 #include "SkShader.h" |
15 | 15 |
16 class SkLinearBitmapPipeline { | 16 class SkLinearBitmapPipeline { |
17 public: | 17 public: |
18 SkLinearBitmapPipeline( | 18 SkLinearBitmapPipeline( |
19 const SkMatrix& inverse, | 19 const SkMatrix& inverse, |
20 SkFilterQuality filterQuality, | 20 SkFilterQuality filterQuality, |
21 SkShader::TileMode xTile, SkShader::TileMode yTile, | 21 SkShader::TileMode xTile, SkShader::TileMode yTile, |
22 float postAlpha, | 22 float postAlpha, |
23 const SkPixmap& srcPixmap); | 23 const SkPixmap& srcPixmap); |
| 24 |
| 25 |
| 26 |
| 27 static bool ClonePipelineForBlitting( |
| 28 void* blitterStorage, |
| 29 const SkLinearBitmapPipeline& pipeline, |
| 30 SkMatrix::TypeMask matrixMask, |
| 31 SkShader::TileMode xTileMode, |
| 32 SkShader::TileMode yTileMode, |
| 33 SkFilterQuality filterQuality, |
| 34 const SkPixmap& srcPixmap, |
| 35 float finalAlpha, |
| 36 SkXfermode::Mode xferMode, |
| 37 const SkImageInfo& dstInfo); |
| 38 |
24 ~SkLinearBitmapPipeline(); | 39 ~SkLinearBitmapPipeline(); |
25 | 40 |
26 void shadeSpan4f(int x, int y, SkPM4f* dst, int count); | 41 void shadeSpan4f(int x, int y, SkPM4f* dst, int count); |
| 42 void blitSpan(int32_t x, int32_t y, void* dst, int count); |
27 | 43 |
28 template<typename Base, size_t kSize, typename Next = void> | 44 template<typename Base, size_t kSize, typename Next = void> |
29 class Stage { | 45 class Stage { |
30 public: | 46 public: |
31 Stage() : fIsInitialized{false} {} | 47 Stage() : fIsInitialized{false} {} |
32 ~Stage(); | 48 ~Stage(); |
33 | 49 |
34 template<typename Variant, typename... Args> | 50 template<typename Variant, typename... Args> |
35 void initStage(Next* next, Args&& ... args); | 51 void initStage(Next* next, Args&& ... args); |
36 | 52 |
(...skipping 21 matching lines...) Expand all Loading... |
58 bool fIsInitialized; | 74 bool fIsInitialized; |
59 mutable Space fSpace; | 75 mutable Space fSpace; |
60 }; | 76 }; |
61 | 77 |
62 class PointProcessorInterface; | 78 class PointProcessorInterface; |
63 class SampleProcessorInterface; | 79 class SampleProcessorInterface; |
64 class BlendProcessorInterface; | 80 class BlendProcessorInterface; |
65 class DestinationInterface; | 81 class DestinationInterface; |
66 | 82 |
67 // These values were generated by the assert above in Stage::init{Sink|Stage
}. | 83 // These values were generated by the assert above in Stage::init{Sink|Stage
}. |
68 using MatrixStage = Stage<PointProcessorInterface, 160, PointProcessorInter
face>; | 84 using MatrixStage = Stage<PointProcessorInterface, 160, PointProcessorInte
rface>; |
69 using TileStage = Stage<PointProcessorInterface, 160, SampleProcessorInte
rface>; | 85 using TileStage = Stage<PointProcessorInterface, 160, SampleProcessorInt
erface>; |
70 using SampleStage = Stage<SampleProcessorInterface, 100, BlendProcessorInte
rface>; | 86 using SampleStage = Stage<SampleProcessorInterface, 100, BlendProcessorInte
rface>; |
71 using BlenderStage = Stage<BlendProcessorInterface, 80>; | 87 using BlenderStage = Stage<BlendProcessorInterface, 40>; |
72 | 88 |
73 private: | 89 private: |
| 90 SkLinearBitmapPipeline( |
| 91 const SkLinearBitmapPipeline& pipeline, |
| 92 const SkPixmap& srcPixmap, |
| 93 SkXfermode::Mode xferMode, |
| 94 const SkImageInfo& dstInfo); |
| 95 |
74 PointProcessorInterface* fFirstStage; | 96 PointProcessorInterface* fFirstStage; |
75 MatrixStage fMatrixStage; | 97 MatrixStage fMatrixStage; |
76 TileStage fTileStage; | 98 TileStage fTileStage; |
77 SampleStage fSampleStage; | 99 SampleStage fSampleStage; |
78 BlenderStage fBlenderStage; | 100 BlenderStage fBlenderStage; |
79 DestinationInterface* fLastStage; | 101 DestinationInterface* fLastStage; |
80 }; | 102 }; |
81 | 103 |
82 #endif // SkLinearBitmapPipeline_DEFINED | 104 #endif // SkLinearBitmapPipeline_DEFINED |
OLD | NEW |