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

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

Issue 54363008: move SkImage::ColorType into SkColorType (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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 | « samplecode/SampleFatBits.cpp ('k') | src/image/SkImagePriv.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; 14 class SkPicture;
15 15
16 extern SkBitmap::Config SkImageInfoToBitmapConfig(const SkImage::Info&); 16 extern SkBitmap::Config SkImageInfoToBitmapConfig(const SkImageInfo&);
17 17
18 extern int SkImageBytesPerPixel(SkImage::ColorType); 18 extern int SkImageBytesPerPixel(SkColorType);
19 19
20 extern bool SkBitmapToImageInfo(const SkBitmap&, SkImage::Info*); 20 extern bool SkBitmapToImageInfo(const SkBitmap&, SkImageInfo*);
21 21
22 // Call this if you explicitly want to use/share this pixelRef in the image 22 // Call this if you explicitly want to use/share this pixelRef in the image
23 extern SkImage* SkNewImageFromPixelRef(const SkImage::Info&, SkPixelRef*, 23 extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*,
24 size_t rowBytes); 24 size_t rowBytes);
25 25
26 /** 26 /**
27 * Examines the bitmap to decide if it can share the existing pixelRef, or 27 * Examines the bitmap to decide if it can share the existing pixelRef, or
28 * if it needs to make a deep-copy of the pixels. The bitmap's pixelref will 28 * if it needs to make a deep-copy of the pixels. The bitmap's pixelref will
29 * be shared if either the bitmap is marked as immutable, or canSharePixelRef 29 * be shared if either the bitmap is marked as immutable, or canSharePixelRef
30 * is true. 30 * is true.
31 * 31 *
32 * If the bitmap's config cannot be converted into a corresponding 32 * If the bitmap's config cannot be converted into a corresponding
33 * SkImage::Info, or the bitmap's pixels cannot be accessed, this will return 33 * SkImageInfo, or the bitmap's pixels cannot be accessed, this will return
34 * NULL. 34 * NULL.
35 */ 35 */
36 extern SkImage* SkNewImageFromBitmap(const SkBitmap&, bool canSharePixelRef); 36 extern SkImage* SkNewImageFromBitmap(const SkBitmap&, bool canSharePixelRef);
37 37
38 extern void SkImagePrivDrawPicture(SkCanvas*, SkPicture*, 38 extern void SkImagePrivDrawPicture(SkCanvas*, SkPicture*,
39 SkScalar x, SkScalar y, const SkPaint*); 39 SkScalar x, SkScalar y, const SkPaint*);
40 40
41 extern void SkImagePrivDrawPicture(SkCanvas*, SkPicture*, 41 extern void SkImagePrivDrawPicture(SkCanvas*, SkPicture*,
42 const SkRect*, const SkRect&, const SkPaint*) ; 42 const SkRect*, const SkRect&, const SkPaint*) ;
43 43
44 /** 44 /**
45 * Return an SkImage whose contents are those of the specified picture. Note: 45 * Return an SkImage whose contents are those of the specified picture. Note:
46 * The picture itself is unmodified, and may continue to be used for recording 46 * The picture itself is unmodified, and may continue to be used for recording
47 */ 47 */
48 extern SkImage* SkNewImageFromPicture(const SkPicture*); 48 extern SkImage* SkNewImageFromPicture(const SkPicture*);
49 49
50 static inline size_t SkImageMinRowBytes(const SkImage::Info& info) { 50 static inline size_t SkImageMinRowBytes(const SkImageInfo& info) {
51 size_t rb = info.fWidth * SkImageBytesPerPixel(info.fColorType); 51 size_t rb = info.fWidth * SkImageBytesPerPixel(info.fColorType);
52 return SkAlign4(rb); 52 return SkAlign4(rb);
53 } 53 }
54 54
55 // Given an image created from SkNewImageFromBitmap, return its pixelref. This 55 // Given an image created from SkNewImageFromBitmap, return its pixelref. This
56 // may be called to see if the surface and the image share the same pixelref, 56 // may be called to see if the surface and the image share the same pixelref,
57 // in which case the surface may need to perform a copy-on-write. 57 // in which case the surface may need to perform a copy-on-write.
58 extern SkPixelRef* SkBitmapImageGetPixelRef(SkImage* rasterImage); 58 extern SkPixelRef* SkBitmapImageGetPixelRef(SkImage* rasterImage);
59 59
60 // Given an image created with NewPicture, return its SkPicture. 60 // Given an image created with NewPicture, return its SkPicture.
61 extern SkPicture* SkPictureImageGetPicture(SkImage* pictureImage); 61 extern SkPicture* SkPictureImageGetPicture(SkImage* pictureImage);
62 62
63 // Given an image created with NewTexture, return its GrTexture. This 63 // Given an image created with NewTexture, return its GrTexture. This
64 // may be called to see if the surface and the image share the same GrTexture, 64 // may be called to see if the surface and the image share the same GrTexture,
65 // in which case the surface may need to perform a copy-on-write. 65 // in which case the surface may need to perform a copy-on-write.
66 extern GrTexture* SkTextureImageGetTexture(SkImage* textureImage); 66 extern GrTexture* SkTextureImageGetTexture(SkImage* textureImage);
67 67
68 // Update the texture wrapped by an image created with NewTexture. This 68 // Update the texture wrapped by an image created with NewTexture. This
69 // is called when a surface and image share the same GrTexture and the 69 // is called when a surface and image share the same GrTexture and the
70 // surface needs to perform a copy-on-write 70 // surface needs to perform a copy-on-write
71 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture); 71 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture);
72 72
73 #endif 73 #endif
OLDNEW
« no previous file with comments | « samplecode/SampleFatBits.cpp ('k') | src/image/SkImagePriv.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698