diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-05-08 15:32:41 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-05-08 15:32:41 +0000 |
commit | 8b7463db00b2316dd4f93a25897a9d8d7928a3b5 (patch) | |
tree | d27ace66d6c378b072161067b27b2f30734fe134 /src | |
parent | e3647415d736969e3a8f8ffb5a19eee436c66d41 (diff) |
remove dead code (SkBitmapSampler)
git-svn-id: http://skia.googlecode.com/svn/trunk@9062 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkBitmapSampler.cpp | 414 | ||||
-rw-r--r-- | src/core/SkBitmapSampler.h | 162 | ||||
-rw-r--r-- | src/core/SkBitmapSamplerTemplate.h | 108 |
3 files changed, 0 insertions, 684 deletions
diff --git a/src/core/SkBitmapSampler.cpp b/src/core/SkBitmapSampler.cpp deleted file mode 100644 index 2b68510445..0000000000 --- a/src/core/SkBitmapSampler.cpp +++ /dev/null @@ -1,414 +0,0 @@ - -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#include "SkBitmapSampler.h" - -static SkTileModeProc get_tilemode_proc(SkShader::TileMode mode) -{ - switch (mode) { - case SkShader::kClamp_TileMode: - return do_clamp; - case SkShader::kRepeat_TileMode: - return do_repeat_mod; - case SkShader::kMirror_TileMode: - return do_mirror_mod; - default: - SkDEBUGFAIL("unknown mode"); - return NULL; - } -} - -SkBitmapSampler::SkBitmapSampler(const SkBitmap& bm, bool filter, - SkShader::TileMode tmx, SkShader::TileMode tmy) - : fBitmap(bm), fFilterBitmap(filter), fTileModeX(tmx), fTileModeY(tmy) -{ - SkASSERT(bm.width() > 0 && bm.height() > 0); - - fMaxX = SkToU16(bm.width() - 1); - fMaxY = SkToU16(bm.height() - 1); - - fTileProcX = get_tilemode_proc(tmx); - fTileProcY = get_tilemode_proc(tmy); -} - -void SkBitmapSampler::setPaint(const SkPaint& paint) -{ -} - -class SkNullBitmapSampler : public SkBitmapSampler { -public: - SkNullBitmapSampler(const SkBitmap& bm, bool filter, - SkShader::TileMode tmx, SkShader::TileMode tmy) - : SkBitmapSampler(bm, filter, tmx, tmy) {} - - virtual SkPMColor sample(SkFixed x, SkFixed y) const { return 0; } -}; - -///////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////// - -#define BITMAP_CLASSNAME_PREFIX(name) ARGB32##name -#define BITMAP_PIXEL_TO_PMCOLOR(bitmap, x, y) *bitmap.getAddr32(x, y) -#include "SkBitmapSamplerTemplate.h" - -#include "SkColorPriv.h" - -#define BITMAP_CLASSNAME_PREFIX(name) RGB16##name -#define BITMAP_PIXEL_TO_PMCOLOR(bitmap, x, y) SkPixel16ToPixel32(*bitmap.getAddr16(x, y)) -#include "SkBitmapSamplerTemplate.h" - -#define BITMAP_CLASSNAME_PREFIX(name) Index8##name -#define BITMAP_PIXEL_TO_PMCOLOR(bitmap, x, y) bitmap.getIndex8Color(x, y) -#include "SkBitmapSamplerTemplate.h" - -///////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////// -///////////////// The Bilinear versions - -#include "SkFilterProc.h" - -class ARGB32_Bilinear_Sampler : public SkBitmapSampler { -public: - ARGB32_Bilinear_Sampler(const SkBitmap& bm, SkShader::TileMode tmx, SkShader::TileMode tmy) - : SkBitmapSampler(bm, true, tmx, tmy) - { - fPtrProcTable = SkGetBilinearFilterPtrProcTable(); - } - - virtual SkPMColor sample(SkFixed x, SkFixed y) const - { - const uint32_t *p00, *p01, *p10, *p11; - - // turn pixel centers into the top-left of our filter-box - x -= SK_FixedHalf; - y -= SK_FixedHalf; - - // compute our pointers - { - const SkBitmap* bitmap = &fBitmap; - int ix = x >> 16; - int iy = y >> 16; - - int maxX = fMaxX; - SkTileModeProc procX = fTileProcX; - int maxY = fMaxY; - SkTileModeProc procY = fTileProcY; - - int tmpx = procX(ix, maxX); - int tmpy = procY(iy, maxY); - p00 = bitmap->getAddr32(tmpx, tmpy); - - int tmpx1 = procX(ix + 1, maxX); - p01 = bitmap->getAddr32(tmpx1, tmpy); - - int tmpy1 = procY(iy + 1, maxY); - p10 = bitmap->getAddr32(tmpx, tmpy1); - - p11 = bitmap->getAddr32(tmpx1, tmpy1); - } - - SkFilterPtrProc proc = SkGetBilinearFilterPtrProc(fPtrProcTable, x, y); - return proc(p00, p01, p10, p11); - } - -private: - const SkFilterPtrProc* fPtrProcTable; -}; - -class RGB16_Bilinear_Sampler : public SkBitmapSampler { -public: - RGB16_Bilinear_Sampler(const SkBitmap& bm, SkShader::TileMode tmx, SkShader::TileMode tmy) - : SkBitmapSampler(bm, true, tmx, tmy) - { - fProcTable = SkGetBilinearFilterProcTable(); - } - - virtual SkPMColor sample(SkFixed x, SkFixed y) const - { - const uint16_t *p00, *p01, *p10, *p11; - - // turn pixel centers into the top-left of our filter-box - x -= SK_FixedHalf; - y -= SK_FixedHalf; - - // compute our pointers - { - const SkBitmap* bitmap = &fBitmap; - int ix = x >> 16; - int iy = y >> 16; - - int maxX = fMaxX; - SkTileModeProc procX = fTileProcX; - int maxY = fMaxY; - SkTileModeProc procY = fTileProcY; - - int tmpx = procX(ix, maxX); - int tmpy = procY(iy, maxY); - p00 = bitmap->getAddr16(tmpx, tmpy); - - int tmpx1 = procX(ix + 1, maxX); - p01 = bitmap->getAddr16(tmpx1, tmpy); - - int tmpy1 = procY(iy + 1, maxY); - p10 = bitmap->getAddr16(tmpx, tmpy1); - - p11 = bitmap->getAddr16(tmpx1, tmpy1); - } - - SkFilterProc proc = SkGetBilinearFilterProc(fProcTable, x, y); - uint32_t c = proc(SkExpand_rgb_16(*p00), SkExpand_rgb_16(*p01), - SkExpand_rgb_16(*p10), SkExpand_rgb_16(*p11)); - - return SkPixel16ToPixel32((uint16_t)SkCompact_rgb_16(c)); - } - -private: - const SkFilterProc* fProcTable; -}; - -// If we had a init/term method on sampler, we could avoid the per-pixel -// call to lockColors/unlockColors - -class Index8_Bilinear_Sampler : public SkBitmapSampler { -public: - Index8_Bilinear_Sampler(const SkBitmap& bm, SkShader::TileMode tmx, SkShader::TileMode tmy) - : SkBitmapSampler(bm, true, tmx, tmy) - { - fPtrProcTable = SkGetBilinearFilterPtrProcTable(); - } - - virtual SkPMColor sample(SkFixed x, SkFixed y) const - { - const SkBitmap* bitmap = &fBitmap; - - const uint8_t *p00, *p01, *p10, *p11; - - // turn pixel centers into the top-left of our filter-box - x -= SK_FixedHalf; - y -= SK_FixedHalf; - - // compute our pointers - { - int ix = x >> 16; - int iy = y >> 16; - - int maxX = fMaxX; - SkTileModeProc procX = fTileProcX; - int maxY = fMaxY; - SkTileModeProc procY = fTileProcY; - - int tmpx = procX(ix, maxX); - int tmpy = procY(iy, maxY); - p00 = bitmap->getAddr8(tmpx, tmpy); - - int tmpx1 = procX(ix + 1, maxX); - p01 = bitmap->getAddr8(tmpx1, tmpy); - - int tmpy1 = procY(iy + 1, maxY); - p10 = bitmap->getAddr8(tmpx, tmpy1); - - p11 = bitmap->getAddr8(tmpx1, tmpy1); - } - - const SkPMColor* colors = bitmap->getColorTable()->lockColors(); - - SkFilterPtrProc proc = SkGetBilinearFilterPtrProc(fPtrProcTable, x, y); - uint32_t c = proc(&colors[*p00], &colors[*p01], &colors[*p10], &colors[*p11]); - - bitmap->getColorTable()->unlockColors(false); - - return c; - } - -private: - const SkFilterPtrProc* fPtrProcTable; -}; - -class A8_Bilinear_Sampler : public SkBitmapSampler { -public: - A8_Bilinear_Sampler(const SkBitmap& bm, SkShader::TileMode tmx, SkShader::TileMode tmy) - : SkBitmapSampler(bm, true, tmx, tmy) - , fColor(0) - { - fProcTable = SkGetBilinearFilterProcTable(); - } - - virtual void setPaint(const SkPaint& paint) - { - fColor = SkPreMultiplyColor(paint.getColor()); - } - - virtual SkPMColor sample(SkFixed x, SkFixed y) const - { - const uint8_t *p00, *p01, *p10, *p11; - - // turn pixel centers into the top-left of our filter-box - x -= SK_FixedHalf; - y -= SK_FixedHalf; - - // compute our pointers - { - const SkBitmap* bitmap = &fBitmap; - int ix = x >> 16; - int iy = y >> 16; - - int maxX = fMaxX; - SkTileModeProc procX = fTileProcX; - int maxY = fMaxY; - SkTileModeProc procY = fTileProcY; - - int tmpx = procX(ix, maxX); - int tmpy = procY(iy, maxY); - p00 = bitmap->getAddr8(tmpx, tmpy); - - int tmpx1 = procX(ix + 1, maxX); - p01 = bitmap->getAddr8(tmpx1, tmpy); - - int tmpy1 = procY(iy + 1, maxY); - p10 = bitmap->getAddr8(tmpx, tmpy1); - - p11 = bitmap->getAddr8(tmpx1, tmpy1); - } - - SkFilterProc proc = SkGetBilinearFilterProc(fProcTable, x, y); - int alpha = proc(*p00, *p01, *p10, *p11); - return SkAlphaMulQ(fColor, SkAlpha255To256(alpha)); - } - -private: - const SkFilterProc* fProcTable; - SkPMColor fColor; -}; - -class A8_NoFilter_Sampler : public SkBitmapSampler { -public: - A8_NoFilter_Sampler(const SkBitmap& bm, SkShader::TileMode tmx, SkShader::TileMode tmy) - : SkBitmapSampler(bm, false, tmx, tmy) - { - } - - virtual void setPaint(const SkPaint& paint) - { - fColor = SkPreMultiplyColor(paint.getColor()); - } - - virtual SkPMColor sample(SkFixed x, SkFixed y) const - { - int ix = SkFixedFloor(x); - int iy = SkFixedFloor(y); - - int alpha = *fBitmap.getAddr8(fTileProcX(ix, fMaxX), fTileProcY(iy, fMaxY)); - return SkAlphaMulQ(fColor, SkAlpha255To256(alpha)); - } - -private: - SkPMColor fColor; -}; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -SkBitmapSampler* SkBitmapSampler::Create(const SkBitmap& bm, bool doFilter, - SkShader::TileMode tmx, - SkShader::TileMode tmy) -{ - switch (bm.getConfig()) { - case SkBitmap::kARGB_8888_Config: - if (doFilter) - return SkNEW_ARGS(ARGB32_Bilinear_Sampler, (bm, tmx, tmy)); - - if (tmx == tmy) { - switch (tmx) { - case SkShader::kClamp_TileMode: - return SkNEW_ARGS(ARGB32_Point_Clamp_Sampler, (bm)); - case SkShader::kRepeat_TileMode: - if (is_pow2(bm.width()) && is_pow2(bm.height())) - return SkNEW_ARGS(ARGB32_Point_Repeat_Pow2_Sampler, (bm)); - else - return SkNEW_ARGS(ARGB32_Point_Repeat_Mod_Sampler, (bm)); - case SkShader::kMirror_TileMode: - if (is_pow2(bm.width()) && is_pow2(bm.height())) - return SkNEW_ARGS(ARGB32_Point_Mirror_Pow2_Sampler, (bm)); - else - return SkNEW_ARGS(ARGB32_Point_Mirror_Mod_Sampler, (bm)); - default: - SkDEBUGFAIL("unknown mode"); - } - } - else { // tmx != tmy - return SkNEW_ARGS(ARGB32_Point_Sampler, (bm, tmx, tmy)); - } - break; - - case SkBitmap::kRGB_565_Config: - if (doFilter) - return SkNEW_ARGS(RGB16_Bilinear_Sampler, (bm, tmx, tmy)); - - if (tmx == tmy) { - switch (tmx) { - case SkShader::kClamp_TileMode: - return SkNEW_ARGS(RGB16_Point_Clamp_Sampler, (bm)); - case SkShader::kRepeat_TileMode: - if (is_pow2(bm.width()) && is_pow2(bm.height())) - return SkNEW_ARGS(RGB16_Point_Repeat_Pow2_Sampler, (bm)); - else - return SkNEW_ARGS(RGB16_Point_Repeat_Mod_Sampler, (bm)); - case SkShader::kMirror_TileMode: - if (is_pow2(bm.width()) && is_pow2(bm.height())) - return SkNEW_ARGS(RGB16_Point_Mirror_Pow2_Sampler, (bm)); - else - return SkNEW_ARGS(RGB16_Point_Mirror_Mod_Sampler, (bm)); - default: - SkDEBUGFAIL("unknown mode"); - } - } - else { // tmx != tmy - return SkNEW_ARGS(RGB16_Point_Sampler, (bm, tmx, tmy)); - } - break; - - case SkBitmap::kIndex8_Config: - if (doFilter) - return SkNEW_ARGS(Index8_Bilinear_Sampler, (bm, tmx, tmy)); - - if (tmx == tmy) { - switch (tmx) { - case SkShader::kClamp_TileMode: - return SkNEW_ARGS(Index8_Point_Clamp_Sampler, (bm)); - case SkShader::kRepeat_TileMode: - if (is_pow2(bm.width()) && is_pow2(bm.height())) - return SkNEW_ARGS(Index8_Point_Repeat_Pow2_Sampler, (bm)); - else - return SkNEW_ARGS(Index8_Point_Repeat_Mod_Sampler, (bm)); - case SkShader::kMirror_TileMode: - if (is_pow2(bm.width()) && is_pow2(bm.height())) - return SkNEW_ARGS(Index8_Point_Mirror_Pow2_Sampler, (bm)); - else - return SkNEW_ARGS(Index8_Point_Mirror_Mod_Sampler, (bm)); - default: - SkDEBUGFAIL("unknown mode"); - } - } - else { // tmx != tmy - return SkNEW_ARGS(Index8_Point_Sampler, (bm, tmx, tmy)); - } - break; - - case SkBitmap::kA8_Config: - if (doFilter) - return SkNEW_ARGS(A8_Bilinear_Sampler, (bm, tmx, tmy)); - else - return SkNEW_ARGS(A8_NoFilter_Sampler, (bm, tmx, tmy)); - break; - - default: - SkDEBUGFAIL("unknown device"); - } - return SkNEW_ARGS(SkNullBitmapSampler, (bm, doFilter, tmx, tmy)); -} diff --git a/src/core/SkBitmapSampler.h b/src/core/SkBitmapSampler.h deleted file mode 100644 index 47ec3313a6..0000000000 --- a/src/core/SkBitmapSampler.h +++ /dev/null @@ -1,162 +0,0 @@ - -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#ifndef SkBitmapSampler_DEFINED -#define SkBitmapSampler_DEFINED - -#include "SkBitmap.h" -#include "SkPaint.h" -#include "SkShader.h" - -typedef int (*SkTileModeProc)(int value, unsigned max); - -class SkBitmapSampler { -public: - SkBitmapSampler(const SkBitmap&, bool filter, SkShader::TileMode tmx, SkShader::TileMode tmy); - virtual ~SkBitmapSampler() {} - - const SkBitmap& getBitmap() const { return fBitmap; } - bool getFilterBitmap() const { return fFilterBitmap; } - SkShader::TileMode getTileModeX() const { return fTileModeX; } - SkShader::TileMode getTileModeY() const { return fTileModeY; } - - /** Given a pixel center at [x,y], return the color sample - */ - virtual SkPMColor sample(SkFixed x, SkFixed y) const = 0; - - virtual void setPaint(const SkPaint& paint); - - // This is the factory for finding an optimal subclass - static SkBitmapSampler* Create(const SkBitmap&, bool filter, - SkShader::TileMode tmx, SkShader::TileMode tmy); - -protected: - const SkBitmap& fBitmap; - uint16_t fMaxX, fMaxY; - bool fFilterBitmap; - SkShader::TileMode fTileModeX; - SkShader::TileMode fTileModeY; - SkTileModeProc fTileProcX; - SkTileModeProc fTileProcY; - - // illegal - SkBitmapSampler& operator=(const SkBitmapSampler&); -}; - -static inline int fixed_clamp(SkFixed x) -{ -#ifdef SK_CPU_HAS_CONDITIONAL_INSTR - if (x >> 16) - x = 0xFFFF; - if (x < 0) - x = 0; -#else - if (x >> 16) - { - if (x < 0) - x = 0; - else - x = 0xFFFF; - } -#endif - return x; -} - -////////////////////////////////////////////////////////////////////////////////////// - -static inline int fixed_repeat(SkFixed x) -{ - return x & 0xFFFF; -} - -static inline int fixed_mirror(SkFixed x) -{ - SkFixed s = x << 15 >> 31; - // s is FFFFFFFF if we're on an odd interval, or 0 if an even interval - return (x ^ s) & 0xFFFF; -} - -static inline bool is_pow2(int count) -{ - SkASSERT(count > 0); - return (count & (count - 1)) == 0; -} - -static inline int do_clamp(int index, unsigned max) -{ - SkASSERT((int)max >= 0); - -#ifdef SK_CPU_HAS_CONDITIONAL_INSTR - if (index > (int)max) - index = max; - if (index < 0) - index = 0; -#else - if ((unsigned)index > max) - { - if (index < 0) - index = 0; - else - index = max; - } -#endif - return index; -} - -static inline int do_repeat_mod(int index, unsigned max) -{ - SkASSERT((int)max >= 0); - - if ((unsigned)index > max) - { - if (index < 0) - index = max - (~index % (max + 1)); - else - index = index % (max + 1); - } - return index; -} - -static inline int do_repeat_pow2(int index, unsigned max) -{ - SkASSERT((int)max >= 0 && is_pow2(max + 1)); - - return index & max; -} - -static inline int do_mirror_mod(int index, unsigned max) -{ - SkASSERT((int)max >= 0); - - // have to handle negatives so that - // -1 -> 0, -2 -> 1, -3 -> 2, etc. - // so we can't just cal abs - index ^= index >> 31; - - if ((unsigned)index > max) - { - int mod = (max + 1) << 1; - index = index % mod; - if ((unsigned)index > max) - index = mod - index - 1; - } - return index; -} - -static inline int do_mirror_pow2(int index, unsigned max) -{ - SkASSERT((int)max >= 0 && is_pow2(max + 1)); - - int s = (index & (max + 1)) - 1; - s = ~(s >> 31); - // at this stage, s is FFFFFFFF if we're on an odd interval, or 0 if an even interval - return (index ^ s) & max; -} - -#endif diff --git a/src/core/SkBitmapSamplerTemplate.h b/src/core/SkBitmapSamplerTemplate.h deleted file mode 100644 index 7b56af7984..0000000000 --- a/src/core/SkBitmapSamplerTemplate.h +++ /dev/null @@ -1,108 +0,0 @@ - -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -/* this guy is pulled in multiple times, with the following symbols defined each time: - - #define BITMAP_CLASSNAME_PREFIX(name) ARGB32##name - #defube BITMAP_PIXEL_TO_PMCOLOR(bitmap, x, y) *bitmap.getAddr32(x, y) -*/ - -class BITMAP_CLASSNAME_PREFIX(_Point_Sampler) : public SkBitmapSampler { -public: - BITMAP_CLASSNAME_PREFIX(_Point_Sampler)(const SkBitmap& bm, SkShader::TileMode tmx, SkShader::TileMode tmy) - : SkBitmapSampler(bm, false, tmx, tmy) - { - } - - virtual SkPMColor sample(SkFixed x, SkFixed y) const - { - x = fTileProcX(SkFixedFloor(x), fMaxX); - y = fTileProcY(SkFixedFloor(y), fMaxY); - return BITMAP_PIXEL_TO_PMCOLOR(fBitmap, x, y); - } -}; - - -class BITMAP_CLASSNAME_PREFIX(_Point_Clamp_Sampler) : public SkBitmapSampler { -public: - BITMAP_CLASSNAME_PREFIX(_Point_Clamp_Sampler)(const SkBitmap& bm) - : SkBitmapSampler(bm, false, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode) - { - } - - virtual SkPMColor sample(SkFixed x, SkFixed y) const - { - x = do_clamp(SkFixedFloor(x), fMaxX); - y = do_clamp(SkFixedFloor(y), fMaxY); - return BITMAP_PIXEL_TO_PMCOLOR(fBitmap, x, y); - } -}; - -class BITMAP_CLASSNAME_PREFIX(_Point_Repeat_Pow2_Sampler) : public SkBitmapSampler { -public: - BITMAP_CLASSNAME_PREFIX(_Point_Repeat_Pow2_Sampler)(const SkBitmap& bm) - : SkBitmapSampler(bm, false, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode) - { - } - - virtual SkPMColor sample(SkFixed x, SkFixed y) const - { - x = do_repeat_pow2(SkFixedFloor(x), fMaxX); - y = do_repeat_pow2(SkFixedFloor(y), fMaxY); - return BITMAP_PIXEL_TO_PMCOLOR(fBitmap, x, y); - } -}; - -class BITMAP_CLASSNAME_PREFIX(_Point_Repeat_Mod_Sampler) : public SkBitmapSampler { -public: - BITMAP_CLASSNAME_PREFIX(_Point_Repeat_Mod_Sampler)(const SkBitmap& bm) - : SkBitmapSampler(bm, false, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode) - { - } - - virtual SkPMColor sample(SkFixed x, SkFixed y) const - { - x = do_repeat_mod(SkFixedFloor(x), fMaxX); - y = do_repeat_mod(SkFixedFloor(y), fMaxY); - return BITMAP_PIXEL_TO_PMCOLOR(fBitmap, x, y); - } -}; - -class BITMAP_CLASSNAME_PREFIX(_Point_Mirror_Pow2_Sampler) : public SkBitmapSampler { -public: - BITMAP_CLASSNAME_PREFIX(_Point_Mirror_Pow2_Sampler)(const SkBitmap& bm) - : SkBitmapSampler(bm, false, SkShader::kMirror_TileMode, SkShader::kMirror_TileMode) - { - } - - virtual SkPMColor sample(SkFixed x, SkFixed y) const - { - x = do_mirror_pow2(SkFixedFloor(x), fMaxX); - y = do_mirror_pow2(SkFixedFloor(y), fMaxY); - return BITMAP_PIXEL_TO_PMCOLOR(fBitmap, x, y); - } -}; - -class BITMAP_CLASSNAME_PREFIX(_Point_Mirror_Mod_Sampler) : public SkBitmapSampler { -public: - BITMAP_CLASSNAME_PREFIX(_Point_Mirror_Mod_Sampler)(const SkBitmap& bm) - : SkBitmapSampler(bm, false, SkShader::kMirror_TileMode, SkShader::kMirror_TileMode) - { - } - - virtual SkPMColor sample(SkFixed x, SkFixed y) const - { - x = do_mirror_mod(SkFixedFloor(x), fMaxX); - y = do_mirror_mod(SkFixedFloor(y), fMaxY); - return BITMAP_PIXEL_TO_PMCOLOR(fBitmap, x, y); - } -}; - -#undef BITMAP_CLASSNAME_PREFIX -#undef BITMAP_PIXEL_TO_PMCOLOR |