Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1385)

Side by Side Diff: tools/sk_tool_utils.cpp

Issue 536003002: Hide fields in SkImageInfo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix qt Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/LazyDecodeBitmap.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « tools/LazyDecodeBitmap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698