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

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

Issue 1528383004: Remove SkImageMinRowBytes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 | « no previous file | src/image/SkImage_Raster.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
(...skipping 22 matching lines...) Expand all
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 SkImage* SkNewImageFromRasterBitmap(const SkBitmap&, ForceCopyMode = kNo_ ForceCopyMode);
42 42
43 static inline size_t SkImageMinRowBytes(const SkImageInfo& info) {
44 size_t minRB = info.minRowBytes();
45 if (kIndex_8_SkColorType != info.colorType()) {
46 minRB = SkAlign4(minRB);
47 }
48 return minRB;
49 }
50
51 // Given an image created from SkNewImageFromBitmap, return its pixelref. This 43 // Given an image created from SkNewImageFromBitmap, return its pixelref. This
52 // may be called to see if the surface and the image share the same pixelref, 44 // may be called to see if the surface and the image share the same pixelref,
53 // in which case the surface may need to perform a copy-on-write. 45 // in which case the surface may need to perform a copy-on-write.
54 extern const SkPixelRef* SkBitmapImageGetPixelRef(const SkImage* rasterImage); 46 extern const SkPixelRef* SkBitmapImageGetPixelRef(const SkImage* rasterImage);
55 47
56 // When a texture is shared by a surface and an image its budgeted status is tha t of the 48 // When a texture is shared by a surface and an image its budgeted status is tha t of the
57 // surface. This function is used when the surface makes a new texture for itsel f in order 49 // surface. This function is used when the surface makes a new texture for itsel f in order
58 // for the orphaned image to determine whether the original texture counts again st the 50 // for the orphaned image to determine whether the original texture counts again st the
59 // budget or not. 51 // budget or not.
60 extern void SkTextureImageApplyBudgetedDecision(SkImage* textureImage); 52 extern void SkTextureImageApplyBudgetedDecision(SkImage* textureImage);
61 53
62 // Update the texture wrapped by an image created with NewTexture. This 54 // Update the texture wrapped by an image created with NewTexture. This
63 // is called when a surface and image share the same GrTexture and the 55 // is called when a surface and image share the same GrTexture and the
64 // surface needs to perform a copy-on-write 56 // surface needs to perform a copy-on-write
65 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture); 57 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture);
66 58
67 GrTexture* GrDeepCopyTexture(GrTexture* src, bool isBudgeted); 59 GrTexture* GrDeepCopyTexture(GrTexture* src, bool isBudgeted);
68 60
69 #endif 61 #endif
OLDNEW
« no previous file with comments | « no previous file | src/image/SkImage_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698