blob: 9f50f2449ee7660f78231f696bf8a372b1bd52a6 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
2/*
3 * Copyright 2006 The Android Open Source Project
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
reed@android.com8a1c16f2008-12-17 15:59:43 +00009
10#include "SkDrawEmboss.h"
11
12#if SK_USE_CONDENSED_INFO == 0
13
14const SkMemberInfo SkDrawEmboss::fInfo[] = {
robertphillips@google.com7ce661d2013-08-27 16:14:03 +000015 SK_MEMBER(fAmbient, Float),
16 SK_MEMBER_ARRAY(fDirection, Float),
17 SK_MEMBER(fSigma, Float),
18 SK_MEMBER(fSpecular, Float)
reed@android.com8a1c16f2008-12-17 15:59:43 +000019};
20
21#endif
22
23DEFINE_GET_MEMBER(SkDrawEmboss);
24
robertphillips@google.com7ce661d2013-08-27 16:14:03 +000025SkDrawEmboss::SkDrawEmboss() : fSigma(-1) {
26 fDirection.setCount(3);
reed@android.com8a1c16f2008-12-17 15:59:43 +000027}
28
29SkMaskFilter* SkDrawEmboss::getMaskFilter() {
robertphillips@google.com7ce661d2013-08-27 16:14:03 +000030 if (fSigma < 0 || fDirection.count() !=3)
halcanary96fcdcc2015-08-27 07:41:13 -070031 return nullptr;
reedefdfd512016-04-04 10:02:58 -070032 return SkBlurMaskFilter::MakeEmboss(fSigma, fDirection.begin(),
33 fAmbient, fSpecular).release();
reed@android.com8a1c16f2008-12-17 15:59:43 +000034}