Chromium Code Reviews| OLD | NEW |
|---|---|
| 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...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 specifies subset of src-pixels used for s caling. If | |
| 132 * subset extends beyond the bounds of the original image, then NULL is ret urned. | |
| 133 * | |
| 134 * Note: it is legal for the returned image to be the same instance as the src image | |
| 135 * (if the new dimensions == the src dimensions and any subset encloses the entire src). | |
| 136 */ | |
| 137 SkImage* newImage(int newWidth, int newHeight, const SkIRect* subset = NULL) const; | |
|
scroggo
2014/12/22 22:08:27
For use by Android, it might be nice to be able to
reed2
2014/12/24 19:47:26
For GPU images, it is hard to see how to supply th
scroggo
2014/12/30 11:04:40
Agreed. The more I think about it, the more I thin
| |
| 138 | |
| 127 protected: | 139 protected: |
| 128 SkImage(int width, int height) : | 140 SkImage(int width, int height) : |
| 129 fWidth(width), | 141 fWidth(width), |
| 130 fHeight(height), | 142 fHeight(height), |
| 131 fUniqueID(NextUniqueID()) { | 143 fUniqueID(NextUniqueID()) { |
| 132 | 144 |
| 133 SkASSERT(width >= 0); | 145 SkASSERT(width >= 0); |
| 134 SkASSERT(height >= 0); | 146 SkASSERT(height >= 0); |
| 135 } | 147 } |
| 136 | 148 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 151 * Draw the image, cropped to the src rect, to the dst rect of a canvas. | 163 * 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 | 164 * If src is larger than the bounds of the image, the rest of the image is |
| 153 * filled with transparent black pixels. | 165 * filled with transparent black pixels. |
| 154 * | 166 * |
| 155 * See SkCanvas::drawBitmapRectToRect for similar behavior. | 167 * See SkCanvas::drawBitmapRectToRect for similar behavior. |
| 156 */ | 168 */ |
| 157 void drawRect(SkCanvas*, const SkRect* src, const SkRect& dst, const SkPaint *) const; | 169 void drawRect(SkCanvas*, const SkRect* src, const SkRect& dst, const SkPaint *) const; |
| 158 }; | 170 }; |
| 159 | 171 |
| 160 #endif | 172 #endif |
| OLD | NEW |