| 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 |
| 11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
| 12 #include "SkBlitter.h" | 12 #include "SkBlitter.h" |
| 13 | 13 |
| 14 namespace SkTextureCompressor { | 14 namespace SkTextureCompressor { |
| 15 | 15 |
| 16 // Ostensibly, SkBlitter::BlitRect is supposed to set a rect of pixels to full | 16 // Ostensibly, SkBlitter::BlitRect is supposed to set a rect of pixels to full |
| 17 // alpha. This becomes problematic when using compressed texture blitters, since | 17 // alpha. This becomes problematic when using compressed texture blitters, since |
| 18 // the rect rarely falls along block boundaries. The proper way to handle this i
s | 18 // the rect rarely falls along block boundaries. The proper way to handle this i
s |
| 19 // to update the compressed encoding of a block by resetting the proper paramete
rs | 19 // to update the compressed encoding of a block by resetting the proper paramete
rs |
| 20 // (and even recompressing the block) where a rect falls inbetween block boundar
ies. | 20 // (and even recompressing the block) where a rect falls inbetween block boundar
ies. |
| 21 // PEDANTIC_BLIT_RECT attempts to do this by requiring the struct passed to | 21 // PEDANTIC_BLIT_RECT attempts to do this by requiring the struct passed to |
| 22 // SkTCompressedAlphaBlitter to implement an UpdateBlock function call. | 22 // SkTCompressedAlphaBlitter to implement an UpdateBlock function call. |
| 23 // | 23 // |
| 24 // However, the way that BlitRect gets used almost exclusively is to bracket inv
erse | 24 // However, the way that BlitRect gets used almost exclusively is to bracket inv
erse |
| 25 // fills for paths. In other words, the top few rows and bottom few rows of a pa
th | 25 // fills for paths. In other words, the top few rows and bottom few rows of a pa
th |
| 26 // that's getting inverse filled are called using blitRect. The rest are called
using | 26 // that's getting inverse filled are called using blitRect. The rest are called
using |
| 27 // the standard blitAntiH. As a result, we can just call blitAntiH with a faux
RLE | 27 // the standard blitAntiH. As a result, we can just call blitAntiH with a faux
RLE |
| 28 // of full alpha values, and then check in our flush() call that we don't run of
f the | 28 // of full alpha values, and then check in our flush() call that we don't run of
f the |
| 29 // edge of the buffer. This is why we do not need this flag to be turned on. | 29 // edge of the buffer. This is why we do not need this flag to be turned on. |
| 30 #define PEDANTIC_BLIT_RECT 1 | 30 // |
| 31 // NOTE: This code is unfinished, but is inteded as a starting point if an when |
| 32 // bugs are introduced from the existing code. |
| 33 #define PEDANTIC_BLIT_RECT 0 |
| 31 | 34 |
| 32 // This class implements a blitter that blits directly into a buffer that will | 35 // This class implements a blitter that blits directly into a buffer that will |
| 33 // be used as an compressed alpha texture. We compute this buffer by | 36 // be used as an compressed alpha texture. We compute this buffer by |
| 34 // buffering scan lines and then outputting them all at once. The number of | 37 // buffering scan lines and then outputting them all at once. The number of |
| 35 // scan lines buffered is controlled by kBlockSize | 38 // scan lines buffered is controlled by kBlockSize |
| 36 // | 39 // |
| 37 // The CompressorType is a struct with a bunch of static methods that provides | 40 // The CompressorType is a struct with a bunch of static methods that provides |
| 38 // the specialized compression functionality of the blitter. A complete Compress
orType | 41 // the specialized compression functionality of the blitter. A complete Compress
orType |
| 39 // will implement the following static functions; | 42 // will implement the following static functions; |
| 40 // | 43 // |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 mask, BlockDim, mask); | 723 mask, BlockDim, mask); |
| 721 } | 724 } |
| 722 } | 725 } |
| 723 #endif // PEDANTIC_BLIT_RECT | 726 #endif // PEDANTIC_BLIT_RECT |
| 724 | 727 |
| 725 }; | 728 }; |
| 726 | 729 |
| 727 } // namespace SkTextureCompressor | 730 } // namespace SkTextureCompressor |
| 728 | 731 |
| 729 #endif // SkTextureCompressor_Blitter_DEFINED | 732 #endif // SkTextureCompressor_Blitter_DEFINED |
| OLD | NEW |