| OLD | NEW |
| 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 "picture_utils.h" | 8 #include "picture_utils.h" |
| 9 #include "CopyTilesRenderer.h" | 9 #include "CopyTilesRenderer.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // Similar to writeAppendNumber in PictureRenderer.c
pp, but just encodes | 63 // Similar to writeAppendNumber in PictureRenderer.c
pp, but just encodes |
| 64 // a bitmap directly. | 64 // a bitmap directly. |
| 65 SkString pathWithNumber(*path); | 65 SkString pathWithNumber(*path); |
| 66 pathWithNumber.appendf("%i.png", i++); | 66 pathWithNumber.appendf("%i.png", i++); |
| 67 SkBitmap copy; | 67 SkBitmap copy; |
| 68 #if SK_SUPPORT_GPU | 68 #if SK_SUPPORT_GPU |
| 69 if (isUsingGpuDevice()) { | 69 if (isUsingGpuDevice()) { |
| 70 dst.pixelRef()->readPixels(©, &subset); | 70 dst.pixelRef()->readPixels(©, &subset); |
| 71 } else { | 71 } else { |
| 72 #endif | 72 #endif |
| 73 dst.copyTo(©, dst.config()); | 73 dst.copyTo(©); |
| 74 #if SK_SUPPORT_GPU | 74 #if SK_SUPPORT_GPU |
| 75 } | 75 } |
| 76 #endif | 76 #endif |
| 77 success &= SkImageEncoder::EncodeFile(pathWithNumber
.c_str(), copy, | 77 success &= SkImageEncoder::EncodeFile(pathWithNumber
.c_str(), copy, |
| 78 SkImageEncoder
::kPNG_Type, 100); | 78 SkImageEncoder
::kPNG_Type, 100); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 return success; | 84 return success; |
| 85 } | 85 } |
| 86 | 86 |
| 87 SkString CopyTilesRenderer::getConfigNameInternal() { | 87 SkString CopyTilesRenderer::getConfigNameInternal() { |
| 88 return SkString("copy_tiles"); | 88 return SkString("copy_tiles"); |
| 89 } | 89 } |
| 90 } | 90 } |
| OLD | NEW |