| OLD | NEW |
| (Empty) |
| 1 /* libs/graphics/sgl/SkSpriteBlitterTemplate.h | |
| 2 ** | |
| 3 ** Copyright 2006, The Android Open Source Project | |
| 4 ** | |
| 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 | |
| 8 ** | |
| 9 ** http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 ** | |
| 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. | |
| 16 */ | |
| 17 | |
| 18 | |
| 19 class SkSPRITE_CLASSNAME : public SkSpriteBlitter { | |
| 20 public: | |
| 21 SkSPRITE_CLASSNAME(const SkBitmap& source SkSPRITE_ARGS) | |
| 22 : SkSpriteBlitter(source) { | |
| 23 SkSPRITE_INIT | |
| 24 } | |
| 25 | |
| 26 virtual void blitRect(int x, int y, int width, int height) { | |
| 27 SkASSERT(width > 0 && height > 0); | |
| 28 int srcX = x - fLeft; | |
| 29 int srcY = y - fTop; | |
| 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(); | |
| 35 | |
| 36 SkDEBUGCODE((void)fDevice->SkSPRITE_DST_GETADDR(x + width - 1, y + heigh
t - 1);) | |
| 37 SkDEBUGCODE((void)fSource->SkSPRITE_SRC_GETADDR(srcX + width - 1, srcY
+ height - 1);) | |
| 38 | |
| 39 SkSPRITE_PREAMBLE((*fSource), srcX, srcY); | |
| 40 | |
| 41 do { | |
| 42 SkSPRITE_DST_TYPE* d = dst; | |
| 43 const SkSPRITE_SRC_TYPE* s = src; | |
| 44 #ifdef SkSPRITE_BEGIN_ROW | |
| 45 SkSPRITE_BEGIN_ROW | |
| 46 #endif | |
| 47 | |
| 48 #ifdef SkSPRITE_ROW_PROC | |
| 49 SkSPRITE_ROW_PROC(d, s, width, x, y); | |
| 50 #else | |
| 51 int w = width; | |
| 52 do { | |
| 53 SkSPRITE_SRC_TYPE sc = *s++; | |
| 54 SkSPRITE_BLIT_PIXEL(d, sc); | |
| 55 d += 1; | |
| 56 } while (--w != 0); | |
| 57 #endif | |
| 58 dst = (SK_RESTRICT SkSPRITE_DST_TYPE*)((char*)dst + dstRB); | |
| 59 src = (const SK_RESTRICT SkSPRITE_SRC_TYPE*) | |
| 60 ((const char*)src + srcRB); | |
| 61 SkSPRITE_NEXT_ROW | |
| 62 #ifdef SkSPRITE_ROW_PROC | |
| 63 y += 1; | |
| 64 #endif | |
| 65 } while (--height != 0); | |
| 66 | |
| 67 SkSPRITE_POSTAMBLE((*fSource)); | |
| 68 } | |
| 69 | |
| 70 private: | |
| 71 SkSPRITE_FIELDS | |
| 72 }; | |
| 73 | |
| 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 | |
| 82 #undef SkSPRITE_ARGS | |
| 83 #undef SkSPRITE_FIELDS | |
| 84 #undef SkSPRITE_INIT | |
| 85 #undef SkSPRITE_NEXT_ROW | |
| 86 #undef SkSPRITE_BEGIN_ROW | |
| 87 | |
| 88 #ifdef SkSPRITE_ROW_PROC | |
| 89 #undef SkSPRITE_ROW_PROC | |
| 90 #endif | |
| 91 | |
| OLD | NEW |