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