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

Side by Side Diff: src/gpu/SkGrPixelRef.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/gpu/GrSurface.cpp ('k') | src/image/SkImage.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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 left = subset->fLeft; 163 left = subset->fLeft;
164 width = subset->width(); 164 width = subset->width();
165 top = subset->fTop; 165 top = subset->fTop;
166 height = subset->height(); 166 height = subset->height();
167 } else { 167 } else {
168 left = 0; 168 left = 0;
169 width = this->info().fWidth; 169 width = this->info().fWidth;
170 top = 0; 170 top = 0;
171 height = this->info().fHeight; 171 height = this->info().fHeight;
172 } 172 }
173 if (!dst->allocPixels(SkImageInfo::MakeN32Premul(width, height))) { 173 if (!dst->tryAllocN32Pixels(width, height)) {
174 SkDebugf("SkGrPixelRef::onReadPixels failed to alloc bitmap for result!\ n"); 174 SkDebugf("SkGrPixelRef::onReadPixels failed to alloc bitmap for result!\ n");
175 return false; 175 return false;
176 } 176 }
177 SkAutoLockPixels al(*dst); 177 SkAutoLockPixels al(*dst);
178 void* buffer = dst->getPixels(); 178 void* buffer = dst->getPixels();
179 return fSurface->readPixels(left, top, width, height, 179 return fSurface->readPixels(left, top, width, height,
180 kSkia8888_GrPixelConfig, 180 kSkia8888_GrPixelConfig,
181 buffer, dst->rowBytes()); 181 buffer, dst->rowBytes());
182 } 182 }
OLDNEW
« no previous file with comments | « src/gpu/GrSurface.cpp ('k') | src/image/SkImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698