michael@0: michael@0: /* michael@0: * Copyright 2006 The Android Open Source Project michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: michael@0: #if 0 // experimental michael@0: michael@0: class SkProcSpriteBlitter : public SkSpriteBlitter { michael@0: public: michael@0: typedef void (*Proc)(void* dst, const void* src, int count, const SkPMColor ctable[]); michael@0: michael@0: SkProcSpriteBlitter(const SkBitmap& source, Proc proc, unsigned srcShift, unsigned dstShift) michael@0: : SkSpriteBlitter(source), fProc(proc), fSrcShift(SkToU8(srcShift)), fDstShift(SkToU8(dstShift)) {} michael@0: michael@0: virtual void blitRect(int x, int y, int width, int height) michael@0: { michael@0: size_t dstRB = fDevice.rowBytes(); michael@0: size_t srcRB = fSource.rowBytes(); michael@0: char* dst = (char*)fDevice.getPixels() + y * dstRB + (x << fDstShift); michael@0: const char* src = (const char*)fSource.getPixels() + (y - fTop) * srcRB + ((x - fLeft) << fSrcShift); michael@0: Proc proc = fProc; michael@0: const SkPMColor* ctable = NULL; michael@0: michael@0: if fSource.getColorTable()) michael@0: ctable = fSource.getColorTable()->lockColors(); michael@0: michael@0: while (--height >= 0) michael@0: { michael@0: proc(dst, src, width, ctable); michael@0: dst += dstRB; michael@0: src += srcRB; michael@0: } michael@0: michael@0: if fSource.getColorTable()) michael@0: fSource.getColorTable()->unlockColors(); michael@0: } michael@0: michael@0: private: michael@0: Proc fProc; michael@0: uint8_t fSrcShift, fDstShift; michael@0: }; michael@0: michael@0: #endif