Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
8 #ifndef SkImagePriv_DEFINED
9 #define SkImagePriv_DEFINED
11 #include "SkBitmap.h"
12 #include "SkImage.h"
14 class SkPicture;
16 extern SkBitmap::Config SkImageInfoToBitmapConfig(const SkImageInfo&);
18 // Call this if you explicitly want to use/share this pixelRef in the image
19 extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*,
20 size_t rowBytes);
22 /**
23 * Examines the bitmap to decide if it can share the existing pixelRef, or
24 * if it needs to make a deep-copy of the pixels. The bitmap's pixelref will
25 * be shared if either the bitmap is marked as immutable, or canSharePixelRef
26 * is true.
27 *
28 * If the bitmap's config cannot be converted into a corresponding
29 * SkImageInfo, or the bitmap's pixels cannot be accessed, this will return
30 * NULL.
31 */
32 extern SkImage* SkNewImageFromBitmap(const SkBitmap&, bool canSharePixelRef);
34 extern void SkImagePrivDrawPicture(SkCanvas*, SkPicture*,
35 SkScalar x, SkScalar y, const SkPaint*);
37 extern void SkImagePrivDrawPicture(SkCanvas*, SkPicture*,
38 const SkRect*, const SkRect&, const SkPaint*);
40 /**
41 * Return an SkImage whose contents are those of the specified picture. Note:
42 * The picture itself is unmodified, and may continue to be used for recording
43 */
44 extern SkImage* SkNewImageFromPicture(const SkPicture*);
46 static inline size_t SkImageMinRowBytes(const SkImageInfo& info) {
47 return SkAlign4(info.minRowBytes());
48 }
50 // Given an image created from SkNewImageFromBitmap, return its pixelref. This
51 // may be called to see if the surface and the image share the same pixelref,
52 // in which case the surface may need to perform a copy-on-write.
53 extern SkPixelRef* SkBitmapImageGetPixelRef(SkImage* rasterImage);
55 // Given an image created with NewPicture, return its SkPicture.
56 extern SkPicture* SkPictureImageGetPicture(SkImage* pictureImage);
58 // Given an image created with NewTexture, return its GrTexture. This
59 // may be called to see if the surface and the image share the same GrTexture,
60 // in which case the surface may need to perform a copy-on-write.
61 extern GrTexture* SkTextureImageGetTexture(SkImage* textureImage);
63 // Update the texture wrapped by an image created with NewTexture. This
64 // is called when a surface and image share the same GrTexture and the
65 // surface needs to perform a copy-on-write
66 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture);
68 #endif