| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "sk_tool_utils.h" | 8 #include "sk_tool_utils.h" |
| 9 #include "sk_tool_utils_flags.h" | 9 #include "sk_tool_utils_flags.h" |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 void set_portable_typeface(SkPaint* paint, const char* name, SkTypeface::Style s
tyle) { | 47 void set_portable_typeface(SkPaint* paint, const char* name, SkTypeface::Style s
tyle) { |
| 48 SkTypeface* face = create_portable_typeface(name, style); | 48 SkTypeface* face = create_portable_typeface(name, style); |
| 49 SkSafeUnref(paint->setTypeface(face)); | 49 SkSafeUnref(paint->setTypeface(face)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void write_pixels(SkCanvas* canvas, const SkBitmap& bitmap, int x, int y, | 52 void write_pixels(SkCanvas* canvas, const SkBitmap& bitmap, int x, int y, |
| 53 SkColorType colorType, SkAlphaType alphaType) { | 53 SkColorType colorType, SkAlphaType alphaType) { |
| 54 SkBitmap tmp(bitmap); | 54 SkBitmap tmp(bitmap); |
| 55 tmp.lockPixels(); | 55 tmp.lockPixels(); |
| 56 | 56 |
| 57 SkImageInfo info = tmp.info(); | 57 const SkImageInfo info = SkImageInfo::Make(tmp.width(), tmp.height(), colorT
ype, alphaType); |
| 58 info.fColorType = colorType; | |
| 59 info.fAlphaType = alphaType; | |
| 60 | 58 |
| 61 canvas->writePixels(info, tmp.getPixels(), tmp.rowBytes(), x, y); | 59 canvas->writePixels(info, tmp.getPixels(), tmp.rowBytes(), x, y); |
| 62 } | 60 } |
| 63 | 61 |
| 64 } // namespace sk_tool_utils | 62 } // namespace sk_tool_utils |
| OLD | NEW |