| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2006 The Android Open Source Project | 2  * Copyright 2006 The Android Open Source Project | 
| 3  * | 3  * | 
| 4  * Use of this source code is governed by a BSD-style license that can be | 4  * Use of this source code is governed by a BSD-style license that can be | 
| 5  * found in the LICENSE file. | 5  * found in the LICENSE file. | 
| 6  */ | 6  */ | 
| 7 | 7 | 
| 8 #include "SkSmallAllocator.h" | 8 #include "SkSmallAllocator.h" | 
| 9 #include "SkSpriteBlitter.h" | 9 #include "SkSpriteBlitter.h" | 
| 10 | 10 | 
| 11 SkSpriteBlitter::SkSpriteBlitter(const SkBitmap& source) | 11 SkSpriteBlitter::SkSpriteBlitter(const SkBitmap& source) : fSource(NULL) { | 
| 12         : fSource(&source) { | 12     if (source.requestLock(&fUnlocker)) { | 
| 13     fSource->lockPixels(); | 13         fSource = &fUnlocker.pixmap(); | 
|  | 14     } | 
| 14 } | 15 } | 
| 15 | 16 | 
| 16 SkSpriteBlitter::~SkSpriteBlitter() { | 17 bool SkSpriteBlitter::setup(const SkBitmap& device, int left, int top, const SkP
    aint& paint) { | 
| 17     fSource->unlockPixels(); | 18     if (NULL == fSource) { | 
| 18 } | 19         return false; | 
| 19 | 20     } | 
| 20 void SkSpriteBlitter::setup(const SkBitmap& device, int left, int top, |  | 
| 21                             const SkPaint& paint) { |  | 
| 22     fDevice = &device; | 21     fDevice = &device; | 
| 23     fLeft = left; | 22     fLeft = left; | 
| 24     fTop = top; | 23     fTop = top; | 
| 25     fPaint = &paint; | 24     fPaint = &paint; | 
|  | 25     return true; | 
| 26 } | 26 } | 
| 27 | 27 | 
| 28 #ifdef SK_DEBUG | 28 #ifdef SK_DEBUG | 
| 29 void SkSpriteBlitter::blitH(int x, int y, int width) { | 29 void SkSpriteBlitter::blitH(int x, int y, int width) { | 
| 30     SkDEBUGFAIL("how did we get here?"); | 30     SkDEBUGFAIL("how did we get here?"); | 
| 31 } | 31 } | 
| 32 | 32 | 
| 33 void SkSpriteBlitter::blitAntiH(int x, int y, const SkAlpha antialias[], | 33 void SkSpriteBlitter::blitAntiH(int x, int y, const SkAlpha antialias[], | 
| 34                                 const int16_t runs[]) { | 34                                 const int16_t runs[]) { | 
| 35     SkDEBUGFAIL("how did we get here?"); | 35     SkDEBUGFAIL("how did we get here?"); | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 69             break; | 69             break; | 
| 70         case kN32_SkColorType: | 70         case kN32_SkColorType: | 
| 71             blitter = SkSpriteBlitter::ChooseD32(source, paint, allocator); | 71             blitter = SkSpriteBlitter::ChooseD32(source, paint, allocator); | 
| 72             break; | 72             break; | 
| 73         default: | 73         default: | 
| 74             blitter = NULL; | 74             blitter = NULL; | 
| 75             break; | 75             break; | 
| 76     } | 76     } | 
| 77 | 77 | 
| 78     if (blitter) { | 78     if (blitter) { | 
| 79         blitter->setup(device, left, top, paint); | 79         if (!blitter->setup(device, left, top, paint)) { | 
|  | 80             // blitter was allocated by allocator, so we have to manually call i
    ts destructor | 
|  | 81             blitter->~SkSpriteBlitter(); | 
|  | 82             blitter = NULL; | 
|  | 83         } | 
| 80     } | 84     } | 
| 81     return blitter; | 85     return blitter; | 
| 82 } | 86 } | 
| OLD | NEW | 
|---|