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

Side by Side Diff: src/core/SkLinearBitmapPipeline.h

Issue 2484273002: Move the matrix stage of SkLinearBitmapPipeline over to using SkSmallAllocator. (Closed)
Patch Set: rebase on new SkSmallAllocator Created 4 years, 1 month 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 | « no previous file | src/core/SkLinearBitmapPipeline.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 #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 #include "SkSmallAllocator.h"
15 16
16 class SkEmbeddableLinearPipeline; 17 class SkEmbeddableLinearPipeline;
17 18
18 enum SkGammaType { 19 enum SkGammaType {
19 kLinear_SkGammaType, 20 kLinear_SkGammaType,
20 kSRGB_SkGammaType, 21 kSRGB_SkGammaType,
21 }; 22 };
22 23
23 //////////////////////////////////////////////////////////////////////////////// /////////////////// 24 //////////////////////////////////////////////////////////////////////////////// ///////////////////
24 // SkLinearBitmapPipeline - encapsulates all the machinery for doing floating po int pixel 25 // SkLinearBitmapPipeline - encapsulates all the machinery for doing floating po int pixel
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 119
119 }; 120 };
120 121
121 class PointProcessorInterface; 122 class PointProcessorInterface;
122 class SampleProcessorInterface; 123 class SampleProcessorInterface;
123 class BlendProcessorInterface; 124 class BlendProcessorInterface;
124 class DestinationInterface; 125 class DestinationInterface;
125 class PixelAccessorInterface; 126 class PixelAccessorInterface;
126 127
127 // These values were generated by the assert above in Stage::init{Sink|Stage }. 128 // These values were generated by the assert above in Stage::init{Sink|Stage }.
128 using MatrixStage = Stage<PointProcessorInterface, 56, PointProcessorIn terface>;
129 using TileStage = Stage<PointProcessorInterface, 48, SampleProcessorI nterface>; 129 using TileStage = Stage<PointProcessorInterface, 48, SampleProcessorI nterface>;
130 using SampleStage = Stage<SampleProcessorInterface, 160, BlendProcessorIn terface>; 130 using SampleStage = Stage<SampleProcessorInterface, 160, BlendProcessorIn terface>;
131 using BlenderStage = Stage<BlendProcessorInterface, 48>; 131 using BlenderStage = Stage<BlendProcessorInterface, 48>;
132 using Accessor = PolyMemory<PixelAccessorInterface, 64>; 132 using Accessor = PolyMemory<PixelAccessorInterface, 64>;
133 133
134 private: 134 private:
135 PointProcessorInterface* ChooseMatrix(
136 PointProcessorInterface* next,
137 const SkMatrix& inverse);
138
139 using MemoryAllocator = SkSmallAllocator<64, 1>;
140 using MatrixCloner =
141 std::function<PointProcessorInterface* (PointProcessorInterface*, Memory Allocator*)>;
142
143 MemoryAllocator fMemory;
135 PointProcessorInterface* fFirstStage; 144 PointProcessorInterface* fFirstStage;
136 MatrixStage fMatrixStage; 145 MatrixCloner fMatrixStageCloner;
137 TileStage fTileStage; 146 TileStage fTileStage;
138 SampleStage fSampleStage; 147 SampleStage fSampleStage;
139 BlenderStage fBlenderStage; 148 BlenderStage fBlenderStage;
140 DestinationInterface* fLastStage; 149 DestinationInterface* fLastStage;
141 Accessor fAccessor; 150 Accessor fAccessor;
142 }; 151 };
143 152
144 //////////////////////////////////////////////////////////////////////////////// //////////////////// 153 //////////////////////////////////////////////////////////////////////////////// ////////////////////
145 // SkEmbeddableLinearPipeline - manage stricter alignment needs for SkLinearBitm apPipeline. 154 // SkEmbeddableLinearPipeline - manage stricter alignment needs for SkLinearBitm apPipeline.
146 class SkEmbeddableLinearPipeline { 155 class SkEmbeddableLinearPipeline {
(...skipping 16 matching lines...) Expand all
163 } 172 }
164 SkLinearBitmapPipeline& operator*() const { return *this->get(); } 173 SkLinearBitmapPipeline& operator*() const { return *this->get(); }
165 SkLinearBitmapPipeline* operator->() const { return this->get(); } 174 SkLinearBitmapPipeline* operator->() const { return this->get(); }
166 175
167 private: 176 private:
168 alignas(SkLinearBitmapPipeline) mutable char fPipelineStorage[sizeof(SkLinea rBitmapPipeline)]; 177 alignas(SkLinearBitmapPipeline) mutable char fPipelineStorage[sizeof(SkLinea rBitmapPipeline)];
169 bool fInitialized {false}; 178 bool fInitialized {false};
170 }; 179 };
171 180
172 #endif // SkLinearBitmapPipeline_DEFINED 181 #endif // SkLinearBitmapPipeline_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/core/SkLinearBitmapPipeline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698