| twiz@google.com | 6cf5303 | 2012-06-22 18:55:55 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2012 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "picture_utils.h" |
| 9 | #include "SkBitmap.h" |
| 10 | #include "SkPicture.h" |
| 11 | #include "SkString.h" |
| 12 | #include "SkStream.h" |
| 13 | |
| 14 | namespace sk_tools { |
| 15 | |
| 16 | void make_filepath(SkString* path, const char* dir, const SkString& name) { |
| 17 | size_t len = strlen(dir); |
| 18 | path->set(dir); |
| 19 | if (0 < len && '/' != dir[len - 1]) { |
| 20 | path->append("/"); |
| 21 | } |
| 22 | path->append(name); |
| 23 | } |
| 24 | |
| 25 | void setup_bitmap(SkBitmap* bitmap, int width, int height) { |
| 26 | bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height); |
| 27 | bitmap->allocPixels(); |
| 28 | bitmap->eraseColor(0); |
| 29 | } |
| 30 | |
| 31 | } |