Previously, the set of platform-specific function pointers to do fast convolution (e.g., neon, SSE) were passed in a structure to the scaler.
I refactored this so that the scaler fills in these function pointers after it's called, so the caller doesn't have to worry about it.
R=mtklein@google.com
TBR=mtklein
NOTRY=True
Author: humper@google.com
Review URL: https://codereview.chromium.org/
354193002
// All the criteria are met; let's make a new bitmap.
- SkConvolutionProcs simd;
- sk_bzero(&simd, sizeof(simd));
- this->platformConvolutionProcs(&simd);
-
if (!SkBitmapScaler::Resize(&fScaledBitmap,
fOrigBitmap,
SkBitmapScaler::RESIZE_BEST,
dest_width,
dest_height,
- simd,
SkScaledImageCache::GetAllocator())) {
// we failed to create fScaledBitmap, so just return and let
// the scanline proc handle it.
#endif
class SkPaint;
-struct SkConvolutionProcs;
struct SkBitmapProcState {
*/
void platformProcs();
- /** Platforms can also optionally overwrite the convolution functions
- if we have SIMD versions of them.
- */
-
- void platformConvolutionProcs(SkConvolutionProcs*);
-
/** Given the byte size of the index buffer to be passed to the matrix proc,
return the maximum number of resulting pixels that can be computed
(i.e. the number of SkPMColor values to be written by the sample proc).
const SkBitmap& source,
ResizeMethod method,
float destWidth, float destHeight,
- const SkConvolutionProcs& convolveProcs,
SkBitmap::Allocator* allocator) {
+ SkConvolutionProcs convolveProcs= { 0, NULL, NULL, NULL, NULL };
+ PlatformConvolutionProcs(&convolveProcs);
+
SkRect destSubset = { 0, 0, destWidth, destHeight };
// Ensure that the ResizeMethod enumeration is sound.
const SkBitmap& source,
ResizeMethod method,
float dest_width, float dest_height,
- const SkConvolutionProcs&,
SkBitmap::Allocator* allocator = NULL);
+
+ /** Platforms can also optionally overwrite the convolution functions
+ if we have SIMD versions of them.
+ */
+
+ static void PlatformConvolutionProcs(SkConvolutionProcs*);
};
#endif
*/
+#include "SkBitmapScaler.h"
#include "SkBitmapProcState.h"
#include "SkColorPriv.h"
#include "SkPaint.h"
void platformConvolutionProcs_arm(SkConvolutionProcs* procs) {
}
-void SkBitmapProcState::platformConvolutionProcs(SkConvolutionProcs* procs) {
+void SkBitmapScaler::PlatformConvolutionProcs(SkConvolutionProcs* procs) {
SK_ARM_NEON_WRAP(platformConvolutionProcs_arm)(procs);
}
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+
+#include "SkBitmapScaler.h"
#include "SkBitmapProcState.h"
/* A platform may optionally overwrite any of these with accelerated
void SkBitmapProcState::platformProcs() {}
// empty implementation just uses default supplied function pointers
-void SkBitmapProcState::platformConvolutionProcs(SkConvolutionProcs*) {}
+void SkBitmapScaler::PlatformConvolutionProcs(SkConvolutionProcs*) {}
#include "SkBitmapFilter_opts_SSE2.h"
#include "SkBitmapProcState_opts_SSE2.h"
#include "SkBitmapProcState_opts_SSSE3.h"
+#include "SkBitmapScaler.h"
#include "SkBlitMask.h"
#include "SkBlitRect_opts_SSE2.h"
#include "SkBlitRow.h"
SK_CONF_DECLARE( bool, c_hqfilter_sse, "bitmap.filter.highQualitySSE", false, "Use SSE optimized version of high quality image filters");
-void SkBitmapProcState::platformConvolutionProcs(SkConvolutionProcs* procs) {
+void SkBitmapScaler::PlatformConvolutionProcs(SkConvolutionProcs* procs) {
if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
procs->fExtraHorizontalReads = 3;
procs->fConvolveVertically = &convolveVertically_SSE2;