OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |