File indexing completed on 2024-06-23 05:29:28
0001 /* 0002 SPDX-FileCopyrightText: 2019 Harald Sitter <sitter@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #include "shape.h" 0008 0009 #include "outline.h" 0010 0011 Shape::Shape(XkbShapePtr shape_, XkbDescPtr xkb_, QObject *parent) 0012 : XkbObject(xkb_, parent) 0013 , shape(shape_) 0014 , bounds(QRect(shape->bounds.x1, shape->bounds.y1, shape->bounds.x2, shape->bounds.y2)) 0015 { 0016 // Awkward hack. We only ever render one outline because 0017 // otherwise we wouldn't know where to stick labels so they 0018 // don't overlap with any of the outlines. 0019 // Also when primary is not set the first outline is the primary 0020 // outline as per documentation, so effectively we unify behavior 0021 // here by always ensuring the primary outline is the first outline 0022 // and that will be the one that is rendered. 0023 if (shape->primary) { 0024 outlines.push_back(new Outline(shape->primary, xkb, this)); 0025 return; 0026 } 0027 0028 for (int i = 0; i < shape->num_outlines; ++i) { 0029 outlines.push_back(new Outline(shape->outlines + i, xkb, this)); 0030 } 0031 }