diff options
Diffstat (limited to 'Source/WebCore/platform/image-decoders/cairo')
-rw-r--r-- | Source/WebCore/platform/image-decoders/cairo/ImageBackingStoreCairo.cpp (renamed from Source/WebCore/platform/image-decoders/cairo/ImageDecoderCairo.cpp) | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/Source/WebCore/platform/image-decoders/cairo/ImageDecoderCairo.cpp b/Source/WebCore/platform/image-decoders/cairo/ImageBackingStoreCairo.cpp index 1d99a56fa..78032c4e2 100644 --- a/Source/WebCore/platform/image-decoders/cairo/ImageDecoderCairo.cpp +++ b/Source/WebCore/platform/image-decoders/cairo/ImageBackingStoreCairo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,10 +10,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -24,17 +24,22 @@ */ #include "config.h" -#include "ImageDecoder.h" +#include "ImageBackingStore.h" #include <cairo.h> namespace WebCore { -PassNativeImagePtr ImageFrame::asNewNativeImage() const +NativeImagePtr ImageBackingStore::image() const { - return adoptRef(cairo_image_surface_create_for_data( - reinterpret_cast<unsigned char*>(const_cast<PixelData*>(m_bytes)), - CAIRO_FORMAT_ARGB32, width(), height(), width() * sizeof(PixelData))); + m_pixels->ref(); + RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create_for_data( + reinterpret_cast<unsigned char*>(const_cast<RGBA32*>(m_pixelsPtr)), + CAIRO_FORMAT_ARGB32, size().width(), size().height(), size().width() * sizeof(RGBA32))); + static cairo_user_data_key_t s_surfaceDataKey; + cairo_surface_set_user_data(surface.get(), &s_surfaceDataKey, m_pixels.get(), [](void* data) { static_cast<SharedBuffer*>(data)->deref(); }); + + return surface; } } // namespace WebCore |