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

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

Issue 1789443002: Revert "Revert of add Make variations to return SkImage by sk_sp (patchset #5 id:80001 of https://c… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use get, not release, when calling legacy function that wants ptr Created 4 years, 9 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
« no previous file with comments | « src/image/SkImage.cpp ('k') | src/image/SkImage_Base.h » ('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 "SkImage.h" 11 #include "SkImage.h"
12 #include "SkSurface.h" 12 #include "SkSurface.h"
13 13
14 // Call this if you explicitly want to use/share this pixelRef in the image 14 // Call this if you explicitly want to use/share this pixelRef in the image
15 extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*, 15 extern sk_sp<SkImage> SkMakeImageFromPixelRef(const SkImageInfo&, SkPixelRef*,
16 const SkIPoint& pixelRefOrigin, 16 const SkIPoint& pixelRefOrigin,
17 size_t rowBytes); 17 size_t rowBytes);
18 18
19 /** 19 /**
20 * Examines the bitmap to decide if it can share the existing pixelRef, or 20 * Examines the bitmap to decide if it can share the existing pixelRef, or
21 * if it needs to make a deep-copy of the pixels. 21 * if it needs to make a deep-copy of the pixels.
22 * 22 *
23 * The bitmap's pixelref will be shared if either the bitmap is marked as 23 * The bitmap's pixelref will be shared if either the bitmap is marked as
24 * immutable, or forceSharePixelRef is true. Shared pixel refs are also 24 * immutable, or forceSharePixelRef is true. Shared pixel refs are also
25 * locked when kLocked_SharedPixelRefMode is specified. 25 * locked when kLocked_SharedPixelRefMode is specified.
26 * 26 *
27 * Passing kLocked_SharedPixelRefMode allows the image's peekPixels() method 27 * Passing kLocked_SharedPixelRefMode allows the image's peekPixels() method
28 * to succeed, but it will force any lazy decodes/generators to execute if 28 * to succeed, but it will force any lazy decodes/generators to execute if
29 * they exist on the pixelref. 29 * they exist on the pixelref.
30 * 30 *
31 * It is illegal to call this with a texture-backed bitmap. 31 * It is illegal to call this with a texture-backed bitmap.
32 * 32 *
33 * If the bitmap's colortype cannot be converted into a corresponding 33 * If the bitmap's colortype cannot be converted into a corresponding
34 * SkImageInfo, or the bitmap's pixels cannot be accessed, this will return 34 * SkImageInfo, or the bitmap's pixels cannot be accessed, this will return
35 * nullptr. 35 * nullptr.
36 */ 36 */
37 enum ForceCopyMode { 37 enum ForceCopyMode {
38 kNo_ForceCopyMode, 38 kNo_ForceCopyMode,
39 kYes_ForceCopyMode, // must copy the pixels even if the bitmap is immutable 39 kYes_ForceCopyMode, // must copy the pixels even if the bitmap is immutable
40 }; 40 };
41 extern SkImage* SkNewImageFromRasterBitmap(const SkBitmap&, ForceCopyMode = kNo_ ForceCopyMode); 41 extern sk_sp<SkImage> SkMakeImageFromRasterBitmap(const SkBitmap&,
42 ForceCopyMode = kNo_ForceCopyM ode);
42 43
43 // Given an image created from SkNewImageFromBitmap, return its pixelref. This 44 // Given an image created from SkNewImageFromBitmap, return its pixelref. This
44 // may be called to see if the surface and the image share the same pixelref, 45 // may be called to see if the surface and the image share the same pixelref,
45 // in which case the surface may need to perform a copy-on-write. 46 // in which case the surface may need to perform a copy-on-write.
46 extern const SkPixelRef* SkBitmapImageGetPixelRef(const SkImage* rasterImage); 47 extern const SkPixelRef* SkBitmapImageGetPixelRef(const SkImage* rasterImage);
47 48
48 // When a texture is shared by a surface and an image its budgeted status is tha t of the 49 // When a texture is shared by a surface and an image its budgeted status is tha t of the
49 // surface. This function is used when the surface makes a new texture for itsel f in order 50 // surface. This function is used when the surface makes a new texture for itsel f in order
50 // for the orphaned image to determine whether the original texture counts again st the 51 // for the orphaned image to determine whether the original texture counts again st the
51 // budget or not. 52 // budget or not.
52 extern void SkTextureImageApplyBudgetedDecision(SkImage* textureImage); 53 extern void SkTextureImageApplyBudgetedDecision(SkImage* textureImage);
53 54
54 // Update the texture wrapped by an image created with NewTexture. This 55 // Update the texture wrapped by an image created with NewTexture. This
55 // is called when a surface and image share the same GrTexture and the 56 // is called when a surface and image share the same GrTexture and the
56 // surface needs to perform a copy-on-write 57 // surface needs to perform a copy-on-write
57 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture); 58 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture);
58 59
59 GrTexture* GrDeepCopyTexture(GrTexture* src, SkBudgeted); 60 GrTexture* GrDeepCopyTexture(GrTexture* src, SkBudgeted);
60 61
61 #endif 62 #endif
OLDNEW
« no previous file with comments | « src/image/SkImage.cpp ('k') | src/image/SkImage_Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698