gfx/skia/trunk/src/core/SkProcSpriteBlitter.cpp

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     2 /*
     3  * Copyright 2006 The Android Open Source Project
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
    10 #if 0   // experimental
    12 class SkProcSpriteBlitter : public SkSpriteBlitter {
    13 public:
    14     typedef void (*Proc)(void* dst, const void* src, int count, const SkPMColor ctable[]);
    16     SkProcSpriteBlitter(const SkBitmap& source, Proc proc, unsigned srcShift, unsigned dstShift)
    17         : SkSpriteBlitter(source), fProc(proc), fSrcShift(SkToU8(srcShift)), fDstShift(SkToU8(dstShift)) {}
    19     virtual void blitRect(int x, int y, int width, int height)
    20     {
    21         size_t      dstRB = fDevice.rowBytes();
    22         size_t      srcRB = fSource.rowBytes();
    23         char*       dst = (char*)fDevice.getPixels() + y * dstRB + (x << fDstShift);
    24         const char* src = (const char*)fSource.getPixels() + (y - fTop) * srcRB + ((x - fLeft) << fSrcShift);
    25         Proc        proc = fProc;
    26         const SkPMColor* ctable = NULL;
    28         if fSource.getColorTable())
    29             ctable = fSource.getColorTable()->lockColors();
    31         while (--height >= 0)
    32         {
    33             proc(dst, src, width, ctable);
    34             dst += dstRB;
    35             src += srcRB;
    36         }
    38         if fSource.getColorTable())
    39             fSource.getColorTable()->unlockColors();
    40     }
    42 private:
    43     Proc    fProc;
    44     uint8_t fSrcShift, fDstShift;
    45 };
    47 #endif

mercurial