gfx/skia/trunk/src/image/SkImagePriv.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/image/SkImagePriv.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,68 @@
     1.4 +/*
     1.5 + * Copyright 2012 Google Inc.
     1.6 + *
     1.7 + * Use of this source code is governed by a BSD-style license that can be
     1.8 + * found in the LICENSE file.
     1.9 + */
    1.10 +
    1.11 +#ifndef SkImagePriv_DEFINED
    1.12 +#define SkImagePriv_DEFINED
    1.13 +
    1.14 +#include "SkBitmap.h"
    1.15 +#include "SkImage.h"
    1.16 +
    1.17 +class SkPicture;
    1.18 +
    1.19 +extern SkBitmap::Config SkImageInfoToBitmapConfig(const SkImageInfo&);
    1.20 +
    1.21 +// Call this if you explicitly want to use/share this pixelRef in the image
    1.22 +extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*,
    1.23 +                                       size_t rowBytes);
    1.24 +
    1.25 +/**
    1.26 + *  Examines the bitmap to decide if it can share the existing pixelRef, or
    1.27 + *  if it needs to make a deep-copy of the pixels. The bitmap's pixelref will
    1.28 + *  be shared if either the bitmap is marked as immutable, or canSharePixelRef
    1.29 + *  is true.
    1.30 + *
    1.31 + *  If the bitmap's config cannot be converted into a corresponding
    1.32 + *  SkImageInfo, or the bitmap's pixels cannot be accessed, this will return
    1.33 + *  NULL.
    1.34 + */
    1.35 +extern SkImage* SkNewImageFromBitmap(const SkBitmap&, bool canSharePixelRef);
    1.36 +
    1.37 +extern void SkImagePrivDrawPicture(SkCanvas*, SkPicture*,
    1.38 +                                   SkScalar x, SkScalar y, const SkPaint*);
    1.39 +
    1.40 +extern void SkImagePrivDrawPicture(SkCanvas*, SkPicture*,
    1.41 +                                   const SkRect*, const SkRect&, const SkPaint*);
    1.42 +
    1.43 +/**
    1.44 + *  Return an SkImage whose contents are those of the specified picture. Note:
    1.45 + *  The picture itself is unmodified, and may continue to be used for recording
    1.46 + */
    1.47 +extern SkImage* SkNewImageFromPicture(const SkPicture*);
    1.48 +
    1.49 +static inline size_t SkImageMinRowBytes(const SkImageInfo& info) {
    1.50 +    return SkAlign4(info.minRowBytes());
    1.51 +}
    1.52 +
    1.53 +// Given an image created from SkNewImageFromBitmap, return its pixelref. This
    1.54 +// may be called to see if the surface and the image share the same pixelref,
    1.55 +// in which case the surface may need to perform a copy-on-write.
    1.56 +extern SkPixelRef* SkBitmapImageGetPixelRef(SkImage* rasterImage);
    1.57 +
    1.58 +// Given an image created with NewPicture, return its SkPicture.
    1.59 +extern SkPicture* SkPictureImageGetPicture(SkImage* pictureImage);
    1.60 +
    1.61 +// Given an image created with NewTexture, return its GrTexture. This
    1.62 +// may be called to see if the surface and the image share the same GrTexture,
    1.63 +// in which case the surface may need to perform a copy-on-write.
    1.64 +extern GrTexture* SkTextureImageGetTexture(SkImage* textureImage);
    1.65 +
    1.66 +// Update the texture wrapped by an image created with NewTexture. This
    1.67 +// is called when a surface and image share the same GrTexture and the
    1.68 +// surface needs to perform a copy-on-write
    1.69 +extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture);
    1.70 +
    1.71 +#endif

mercurial