| 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 "SkBlitter.h" | 8 #include "SkBlitter.h" |
| 9 #include "SkAntiRun.h" | 9 #include "SkAntiRun.h" |
| 10 #include "SkColor.h" | 10 #include "SkColor.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 void SkBlitter::blitRect(int x, int y, int width, int height) { | 67 void SkBlitter::blitRect(int x, int y, int width, int height) { |
| 68 SkASSERT(width > 0); | 68 SkASSERT(width > 0); |
| 69 while (--height >= 0) { | 69 while (--height >= 0) { |
| 70 this->blitH(x, y++, width); | 70 this->blitH(x, y++, width); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 /// Default implementation doesn't check for easy optimizations | 74 /// Default implementation doesn't check for any easy optimizations |
| 75 /// such as alpha == 255; also uses blitV(), which some subclasses | 75 /// such as alpha == 0 or 255; also uses blitV(), which some subclasses |
| 76 /// may not support. | 76 /// may not support. |
| 77 void SkBlitter::blitAntiRect(int x, int y, int width, int height, | 77 void SkBlitter::blitAntiRect(int x, int y, int width, int height, |
| 78 SkAlpha leftAlpha, SkAlpha rightAlpha) { | 78 SkAlpha leftAlpha, SkAlpha rightAlpha) { |
| 79 if (leftAlpha > 0) { // we may send in x = -1 with leftAlpha = 0 | 79 this->blitV(x++, y, height, leftAlpha); |
| 80 this->blitV(x, y, height, leftAlpha); | |
| 81 } | |
| 82 x++; | |
| 83 if (width > 0) { | 80 if (width > 0) { |
| 84 this->blitRect(x, y, width, height); | 81 this->blitRect(x, y, width, height); |
| 85 x += width; | 82 x += width; |
| 86 } | 83 } |
| 87 if (rightAlpha > 0) { | 84 this->blitV(x, y, height, rightAlpha); |
| 88 this->blitV(x, y, height, rightAlpha); | |
| 89 } | |
| 90 } | 85 } |
| 91 | 86 |
| 92 ////////////////////////////////////////////////////////////////////////////// | 87 ////////////////////////////////////////////////////////////////////////////// |
| 93 | 88 |
| 94 static inline void bits_to_runs(SkBlitter* blitter, int x, int y, | 89 static inline void bits_to_runs(SkBlitter* blitter, int x, int y, |
| 95 const uint8_t bits[], | 90 const uint8_t bits[], |
| 96 uint8_t left_mask, ptrdiff_t rowBytes, | 91 uint8_t left_mask, ptrdiff_t rowBytes, |
| 97 uint8_t right_mask) { | 92 uint8_t right_mask) { |
| 98 int inFill = 0; | 93 int inFill = 0; |
| 99 int pos = 0; | 94 int pos = 0; |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 fShaderContext->~Context(); | 1009 fShaderContext->~Context(); |
| 1015 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); | 1010 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); |
| 1016 if (nullptr == ctx) { | 1011 if (nullptr == ctx) { |
| 1017 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call | 1012 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call |
| 1018 // the in-place destructor. | 1013 // the in-place destructor. |
| 1019 new (fShaderContext) SkZeroShaderContext(*fShader, rec); | 1014 new (fShaderContext) SkZeroShaderContext(*fShader, rec); |
| 1020 return false; | 1015 return false; |
| 1021 } | 1016 } |
| 1022 return true; | 1017 return true; |
| 1023 } | 1018 } |
| OLD | NEW |