Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/gfx/skia/skia/src/codec/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  SkScalingCodec.h   Sprache: C

 
/*
 * Copyright 2019 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkScalingCodec_DEFINED
#define SkScalingCodec_DEFINED

#include "include/codec/SkCodec.h"
#include "include/codec/SkEncodedOrigin.h"
#include "include/core/SkScalar.h"
#include "include/core/SkSize.h"
#include "include/core/SkStream.h"
#include "include/private/SkEncodedInfo.h"

#include <algorithm>
#include <memory>
#include <utility>

// Helper class for an SkCodec that supports arbitrary downscaling.
class SkScalingCodec : public SkCodec {
protected:
    SkScalingCodec(SkEncodedInfo&& info, XformFormat srcFormat, std::unique_ptr<SkStream> stream,
                    SkEncodedOrigin origin = kTopLeft_SkEncodedOrigin)
        : SkCodec(std::move(info), srcFormat, std::move(stream), origin) {}

    SkISize onGetScaledDimensions(float desiredScale) const override {
        SkISize dim = this->dimensions();
        // SkCodec treats zero dimensional images as errors, so the minimum size
        // that we will recommend is 1x1.
        dim.fWidth = std::max(1, SkScalarRoundToInt(desiredScale * dim.fWidth));
        dim.fHeight = std::max(1, SkScalarRoundToInt(desiredScale * dim.fHeight));
        return dim;
    }

    bool onDimensionsSupported(const SkISize& requested) override {
        SkISize dim = this->dimensions();
        int w = requested.width();
        int h = requested.height();
        return 1 <= w && w <= dim.width() && 1 <= h && h <= dim.height();
    }
};

#endif  // SkScalingCodec_DEFINED

Messung V0.5
C=81 H=94 G=87

¤ Dauer der Verarbeitung: 0.2 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.