1
/* libs/graphics/sgl/SkSpriteBlitterTemplate.h
3
** Copyright 2006, The Android Open Source Project
5
** Licensed under the Apache License, Version 2.0 (the "License");
6
** you may not use this file except in compliance with the License.
7
** You may obtain a copy of the License at
9
** http://www.apache.org/licenses/LICENSE-2.0
11
** Unless required by applicable law or agreed to in writing, software
12
** distributed under the License is distributed on an "AS IS" BASIS,
13
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
** See the License for the specific language governing permissions and
15
** limitations under the License.
19
class SkSPRITE_CLASSNAME : public SkSpriteBlitter {
21
SkSPRITE_CLASSNAME(const SkBitmap& source SkSPRITE_ARGS)
22
: SkSpriteBlitter(source) {
26
virtual void blitRect(int x, int y, int width, int height) {
27
SkASSERT(width > 0 && height > 0);
30
SK_RESTRICT SkSPRITE_DST_TYPE* dst =fDevice->SkSPRITE_DST_GETADDR(x, y);
31
const SK_RESTRICT SkSPRITE_SRC_TYPE* src =
32
fSource->SkSPRITE_SRC_GETADDR(srcX, srcY);
33
unsigned dstRB = fDevice->rowBytes();
34
unsigned srcRB = fSource->rowBytes();
36
SkDEBUGCODE((void)fDevice->SkSPRITE_DST_GETADDR(x + width - 1, y + height - 1);)
37
SkDEBUGCODE((void)fSource->SkSPRITE_SRC_GETADDR(srcX + width - 1, srcY + height - 1);)
39
SkSPRITE_PREAMBLE((*fSource), srcX, srcY);
42
SkSPRITE_DST_TYPE* d = dst;
43
const SkSPRITE_SRC_TYPE* s = src;
44
#ifdef SkSPRITE_BEGIN_ROW
48
#ifdef SkSPRITE_ROW_PROC
49
SkSPRITE_ROW_PROC(d, s, width, x, y);
53
SkSPRITE_SRC_TYPE sc = *s++;
54
SkSPRITE_BLIT_PIXEL(d, sc);
58
dst = (SK_RESTRICT SkSPRITE_DST_TYPE*)((char*)dst + dstRB);
59
src = (const SK_RESTRICT SkSPRITE_SRC_TYPE*)
60
((const char*)src + srcRB);
62
#ifdef SkSPRITE_ROW_PROC
65
} while (--height != 0);
67
SkSPRITE_POSTAMBLE((*fSource));
74
#undef SkSPRITE_BLIT_PIXEL
75
#undef SkSPRITE_CLASSNAME
76
#undef SkSPRITE_DST_TYPE
77
#undef SkSPRITE_SRC_TYPE
78
#undef SkSPRITE_DST_GETADDR
79
#undef SkSPRITE_SRC_GETADDR
80
#undef SkSPRITE_PREAMBLE
81
#undef SkSPRITE_POSTAMBLE
83
#undef SkSPRITE_FIELDS
85
#undef SkSPRITE_NEXT_ROW
86
#undef SkSPRITE_BEGIN_ROW
88
#ifdef SkSPRITE_ROW_PROC
89
#undef SkSPRITE_ROW_PROC