Chromium Code Reviews

Side by Side Diff: include/core/SkImage.h

Issue 821083002: add newImage API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: initial draft of API Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | no next file » | 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 SkImage_DEFINED 8 #ifndef SkImage_DEFINED
9 #define SkImage_DEFINED 9 #define SkImage_DEFINED
10 10
(...skipping 106 matching lines...)
117 117
118 /** 118 /**
119 * Return a new surface that is compatible with this image's internal repre sentation 119 * Return a new surface that is compatible with this image's internal repre sentation
120 * (e.g. raster or gpu). 120 * (e.g. raster or gpu).
121 * 121 *
122 * If no surfaceprops are specified, the image will attempt to match the pr ops of when it 122 * If no surfaceprops are specified, the image will attempt to match the pr ops of when it
123 * was created (if it came from a surface). 123 * was created (if it came from a surface).
124 */ 124 */
125 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps* = NULL) cons t; 125 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps* = NULL) cons t;
126 126
127 /**
128 * Return an image that is a rescale of this image (using newWidth, newHeig ht).
129 *
130 * If subset is NULL, then the entire original image is used as the src for the scaling.
131 * If subset is not NULL, then it is intersected with the original src-boun ds. If that
132 * intersection is empty, NULL is returned, else the intersection is used a s the src for
133 * the scaling.
134 *
135 * Note: it is legal for the returned image to be the same instance as the src image
136 * (if the new dimensions == the src dimensions and any subset encloses the entire src).
137 */
138 SkImage* newImage(int newWidth, int newHeight, const SkIRect* subset = NULL) const;
bsalomon 2014/12/22 21:31:06 Should there be control over filtering mode/qualit
reed1 2014/12/22 21:39:47 Good question -- in my next rev. I'm proposing cha
139
127 protected: 140 protected:
128 SkImage(int width, int height) : 141 SkImage(int width, int height) :
129 fWidth(width), 142 fWidth(width),
130 fHeight(height), 143 fHeight(height),
131 fUniqueID(NextUniqueID()) { 144 fUniqueID(NextUniqueID()) {
132 145
133 SkASSERT(width >= 0); 146 SkASSERT(width >= 0);
134 SkASSERT(height >= 0); 147 SkASSERT(height >= 0);
135 } 148 }
136 149
(...skipping 14 matching lines...)
151 * Draw the image, cropped to the src rect, to the dst rect of a canvas. 164 * Draw the image, cropped to the src rect, to the dst rect of a canvas.
152 * If src is larger than the bounds of the image, the rest of the image is 165 * If src is larger than the bounds of the image, the rest of the image is
153 * filled with transparent black pixels. 166 * filled with transparent black pixels.
154 * 167 *
155 * See SkCanvas::drawBitmapRectToRect for similar behavior. 168 * See SkCanvas::drawBitmapRectToRect for similar behavior.
156 */ 169 */
157 void drawRect(SkCanvas*, const SkRect* src, const SkRect& dst, const SkPaint *) const; 170 void drawRect(SkCanvas*, const SkRect* src, const SkRect& dst, const SkPaint *) const;
158 }; 171 };
159 172
160 #endif 173 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine