Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: src/image/SkImagePriv.h

Issue 233943002: remove picture-backed surfaces (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | src/image/SkImage_Picture.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkImagePriv_DEFINED 8 #ifndef SkImagePriv_DEFINED
9 #define SkImagePriv_DEFINED 9 #define SkImagePriv_DEFINED
10 10
11 #include "SkBitmap.h" 11 #include "SkBitmap.h"
12 #include "SkImage.h" 12 #include "SkImage.h"
13 13
14 class SkPicture;
15
16 extern SkBitmap::Config SkImageInfoToBitmapConfig(const SkImageInfo&); 14 extern SkBitmap::Config SkImageInfoToBitmapConfig(const SkImageInfo&);
17 15
18 // Call this if you explicitly want to use/share this pixelRef in the image 16 // Call this if you explicitly want to use/share this pixelRef in the image
19 extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*, 17 extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*,
20 size_t rowBytes); 18 size_t rowBytes);
21 19
22 /** 20 /**
23 * Examines the bitmap to decide if it can share the existing pixelRef, or 21 * 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 22 * 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 23 * be shared if either the bitmap is marked as immutable, or canSharePixelRef
26 * is true. 24 * is true.
27 * 25 *
28 * If the bitmap's config cannot be converted into a corresponding 26 * If the bitmap's config cannot be converted into a corresponding
29 * SkImageInfo, or the bitmap's pixels cannot be accessed, this will return 27 * SkImageInfo, or the bitmap's pixels cannot be accessed, this will return
30 * NULL. 28 * NULL.
31 */ 29 */
32 extern SkImage* SkNewImageFromBitmap(const SkBitmap&, bool canSharePixelRef); 30 extern SkImage* SkNewImageFromBitmap(const SkBitmap&, bool canSharePixelRef);
33 31
34 extern void SkImagePrivDrawPicture(SkCanvas*, SkPicture*,
35 SkScalar x, SkScalar y, const SkPaint*);
36
37 extern void SkImagePrivDrawPicture(SkCanvas*, SkPicture*,
38 const SkRect*, const SkRect&, const SkPaint*) ;
39
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*);
45
46 static inline size_t SkImageMinRowBytes(const SkImageInfo& info) { 32 static inline size_t SkImageMinRowBytes(const SkImageInfo& info) {
47 return SkAlign4(info.minRowBytes()); 33 return SkAlign4(info.minRowBytes());
48 } 34 }
49 35
50 // Given an image created from SkNewImageFromBitmap, return its pixelref. This 36 // 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, 37 // 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. 38 // in which case the surface may need to perform a copy-on-write.
53 extern SkPixelRef* SkBitmapImageGetPixelRef(SkImage* rasterImage); 39 extern SkPixelRef* SkBitmapImageGetPixelRef(SkImage* rasterImage);
54 40
55 // Given an image created with NewPicture, return its SkPicture.
56 extern SkPicture* SkPictureImageGetPicture(SkImage* pictureImage);
57
58 // Given an image created with NewTexture, return its GrTexture. This 41 // 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, 42 // 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. 43 // in which case the surface may need to perform a copy-on-write.
61 extern GrTexture* SkTextureImageGetTexture(SkImage* textureImage); 44 extern GrTexture* SkTextureImageGetTexture(SkImage* textureImage);
62 45
63 // Update the texture wrapped by an image created with NewTexture. This 46 // 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 47 // is called when a surface and image share the same GrTexture and the
65 // surface needs to perform a copy-on-write 48 // surface needs to perform a copy-on-write
66 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture); 49 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture);
67 50
68 #endif 51 #endif
OLDNEW
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | src/image/SkImage_Picture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698