/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
if (cairo_surface_get_type(mSurface) == CAIRO_SURFACE_TYPE_IMAGE) {
dataSurf = new DataSourceSurfaceCairo(mSurface);
} else {
cairo_surface_t* imageSurf = cairo_image_surface_create(
GfxFormatToCairoFormat(mFormat), mSize.width, mSize.height);
// Fill the new image surface with the contents of our surface.
cairo_t* ctx = cairo_create(imageSurf);
cairo_set_source_surface(ctx, mSurface, 0, 0);
cairo_paint(ctx);
cairo_destroy(ctx);
dataSurf = new DataSourceSurfaceCairo(imageSurf);
cairo_surface_destroy(imageSurf);
}
// We also need to make sure that the returned surface has // surface->GetType() == SurfaceType::DATA. return MakeAndAddRef<DataSourceSurfaceWrapper>(dataSurf);
}
void SourceSurfaceCairo::DrawTargetWillChange() { if (mDrawTarget) {
mDrawTarget = nullptr;
// We're about to lose our version of the surface, so make a copy of it.
cairo_surface_t* surface = cairo_surface_create_similar(
mSurface, GfxFormatToCairoContent(mFormat), mSize.width, mSize.height);
cairo_t* ctx = cairo_create(surface);
cairo_pattern_t* pat = cairo_pattern_create_for_surface(mSurface);
cairo_set_source(ctx, pat);
cairo_paint(ctx);
cairo_destroy(ctx);
cairo_pattern_destroy(pat);
// Swap in this new surface.
cairo_surface_destroy(mSurface);
mSurface = surface;
}
}
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 ist noch experimentell.