1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/core/SkProcSpriteBlitter.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,47 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2006 The Android Open Source Project 1.7 + * 1.8 + * Use of this source code is governed by a BSD-style license that can be 1.9 + * found in the LICENSE file. 1.10 + */ 1.11 + 1.12 + 1.13 +#if 0 // experimental 1.14 + 1.15 +class SkProcSpriteBlitter : public SkSpriteBlitter { 1.16 +public: 1.17 + typedef void (*Proc)(void* dst, const void* src, int count, const SkPMColor ctable[]); 1.18 + 1.19 + SkProcSpriteBlitter(const SkBitmap& source, Proc proc, unsigned srcShift, unsigned dstShift) 1.20 + : SkSpriteBlitter(source), fProc(proc), fSrcShift(SkToU8(srcShift)), fDstShift(SkToU8(dstShift)) {} 1.21 + 1.22 + virtual void blitRect(int x, int y, int width, int height) 1.23 + { 1.24 + size_t dstRB = fDevice.rowBytes(); 1.25 + size_t srcRB = fSource.rowBytes(); 1.26 + char* dst = (char*)fDevice.getPixels() + y * dstRB + (x << fDstShift); 1.27 + const char* src = (const char*)fSource.getPixels() + (y - fTop) * srcRB + ((x - fLeft) << fSrcShift); 1.28 + Proc proc = fProc; 1.29 + const SkPMColor* ctable = NULL; 1.30 + 1.31 + if fSource.getColorTable()) 1.32 + ctable = fSource.getColorTable()->lockColors(); 1.33 + 1.34 + while (--height >= 0) 1.35 + { 1.36 + proc(dst, src, width, ctable); 1.37 + dst += dstRB; 1.38 + src += srcRB; 1.39 + } 1.40 + 1.41 + if fSource.getColorTable()) 1.42 + fSource.getColorTable()->unlockColors(); 1.43 + } 1.44 + 1.45 +private: 1.46 + Proc fProc; 1.47 + uint8_t fSrcShift, fDstShift; 1.48 +}; 1.49 + 1.50 +#endif