-
Notifications
You must be signed in to change notification settings - Fork 18
/
create-rectangle-rounded-uploaded.ts
42 lines (40 loc) · 1.36 KB
/
create-rectangle-rounded-uploaded.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* Copyright (C) 2019 Toshiba Corporation
* SPDX-License-Identifier: Apache-2.0
*/
import { EShape } from "../e-shape";
import { EShapeBuffer } from "../e-shape-buffer";
import { EShapeUploaded, EShapeUploadedImpl } from "../e-shape-uploaded";
import {
RECTANGLE_ROUNDED_INDEX_COUNT,
RECTANGLE_ROUNDED_VERTEX_COUNT
} from "./build-rectangle-rounded";
import { TEXT_INDEX_COUNT_SHIFT, TEXT_VERTEX_COUNT_SHIFT, toTextBufferCount } from "./build-text";
import { BuilderRectangleRounded } from "./builder-rectangle-rounded";
import { BuilderText } from "./builder-text";
export const createRectangleRoundedUploaded = (
buffer: EShapeBuffer,
shape: EShape,
voffset: number,
ioffset: number,
antialiasWeight: number
): EShapeUploaded | null => {
const tcount = toTextBufferCount(shape);
const tvcount = tcount << TEXT_VERTEX_COUNT_SHIFT;
const ticount = tcount << TEXT_INDEX_COUNT_SHIFT;
const vcount = RECTANGLE_ROUNDED_VERTEX_COUNT + tvcount;
const icount = RECTANGLE_ROUNDED_INDEX_COUNT + ticount;
if (buffer.check(voffset, ioffset, vcount, icount)) {
return new EShapeUploadedImpl(buffer, voffset, ioffset, vcount, icount, [
new BuilderRectangleRounded(buffer, voffset, ioffset),
new BuilderText(
buffer,
voffset + RECTANGLE_ROUNDED_VERTEX_COUNT,
ioffset + RECTANGLE_ROUNDED_INDEX_COUNT,
tvcount,
ticount
)
]).init(shape);
}
return null;
};