pdfium/core/fxge/win32/cfx_psfonttracker.cpp
Lei Zhang 1847ad5d0f Clang-format core/fxge
Change-Id: Ie8c426d0a77f5a93b0563a311b0f228f22852439
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/130750
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
2025-04-09 14:59:28 -07:00

33 lines
955 B
C++

// Copyright 2021 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "core/fxge/win32/cfx_psfonttracker.h"
#include "core/fxcrt/check.h"
#include "core/fxcrt/containers/contains.h"
#include "core/fxge/cfx_font.h"
CFX_PSFontTracker::CFX_PSFontTracker() = default;
CFX_PSFontTracker::~CFX_PSFontTracker() = default;
void CFX_PSFontTracker::AddFontObject(const CFX_Font* font) {
uint64_t tag = font->GetObjectTag();
[[maybe_unused]] bool inserted;
if (tag != 0) {
inserted = seen_font_tags_.insert(tag).second;
} else {
inserted = seen_font_ptrs_.insert(UnownedPtr<const CFX_Font>(font)).second;
}
DCHECK(inserted);
}
bool CFX_PSFontTracker::SeenFontObject(const CFX_Font* font) const {
uint64_t tag = font->GetObjectTag();
if (tag != 0) {
return pdfium::Contains(seen_font_tags_, tag);
}
return pdfium::Contains(seen_font_ptrs_, font);
}