Add GYP target for sk_tool_utils.* component.

This declares a static library target in gyp/sk_tool_utils.gyp, so other
targets can depend directly on it instead of including the source file
in their source lists.

BUG=None
TEST=make all
R=mtklein@google.com

Author: tfarina@chromium.org

Review URL: https://codereview.chromium.org/348623006
This commit is contained in:
tfarina 2014-06-21 10:54:17 -07:00 committed by Commit bot
parent 4856ac9a4d
commit 2010891425
6 changed files with 34 additions and 13 deletions

View File

@ -134,9 +134,6 @@
# Lua
'../src/utils/SkLuaCanvas.cpp',
'../src/utils/SkLua.cpp',
# tools
'../tools/sk_tool_utils.cpp',
],
'sources!': [
'../samplecode/SampleSkLayer.cpp', #relies on SkMatrix44 which doesn't compile
@ -152,6 +149,7 @@
'pdf.gyp:pdf',
'skia_lib.gyp:skia_lib',
'tools.gyp:resources',
'tools.gyp:sk_tool_utils',
'views.gyp:views',
'views_animated.gyp:views_animated',
'xml.gyp:xml',

View File

@ -15,6 +15,7 @@
'skia_lib.gyp:skia_lib',
'tools.gyp:crash_handler',
'tools.gyp:resources',
'tools.gyp:sk_tool_utils',
'tools.gyp:timer',
],
'sources': [
@ -24,7 +25,6 @@
'../bench/GMBench.h',
'../bench/ResultsWriter.cpp',
'../bench/benchmain.cpp',
'../tools/sk_tool_utils.cpp',
],
'conditions': [
['skia_gpu == 1',

View File

@ -23,6 +23,7 @@
'skia_lib.gyp:skia_lib',
'tools.gyp:picture_utils',
'tools.gyp:resources',
'tools.gyp:sk_tool_utils',
],
'sources': [
'../tests/Test.cpp',
@ -197,7 +198,5 @@
'../tests/TDStackNesterTest.cpp',
'../experimental/PdfViewer/src/SkTDStackNester.h',
'../tools/sk_tool_utils.cpp',
],
}

View File

@ -49,10 +49,10 @@
'include_dirs' : [ '../src/utils/' ],
'sources': [
'../gm/gm_expectations.cpp',
'../tools/sk_tool_utils.cpp',
],
'dependencies': [
'jsoncpp.gyp:jsoncpp',
'sk_tool_utils',
'skia_lib.gyp:skia_lib',
],
'direct_dependent_settings': {
@ -84,7 +84,18 @@
'skia_lib.gyp:skia_lib',
],
'direct_dependent_settings': {
'include_dirs': [ '../tools/', ],
'include_dirs': [ '../tools', ],
},
},
{
'target_name': 'sk_tool_utils',
'type': 'static_library',
'sources': [ '../tools/sk_tool_utils.cpp' ],
'dependencies': [
'skia_lib.gyp:skia_lib',
],
'direct_dependent_settings': {
'include_dirs': [ '../tools', ],
},
},
{

View File

@ -1,5 +1,15 @@
/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "sk_tool_utils.h"
#include "SkBitmap.h"
#include "SkCanvas.h"
namespace sk_tool_utils {
const char* colortype_name(SkColorType ct) {
@ -29,4 +39,4 @@ void write_pixels(SkCanvas* canvas, const SkBitmap& bitmap, int x, int y,
canvas->writePixels(info, tmp.getPixels(), tmp.rowBytes(), x, y);
}
}
} // namespace sk_tool_utils

View File

@ -8,8 +8,10 @@
#ifndef sk_tool_utils_DEFINED
#define sk_tool_utils_DEFINED
#include "SkCanvas.h"
#include "SkBitmap.h"
#include "SkImageInfo.h"
class SkBitmap;
class SkCanvas;
namespace sk_tool_utils {
@ -20,6 +22,7 @@ namespace sk_tool_utils {
* the pixels are colorType + alphaType
*/
void write_pixels(SkCanvas*, const SkBitmap&, int x, int y, SkColorType, SkAlphaType);
}
#endif
} // namespace sk_tool_utils
#endif // sk_tool_utils_DEFINED