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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 fCompressedBuffer.reset(cmpSz); | 198 fCompressedBuffer.reset(cmpSz); |
199 fCompressionMode = kBlitter_CompressionMode; | 199 fCompressionMode = kBlitter_CompressionMode; |
200 } | 200 } |
201 } | 201 } |
202 | 202 |
203 // If we don't have a custom blitter, then we either need a bitmap to compre
ss | 203 // If we don't have a custom blitter, then we either need a bitmap to compre
ss |
204 // from or a bitmap that we're going to use as a texture. In any case, we sh
ould | 204 // from or a bitmap that we're going to use as a texture. In any case, we sh
ould |
205 // allocate the pixels for a bitmap | 205 // allocate the pixels for a bitmap |
206 const SkImageInfo bmImageInfo = SkImageInfo::MakeA8(cmpWidth, cmpHeight); | 206 const SkImageInfo bmImageInfo = SkImageInfo::MakeA8(cmpWidth, cmpHeight); |
207 if (kBlitter_CompressionMode != fCompressionMode) { | 207 if (kBlitter_CompressionMode != fCompressionMode) { |
208 if (!fBM.allocPixels(bmImageInfo)) { | 208 if (!fBM.tryAllocPixels(bmImageInfo)) { |
209 return false; | 209 return false; |
210 } | 210 } |
211 | 211 |
212 sk_bzero(fBM.getPixels(), fBM.getSafeSize()); | 212 sk_bzero(fBM.getPixels(), fBM.getSafeSize()); |
213 } else { | 213 } else { |
214 // Otherwise, we just need to remember how big the buffer is... | 214 // Otherwise, we just need to remember how big the buffer is... |
215 fBM.setInfo(bmImageInfo); | 215 fBM.setInfo(bmImageInfo); |
216 } | 216 } |
217 | 217 |
218 sk_bzero(&fDraw, sizeof(fDraw)); | 218 sk_bzero(&fDraw, sizeof(fDraw)); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 maskMatrix.preConcat(drawState->getViewMatrix()); | 362 maskMatrix.preConcat(drawState->getViewMatrix()); |
363 | 363 |
364 drawState->addCoverageEffect( | 364 drawState->addCoverageEffect( |
365 GrSimpleTextureEffect::Create(texture, | 365 GrSimpleTextureEffect::Create(texture, |
366 maskMatrix, | 366 maskMatrix, |
367 GrTextureParams::kNone_Fi
lterMode, | 367 GrTextureParams::kNone_Fi
lterMode, |
368 kPosition_GrCoordSet))->u
nref(); | 368 kPosition_GrCoordSet))->u
nref(); |
369 | 369 |
370 target->drawSimpleRect(dstRect); | 370 target->drawSimpleRect(dstRect); |
371 } | 371 } |
OLD | NEW |