OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
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 #ifndef SkTextureCompressor_Blitter_DEFINED | 8 #ifndef SkTextureCompressor_Blitter_DEFINED |
9 #define SkTextureCompressor_Blitter_DEFINED | 9 #define SkTextureCompressor_Blitter_DEFINED |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 virtual ~SkTCompressedAlphaBlitter() { this->flushRuns(); } | 85 virtual ~SkTCompressedAlphaBlitter() { this->flushRuns(); } |
86 | 86 |
87 // Blit a horizontal run of one or more pixels. | 87 // Blit a horizontal run of one or more pixels. |
88 void blitH(int x, int y, int width) override { | 88 void blitH(int x, int y, int width) override { |
89 // This function is intended to be called from any standard RGB | 89 // This function is intended to be called from any standard RGB |
90 // buffer, so we should never encounter it. However, if some code | 90 // buffer, so we should never encounter it. However, if some code |
91 // path does end up here, then this needs to be investigated. | 91 // path does end up here, then this needs to be investigated. |
92 SkFAIL("Not implemented!"); | 92 SkFAIL("Not implemented!"); |
93 } | 93 } |
94 | 94 |
95 // Blit a horizontal run of antialiased pixels; runs[] is a *sparse* | 95 // Blit a horizontal run of antialiased pixels; runs[] is a *sparse* |
96 // zero-terminated run-length encoding of spans of constant alpha values. | 96 // zero-terminated run-length encoding of spans of constant alpha values. |
97 virtual void blitAntiH(int x, int y, | 97 void blitAntiH(int x, int y, |
98 const SkAlpha antialias[], | 98 const SkAlpha antialias[], |
99 const int16_t runs[]) override { | 99 const int16_t runs[]) override { |
100 SkASSERT(0 == x); | 100 SkASSERT(0 == x); |
101 | 101 |
102 // Make sure that the new row to blit is either the first | 102 // Make sure that the new row to blit is either the first |
103 // row that we're blitting, or it's exactly the next scan row | 103 // row that we're blitting, or it's exactly the next scan row |
104 // since the last row that we blit. This is to ensure that when | 104 // since the last row that we blit. This is to ensure that when |
105 // we go to flush the runs, that they are all the same four | 105 // we go to flush the runs, that they are all the same four |
106 // runs. | 106 // runs. |
107 if (fNextRun > 0 && | 107 if (fNextRun > 0 && |
108 ((x != fBufferedRuns[fNextRun-1].fX) || | 108 ((x != fBufferedRuns[fNextRun-1].fX) || |
109 (y-1 != fBufferedRuns[fNextRun-1].fY))) { | 109 (y-1 != fBufferedRuns[fNextRun-1].fY))) { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 this->updateBlockRow(x, y, width, height, endBlockY, | 271 this->updateBlockRow(x, y, width, height, endBlockY, |
272 startBlockX, endBlockX); | 272 startBlockX, endBlockX); |
273 } | 273 } |
274 } | 274 } |
275 #endif | 275 #endif |
276 } | 276 } |
277 | 277 |
278 // Blit a rectangle with one alpha-blended column on the left, | 278 // Blit a rectangle with one alpha-blended column on the left, |
279 // width (zero or more) opaque pixels, and one alpha-blended column | 279 // width (zero or more) opaque pixels, and one alpha-blended column |
280 // on the right. The result will always be at least two pixels wide. | 280 // on the right. The result will always be at least two pixels wide. |
281 virtual void blitAntiRect(int x, int y, int width, int height, | 281 void blitAntiRect(int x, int y, int width, int height, |
282 SkAlpha leftAlpha, SkAlpha rightAlpha) override { | 282 SkAlpha leftAlpha, SkAlpha rightAlpha) override { |
283 // This function is currently not implemented. It is not explicitly | 283 // This function is currently not implemented. It is not explicitly |
284 // required by the contract, but if at some time a code path runs into | 284 // required by the contract, but if at some time a code path runs into |
285 // this function (which is entirely possible), it needs to be implemente
d. | 285 // this function (which is entirely possible), it needs to be implemente
d. |
286 // | 286 // |
287 // TODO (krajcevski): | 287 // TODO (krajcevski): |
288 // This function will be most easily implemented as follows: | 288 // This function will be most easily implemented as follows: |
289 // 1. If width/height are smaller than a block, then update the | 289 // 1. If width/height are smaller than a block, then update the |
290 // indices of the affected blocks. | 290 // indices of the affected blocks. |
291 // 2. If width/height are larger than a block, then construct a 9-patch | 291 // 2. If width/height are larger than a block, then construct a 9-patch |
292 // of block encodings that represent the rectangle, and write them | 292 // of block encodings that represent the rectangle, and write them |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 mask, BlockDim, mask); | 724 mask, BlockDim, mask); |
725 } | 725 } |
726 } | 726 } |
727 #endif // PEDANTIC_BLIT_RECT | 727 #endif // PEDANTIC_BLIT_RECT |
728 | 728 |
729 }; | 729 }; |
730 | 730 |
731 } // namespace SkTextureCompressor | 731 } // namespace SkTextureCompressor |
732 | 732 |
733 #endif // SkTextureCompressor_Blitter_DEFINED | 733 #endif // SkTextureCompressor_Blitter_DEFINED |
OLD | NEW |