Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: src/gpu/GrSWMaskHelper.cpp

Issue 510423005: make allocPixels throw on failure (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkMorphologyImageFilter.cpp ('k') | src/gpu/GrSurface.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/effects/SkMorphologyImageFilter.cpp ('k') | src/gpu/GrSurface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698