| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 using Sk4fArg = const Sk4f&; | 22 using Sk4fArg = const Sk4f&; |
| 23 | 23 |
| 24 class PointProcessorInterface { | 24 class PointProcessorInterface { |
| 25 public: | 25 public: |
| 26 virtual ~PointProcessorInterface() { } | 26 virtual ~PointProcessorInterface() { } |
| 27 virtual void pointListFew(int n, Sk4fArg xs, Sk4fArg ys) = 0; | 27 virtual void pointListFew(int n, Sk4fArg xs, Sk4fArg ys) = 0; |
| 28 virtual void pointList4(Sk4fArg xs, Sk4fArg ys) = 0; | 28 virtual void pointList4(Sk4fArg xs, Sk4fArg ys) = 0; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 class BilerpProcessorInterface : public PointProcessorInterface { |
| 32 public: |
| 33 virtual void bilerpList(Sk4fArg xs, Sk4fArg ys) = 0; |
| 34 }; |
| 35 |
| 31 class PixelPlacerInterface { | 36 class PixelPlacerInterface { |
| 32 public: | 37 public: |
| 33 virtual ~PixelPlacerInterface() { } | 38 virtual ~PixelPlacerInterface() { } |
| 34 virtual void setDestination(SkPM4f* dst) = 0; | 39 virtual void setDestination(SkPM4f* dst) = 0; |
| 35 virtual void placePixel(Sk4fArg pixel0) = 0; | 40 virtual void placePixel(Sk4fArg pixel0) = 0; |
| 36 virtual void place4Pixels(Sk4fArg p0, Sk4fArg p1, Sk4fArg p2, Sk4fArg p3) =
0; | 41 virtual void place4Pixels(Sk4fArg p0, Sk4fArg p1, Sk4fArg p2, Sk4fArg p3) =
0; |
| 37 }; | 42 }; |
| 38 | 43 |
| 39 class SkLinearBitmapPipeline { | 44 class SkLinearBitmapPipeline { |
| 40 public: | 45 public: |
| 41 SkLinearBitmapPipeline( | 46 SkLinearBitmapPipeline( |
| 42 const SkMatrix& inverse, | 47 const SkMatrix& inverse, |
| 48 SkFilterQuality filterQuality, |
| 43 SkShader::TileMode xTile, SkShader::TileMode yTile, | 49 SkShader::TileMode xTile, SkShader::TileMode yTile, |
| 44 const SkImageInfo& srcImageInfo, | 50 const SkImageInfo& srcImageInfo, |
| 45 const void* srcImageData); | 51 const void* srcImageData); |
| 46 | 52 |
| 47 void shadeSpan4f(int x, int y, SkPM4f* dst, int count); | 53 void shadeSpan4f(int x, int y, SkPM4f* dst, int count); |
| 48 | 54 |
| 49 template<typename Base, size_t kSize> | 55 template<typename Base, size_t kSize> |
| 50 class PolymorphicUnion { | 56 class PolymorphicUnion { |
| 51 public: | 57 public: |
| 52 PolymorphicUnion() {} | 58 PolymorphicUnion() {} |
| (...skipping 13 matching lines...) Expand all Loading... |
| 66 Base& operator*() const { return *get(); } | 72 Base& operator*() const { return *get(); } |
| 67 | 73 |
| 68 private: | 74 private: |
| 69 struct SK_STRUCT_ALIGN(16) Space { | 75 struct SK_STRUCT_ALIGN(16) Space { |
| 70 char space[kSize]; | 76 char space[kSize]; |
| 71 }; | 77 }; |
| 72 mutable Space fSpace; | 78 mutable Space fSpace; |
| 73 }; | 79 }; |
| 74 | 80 |
| 75 using MatrixStage = PolymorphicUnion<PointProcessorInterface, 112>; | 81 using MatrixStage = PolymorphicUnion<PointProcessorInterface, 112>; |
| 76 using TileStage = PolymorphicUnion<PointProcessorInterface, 96>; | 82 using FilterStage = PolymorphicUnion<PointProcessorInterface, 8>; |
| 77 using SampleStage = PolymorphicUnion<PointProcessorInterface, 80>; | 83 using TileStage = PolymorphicUnion<BilerpProcessorInterface, 96>; |
| 84 using SampleStage = PolymorphicUnion<BilerpProcessorInterface, 80>; |
| 78 using PixelStage = PolymorphicUnion<PixelPlacerInterface, 80>; | 85 using PixelStage = PolymorphicUnion<PixelPlacerInterface, 80>; |
| 79 | 86 |
| 80 private: | 87 private: |
| 81 PointProcessorInterface* fFirstStage; | 88 PointProcessorInterface* fFirstStage; |
| 82 MatrixStage fMatrixStage; | 89 MatrixStage fMatrixStage; |
| 90 FilterStage fFilterStage; |
| 83 TileStage fTileXOrBothStage; | 91 TileStage fTileXOrBothStage; |
| 84 TileStage fTileYStage; | 92 TileStage fTileYStage; |
| 85 SampleStage fSampleStage; | 93 SampleStage fSampleStage; |
| 86 PixelStage fPixelStage; | 94 PixelStage fPixelStage; |
| 87 }; | 95 }; |
| 88 | 96 |
| 89 #endif // SkLinearBitmapPipeline_DEFINED | 97 #endif // SkLinearBitmapPipeline_DEFINED |
| OLD | NEW |