OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
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 #include "SkTypes.h" | 10 #include "SkTypes.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 num[1] = (char) (num[1] + fSeqVal / 10 % 10); | 53 num[1] = (char) (num[1] + fSeqVal / 10 % 10); |
54 num[2] = (char) (num[2] + fSeqVal % 10); | 54 num[2] = (char) (num[2] + fSeqVal % 10); |
55 name.append(num); | 55 name.append(num); |
56 if (++fSeqVal > 999) | 56 if (++fSeqVal > 999) |
57 sequence = false; | 57 sequence = false; |
58 } | 58 } |
59 if (type == SkImageEncoder::kJPEG_Type) | 59 if (type == SkImageEncoder::kJPEG_Type) |
60 name.append(".jpg"); | 60 name.append(".jpg"); |
61 else if (type == SkImageEncoder::kPNG_Type) | 61 else if (type == SkImageEncoder::kPNG_Type) |
62 name.append(".png"); | 62 name.append(".png"); |
63 encoder->encodeFile(name.c_str(), | 63 |
64 maker.fCanvas->getDevice()->accessBitmap(false), | 64 SkBitmap pixels; |
65 SkScalarFloorToInt(quality)); | 65 pixels.allocPixels(maker.fCanvas->imageInfo()); |
| 66 maker.fCanvas->readPixels(&pixels, 0, 0); |
| 67 encoder->encodeFile(name.c_str(), pixels, SkScalarFloorToInt(quality)); |
66 return false; | 68 return false; |
67 } | 69 } |
OLD | NEW |