mirror of
https://github.com/encounter/engine.git
synced 2026-03-30 11:09:55 -07:00
50ddc3712f
Behavior (visual) changes should be very minor. Things that are to be expected: * A few things were not color managed correctly by the transform canvas (color emoji, some color filters). Those will be handled correctly with the tagged surfaces (although we're always transforming to sRGB, so nothing should change until we target a wider gamut). * Image filtering will happen in the source color space, rather than the destination. Very minor. * The transform canvas did caching of images in the destination color space. Now, the conversion happens at draw time. If there are performance issues, images can be pre-converted to the destination with makeColorSpace().
68 lines
1.4 KiB
C++
68 lines
1.4 KiB
C++
// 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/shell/common/surface.h"
|
|
|
|
#include "flutter/fml/logging.h"
|
|
#include "third_party/skia/include/core/SkSurface.h"
|
|
|
|
namespace shell {
|
|
|
|
SurfaceFrame::SurfaceFrame(sk_sp<SkSurface> surface,
|
|
SubmitCallback submit_callback)
|
|
: submitted_(false), surface_(surface), submit_callback_(submit_callback) {
|
|
FML_DCHECK(submit_callback_);
|
|
}
|
|
|
|
SurfaceFrame::~SurfaceFrame() {
|
|
if (submit_callback_ && !submitted_) {
|
|
// Dropping without a Submit.
|
|
submit_callback_(*this, nullptr);
|
|
}
|
|
}
|
|
|
|
bool SurfaceFrame::Submit() {
|
|
if (submitted_) {
|
|
return false;
|
|
}
|
|
|
|
submitted_ = PerformSubmit();
|
|
|
|
return submitted_;
|
|
}
|
|
|
|
SkCanvas* SurfaceFrame::SkiaCanvas() {
|
|
return surface_ != nullptr ? surface_->getCanvas() : nullptr;
|
|
}
|
|
|
|
sk_sp<SkSurface> SurfaceFrame::SkiaSurface() const {
|
|
return surface_;
|
|
}
|
|
|
|
bool SurfaceFrame::PerformSubmit() {
|
|
if (submit_callback_ == nullptr) {
|
|
return false;
|
|
}
|
|
|
|
if (submit_callback_(*this, SkiaCanvas())) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
Surface::Surface() = default;
|
|
|
|
Surface::~Surface() = default;
|
|
|
|
flow::ExternalViewEmbedder* Surface::GetExternalViewEmbedder() {
|
|
return nullptr;
|
|
}
|
|
|
|
bool Surface::MakeRenderContextCurrent() {
|
|
return true;
|
|
}
|
|
|
|
} // namespace shell
|