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

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

Issue 17381008: More general version of image filtering; reworked to be robust and easier to SSE (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Separate implementation of downsampling for high quality results Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2007 The Android Open Source Project 3 * Copyright 2007 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkBitmapProcState_DEFINED 10 #ifndef SkBitmapProcState_DEFINED
11 #define SkBitmapProcState_DEFINED 11 #define SkBitmapProcState_DEFINED
12 12
13 #include "SkBitmap.h" 13 #include "SkBitmap.h"
14 #include "SkBitmapFilter.h"
14 #include "SkMatrix.h" 15 #include "SkMatrix.h"
15 16
16 #define FractionalInt_IS_64BIT 17 #define FractionalInt_IS_64BIT
17 18
18 #ifdef FractionalInt_IS_64BIT 19 #ifdef FractionalInt_IS_64BIT
19 typedef SkFixed48 SkFractionalInt; 20 typedef SkFixed48 SkFractionalInt;
20 #define SkScalarToFractionalInt(x) SkScalarToFixed48(x) 21 #define SkScalarToFractionalInt(x) SkScalarToFixed48(x)
21 #define SkFractionalIntToFixed(x) SkFixed48ToFixed(x) 22 #define SkFractionalIntToFixed(x) SkFixed48ToFixed(x)
22 #define SkFixedToFractionalInt(x) SkFixedToFixed48(x) 23 #define SkFixedToFractionalInt(x) SkFixedToFixed48(x)
23 #define SkFractionalIntToInt(x) SkFixed48ToInt(x) 24 #define SkFractionalIntToInt(x) SkFixed48ToInt(x)
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 ShaderProc16 getShaderProc16() const { return fShaderProc16; } 116 ShaderProc16 getShaderProc16() const { return fShaderProc16; }
116 117
117 #ifdef SK_DEBUG 118 #ifdef SK_DEBUG
118 MatrixProc getMatrixProc() const; 119 MatrixProc getMatrixProc() const;
119 #else 120 #else
120 MatrixProc getMatrixProc() const { return fMatrixProc; } 121 MatrixProc getMatrixProc() const { return fMatrixProc; }
121 #endif 122 #endif
122 SampleProc32 getSampleProc32() const { return fSampleProc32; } 123 SampleProc32 getSampleProc32() const { return fSampleProc32; }
123 SampleProc16 getSampleProc16() const { return fSampleProc16; } 124 SampleProc16 getSampleProc16() const { return fSampleProc16; }
124 125
126 void buildFilterCoefficients(SkFixed dst[4], float t) const;
127 SkBitmapFilter *fBitmapFilter;
reed1 2013/07/09 14:25:47 who needs direct access to this object (other than
humper 2013/07/09 14:47:26 Nobody. Will restrict. On 2013/07/09 14:25:47,
128
125 private: 129 private:
126 friend class SkBitmapProcShader; 130 friend class SkBitmapProcShader;
127 131
128 ShaderProc32 fShaderProc32; // chooseProcs 132 ShaderProc32 fShaderProc32; // chooseProcs
129 ShaderProc16 fShaderProc16; // chooseProcs 133 ShaderProc16 fShaderProc16; // chooseProcs
130 // These are used if the shaderproc is NULL 134 // These are used if the shaderproc is NULL
131 MatrixProc fMatrixProc; // chooseProcs 135 MatrixProc fMatrixProc; // chooseProcs
132 SampleProc32 fSampleProc32; // chooseProcs 136 SampleProc32 fSampleProc32; // chooseProcs
133 SampleProc16 fSampleProc16; // chooseProcs 137 SampleProc16 fSampleProc16; // chooseProcs
134 138
135 SkMatrix fUnitInvMatrix; // chooseProcs 139 SkMatrix fUnitInvMatrix; // chooseProcs
136 SkBitmap fOrigBitmap; // CONSTRUCTOR 140 SkBitmap fOrigBitmap; // CONSTRUCTOR
137 SkBitmap fMipBitmap; 141 SkBitmap fMipBitmap;
138 142
139 MatrixProc chooseMatrixProc(bool trivial_matrix); 143 MatrixProc chooseMatrixProc(bool trivial_matrix);
140 bool chooseProcs(const SkMatrix& inv, const SkPaint&); 144 bool chooseProcs(const SkMatrix& inv, const SkPaint&);
141 ShaderProc32 chooseShaderProc32(); 145 ShaderProc32 chooseShaderProc32();
142 146
143 147 ShaderProc32 chooseBitmapFilterProc(const SkPaint &paint);
144 /** test method for choosing a bicubic shading filter
145 */
146
147 ShaderProc32 chooseBicubicFilterProc(const SkPaint &paint);
148 148
149 // Return false if we failed to setup for fast translate (e.g. overflow) 149 // Return false if we failed to setup for fast translate (e.g. overflow)
150 bool setupForTranslate(); 150 bool setupForTranslate();
151 151
152 #ifdef SK_DEBUG 152 #ifdef SK_DEBUG
153 static void DebugMatrixProc(const SkBitmapProcState&, 153 static void DebugMatrixProc(const SkBitmapProcState&,
154 uint32_t[], int count, int x, int y); 154 uint32_t[], int count, int x, int y);
155 #endif 155 #endif
156 }; 156 };
157 157
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 int count, int x, int y); 193 int count, int x, int y);
194 void ClampX_ClampY_nofilter_scale(const SkBitmapProcState& s, uint32_t xy[], 194 void ClampX_ClampY_nofilter_scale(const SkBitmapProcState& s, uint32_t xy[],
195 int count, int x, int y); 195 int count, int x, int y);
196 void ClampX_ClampY_filter_affine(const SkBitmapProcState& s, 196 void ClampX_ClampY_filter_affine(const SkBitmapProcState& s,
197 uint32_t xy[], int count, int x, int y); 197 uint32_t xy[], int count, int x, int y);
198 void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s, 198 void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s,
199 uint32_t xy[], int count, int x, int y); 199 uint32_t xy[], int count, int x, int y);
200 void S32_D16_filter_DX(const SkBitmapProcState& s, 200 void S32_D16_filter_DX(const SkBitmapProcState& s,
201 const uint32_t* xy, int count, uint16_t* colo rs); 201 const uint32_t* xy, int count, uint16_t* colo rs);
202 202
203 void highQualityFilter_ScaleOnly(const SkBitmapProcState &s, int x, int y,
204 SkPMColor *SK_RESTRICT colors, int count);
205 void highQualityFilter(const SkBitmapProcState &s, int x, int y,
206 SkPMColor *SK_RESTRICT colors, int count);
207
208
203 #endif 209 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698