forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 2
/
dl_canvas.cc
24 lines (19 loc) · 887 Bytes
/
dl_canvas.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/display_list/dl_canvas.h"
#include "third_party/skia/include/core/SkPoint3.h"
#include "third_party/skia/include/utils/SkShadowUtils.h"
namespace flutter {
SkRect DlCanvas::ComputeShadowBounds(const SkPath& path,
float elevation,
SkScalar dpr,
const SkMatrix& ctm) {
SkRect shadow_bounds(path.getBounds());
SkShadowUtils::GetLocalBounds(
ctm, path, SkPoint3::Make(0, 0, dpr * elevation),
SkPoint3::Make(0, -1, 1), kShadowLightRadius / kShadowLightHeight,
SkShadowFlags::kDirectionalLight_ShadowFlag, &shadow_bounds);
return shadow_bounds;
}
} // namespace flutter