OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 SkCanvas_DEFINED | 8 #ifndef SkCanvas_DEFINED |
9 #define SkCanvas_DEFINED | 9 #define SkCanvas_DEFINED |
10 | 10 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 /** | 180 /** |
181 * Create a new surface matching the specified info, one that attempts to | 181 * Create a new surface matching the specified info, one that attempts to |
182 * be maximally compatible when used with this canvas. If there is no match
ing Surface type, | 182 * be maximally compatible when used with this canvas. If there is no match
ing Surface type, |
183 * NULL is returned. | 183 * NULL is returned. |
184 * | 184 * |
185 * If surfaceprops is specified, those are passed to the new surface, other
wise the new surface | 185 * If surfaceprops is specified, those are passed to the new surface, other
wise the new surface |
186 * inherits the properties of the surface that owns this canvas. If this ca
nvas has no parent | 186 * inherits the properties of the surface that owns this canvas. If this ca
nvas has no parent |
187 * surface, then the new surface is created with default properties. | 187 * surface, then the new surface is created with default properties. |
188 */ | 188 */ |
189 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps* = NULL); | 189 sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps* = nul
lptr); |
| 190 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API |
| 191 SkSurface* newSurface(const SkImageInfo& info, const SkSurfaceProps* props =
NULL); |
| 192 #endif |
190 | 193 |
191 /** | 194 /** |
192 * Return the GPU context of the device that is associated with the canvas. | 195 * Return the GPU context of the device that is associated with the canvas. |
193 * For a canvas with non-GPU device, NULL is returned. | 196 * For a canvas with non-GPU device, NULL is returned. |
194 */ | 197 */ |
195 GrContext* getGrContext(); | 198 GrContext* getGrContext(); |
196 | 199 |
197 /////////////////////////////////////////////////////////////////////////// | 200 /////////////////////////////////////////////////////////////////////////// |
198 | 201 |
199 /** | 202 /** |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 // TEMP helpers until we switch virtual over to const& for src-rect | 1248 // TEMP helpers until we switch virtual over to const& for src-rect |
1246 void legacy_drawImageRect(const SkImage* image, const SkRect* src, const SkR
ect& dst, | 1249 void legacy_drawImageRect(const SkImage* image, const SkRect* src, const SkR
ect& dst, |
1247 const SkPaint* paint, | 1250 const SkPaint* paint, |
1248 SrcRectConstraint constraint = kStrict_SrcRectCons
traint); | 1251 SrcRectConstraint constraint = kStrict_SrcRectCons
traint); |
1249 void legacy_drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const
SkRect& dst, | 1252 void legacy_drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const
SkRect& dst, |
1250 const SkPaint* paint, | 1253 const SkPaint* paint, |
1251 SrcRectConstraint constraint = kStrict_SrcRectCon
straint); | 1254 SrcRectConstraint constraint = kStrict_SrcRectCon
straint); |
1252 | 1255 |
1253 protected: | 1256 protected: |
1254 // default impl defers to getDevice()->newSurface(info) | 1257 // default impl defers to getDevice()->newSurface(info) |
1255 virtual SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&); | 1258 virtual sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfacePro
ps&); |
1256 | 1259 |
1257 // default impl defers to its device | 1260 // default impl defers to its device |
1258 virtual bool onPeekPixels(SkPixmap*); | 1261 virtual bool onPeekPixels(SkPixmap*); |
1259 virtual bool onAccessTopLayerPixels(SkPixmap*); | 1262 virtual bool onAccessTopLayerPixels(SkPixmap*); |
1260 | 1263 |
1261 // Subclass save/restore notifiers. | 1264 // Subclass save/restore notifiers. |
1262 // Overriders should call the corresponding INHERITED method up the inherita
nce chain. | 1265 // Overriders should call the corresponding INHERITED method up the inherita
nce chain. |
1263 // getSaveLayerStrategy()'s return value may suppress full layer allocation. | 1266 // getSaveLayerStrategy()'s return value may suppress full layer allocation. |
1264 enum SaveLayerStrategy { | 1267 enum SaveLayerStrategy { |
1265 kFullLayer_SaveLayerStrategy, | 1268 kFullLayer_SaveLayerStrategy, |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 | 1554 |
1552 class SkCanvasClipVisitor { | 1555 class SkCanvasClipVisitor { |
1553 public: | 1556 public: |
1554 virtual ~SkCanvasClipVisitor(); | 1557 virtual ~SkCanvasClipVisitor(); |
1555 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1558 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1556 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1559 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1557 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1560 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1558 }; | 1561 }; |
1559 | 1562 |
1560 #endif | 1563 #endif |
OLD | NEW |