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

Side by Side Diff: src/core/SkSpecialImage.h

Issue 1816223002: Update SkSpecialImage to be able to create tight SkImages and SkSurfaces (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rm ' ' 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 | « no previous file | src/core/SkSpecialImage.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 2016 Google Inc. 2 * Copyright 2016 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 SkSpecialImage_DEFINED 8 #ifndef SkSpecialImage_DEFINED
9 #define SkSpecialImage_DEFINED 9 #define SkSpecialImage_DEFINED
10 10
11 #include "SkNextID.h" 11 #include "SkNextID.h"
12 #include "SkRefCnt.h" 12 #include "SkRefCnt.h"
13 13
14 // remove this when internal_getProxy goes away (see skbug.com/4965) 14 // remove this when internal_getProxy goes away (see skbug.com/4965)
15 #include "SkImageFilter.h" 15 #include "SkImageFilter.h"
16 16
17 #include "SkImageInfo.h" // for SkAlphaType 17 #include "SkImageInfo.h" // for SkAlphaType
18 18
19 class GrContext; 19 class GrContext;
20 class GrTexture; 20 class GrTexture;
21 class SkBitmap; 21 class SkBitmap;
22 class SkCanvas; 22 class SkCanvas;
23 class SkImage; 23 class SkImage;
24 struct SkImageInfo; 24 struct SkImageInfo;
25 class SkPaint; 25 class SkPaint;
26 class SkPixmap; 26 class SkPixmap;
27 class SkSpecialSurface; 27 class SkSpecialSurface;
28 class SkSurface;
28 29
29 enum { 30 enum {
30 kNeedNewImageUniqueID_SpecialImage = 0 31 kNeedNewImageUniqueID_SpecialImage = 0
31 }; 32 };
32 33
33 /** 34 /**
34 * This is a restricted form of SkImage solely intended for internal use. It 35 * This is a restricted form of SkImage solely intended for internal use. It
35 * differs from SkImage in that: 36 * differs from SkImage in that:
36 * - it can only be backed by raster or gpu (no generators) 37 * - it can only be backed by raster or gpu (no generators)
37 * - it can be backed by a GrTexture larger than its nominal bounds 38 * - it can be backed by a GrTexture larger than its nominal bounds
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 uint32_t uniqueID, 78 uint32_t uniqueID,
78 GrTexture*, 79 GrTexture*,
79 SkAlphaType at = kPremul_SkAlphaTyp e); 80 SkAlphaType at = kPremul_SkAlphaTyp e);
80 static sk_sp<SkSpecialImage> MakeFromPixmap(SkImageFilter::Proxy*, 81 static sk_sp<SkSpecialImage> MakeFromPixmap(SkImageFilter::Proxy*,
81 const SkIRect& subset, 82 const SkIRect& subset,
82 const SkPixmap&, 83 const SkPixmap&,
83 RasterReleaseProc, 84 RasterReleaseProc,
84 ReleaseContext); 85 ReleaseContext);
85 86
86 /** 87 /**
87 * Create a new surface with a backend that is compatible with this image. 88 * Create a new special surface with a backend that is compatible with this special image.
88 */ 89 */
89 sk_sp<SkSpecialSurface> makeSurface(const SkImageInfo&) const; 90 sk_sp<SkSpecialSurface> makeSurface(const SkImageInfo&) const;
90 91
91 /** 92 /**
93 * Create a new surface with a backend that is compatible with this special image.
94 * TODO: switch this to makeSurface once we resolved the naming issue
95 */
96 sk_sp<SkSurface> makeTightSurface(const SkImageInfo&) const;
97
98 /**
92 * Extract a subset of this special image and return it as a special image. 99 * Extract a subset of this special image and return it as a special image.
93 * It may or may not point to the same backing memory. 100 * It may or may not point to the same backing memory.
94 */ 101 */
95 sk_sp<SkSpecialImage> makeSubset(const SkIRect& subset) const; 102 sk_sp<SkSpecialImage> makeSubset(const SkIRect& subset) const;
96 103
104 /**
105 * Extract a subset of this special image and return it as an SkImage.
106 * It may or may not point to the same backing memory.
107 * TODO: switch this to makeSurface once we resolved the naming issue
108 */
109 sk_sp<SkImage> makeTightSubset(const SkIRect& subset) const;
110
97 // These three internal methods will go away (see skbug.com/4965) 111 // These three internal methods will go away (see skbug.com/4965)
98 bool internal_getBM(SkBitmap* result); 112 bool internal_getBM(SkBitmap* result);
99 static sk_sp<SkSpecialImage> internal_fromBM(SkImageFilter::Proxy*, const Sk Bitmap&); 113 static sk_sp<SkSpecialImage> internal_fromBM(SkImageFilter::Proxy*, const Sk Bitmap&);
100 SkImageFilter::Proxy* internal_getProxy() const; 114 SkImageFilter::Proxy* internal_getProxy() const;
101 115
102 // TODO: hide this when GrLayerHoister uses SkSpecialImages more fully (see skbug.com/5063) 116 // TODO: hide this when GrLayerHoister uses SkSpecialImages more fully (see skbug.com/5063)
103 /** 117 /**
104 * If the SpecialImage is backed by a gpu texture, return that texture. 118 * If the SpecialImage is backed by a gpu texture, return that texture.
105 * The active portion of the texture can be retrieved via 'subset'. 119 * The active portion of the texture can be retrieved via 'subset'.
106 */ 120 */
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 const uint32_t fUniqueID; 158 const uint32_t fUniqueID;
145 159
146 // TODO: remove this ASAP (see skbug.com/4965) 160 // TODO: remove this ASAP (see skbug.com/4965)
147 SkImageFilter::Proxy* fProxy; 161 SkImageFilter::Proxy* fProxy;
148 162
149 typedef SkRefCnt INHERITED; 163 typedef SkRefCnt INHERITED;
150 }; 164 };
151 165
152 #endif 166 #endif
153 167
OLDNEW
« no previous file with comments | « no previous file | src/core/SkSpecialImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698