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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 left = subset->fLeft; | 171 left = subset->fLeft; |
172 width = subset->width(); | 172 width = subset->width(); |
173 top = subset->fTop; | 173 top = subset->fTop; |
174 height = subset->height(); | 174 height = subset->height(); |
175 } else { | 175 } else { |
176 left = 0; | 176 left = 0; |
177 width = fSurface->width(); | 177 width = fSurface->width(); |
178 top = 0; | 178 top = 0; |
179 height = fSurface->height(); | 179 height = fSurface->height(); |
180 } | 180 } |
181 dst->setConfig(SkBitmap::kARGB_8888_Config, width, height); | 181 if (!dst->allocPixels(SkImageInfo::MakeN32Premul(width, height))) { |
182 if (!dst->allocPixels()) { | |
183 SkDebugf("SkGrPixelRef::onReadPixels failed to alloc bitmap for result!\
n"); | 182 SkDebugf("SkGrPixelRef::onReadPixels failed to alloc bitmap for result!\
n"); |
184 return false; | 183 return false; |
185 } | 184 } |
186 SkAutoLockPixels al(*dst); | 185 SkAutoLockPixels al(*dst); |
187 void* buffer = dst->getPixels(); | 186 void* buffer = dst->getPixels(); |
188 return fSurface->readPixels(left, top, width, height, | 187 return fSurface->readPixels(left, top, width, height, |
189 kSkia8888_GrPixelConfig, | 188 kSkia8888_GrPixelConfig, |
190 buffer, dst->rowBytes()); | 189 buffer, dst->rowBytes()); |
191 } | 190 } |
OLD | NEW |