OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "GrSWMaskHelper.h" | 8 #include "GrSWMaskHelper.h" |
9 | 9 |
10 #include "GrDrawState.h" | 10 #include "GrDrawState.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 resultBounds.height()); | 117 resultBounds.height()); |
118 | 118 |
119 #if GR_COMPRESS_ALPHA_MASK | 119 #if GR_COMPRESS_ALPHA_MASK |
120 fCompressedFormat = SkTextureCompressor::kR11_EAC_Format; | 120 fCompressedFormat = SkTextureCompressor::kR11_EAC_Format; |
121 | 121 |
122 // Make sure that the width is a multiple of 16 so that we can use | 122 // Make sure that the width is a multiple of 16 so that we can use |
123 // specialized SIMD instructions that compress 4 blocks at a time. | 123 // specialized SIMD instructions that compress 4 blocks at a time. |
124 int dimX, dimY; | 124 int dimX, dimY; |
125 SkTextureCompressor::GetBlockDimensions(fCompressedFormat, &dimX, &dimY); | 125 SkTextureCompressor::GetBlockDimensions(fCompressedFormat, &dimX, &dimY); |
126 const int cmpWidth = dimX * ((bounds.fRight + (dimX - 1)) / dimX); | 126 const int cmpWidth = dimX * ((bounds.fRight + (dimX - 1)) / dimX); |
127 const int cmpHeight = dimY * ((bounds.fRight + (dimY - 1)) / dimY); | 127 const int cmpHeight = dimY * ((bounds.fBottom + (dimY - 1)) / dimY); |
128 #else | 128 #else |
129 const int cmpWidth = bounds.fRight; | 129 const int cmpWidth = bounds.fRight; |
130 const int cmpHeight = bounds.fBottom; | 130 const int cmpHeight = bounds.fBottom; |
131 #endif | 131 #endif |
132 | 132 |
133 if (!fBM.allocPixels(SkImageInfo::MakeA8(cmpWidth, cmpHeight))) { | 133 if (!fBM.allocPixels(SkImageInfo::MakeA8(cmpWidth, cmpHeight))) { |
134 return false; | 134 return false; |
135 } | 135 } |
136 | 136 |
137 sk_bzero(fBM.getPixels(), fBM.getSafeSize()); | 137 sk_bzero(fBM.getPixels(), fBM.getSafeSize()); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 maskMatrix.preConcat(drawState->getViewMatrix()); | 293 maskMatrix.preConcat(drawState->getViewMatrix()); |
294 | 294 |
295 drawState->addCoverageEffect( | 295 drawState->addCoverageEffect( |
296 GrSimpleTextureEffect::Create(texture, | 296 GrSimpleTextureEffect::Create(texture, |
297 maskMatrix, | 297 maskMatrix, |
298 GrTextureParams::kNone_Fi
lterMode, | 298 GrTextureParams::kNone_Fi
lterMode, |
299 kPosition_GrCoordSet))->u
nref(); | 299 kPosition_GrCoordSet))->u
nref(); |
300 | 300 |
301 target->drawSimpleRect(dstRect); | 301 target->drawSimpleRect(dstRect); |
302 } | 302 } |
OLD | NEW |