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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 happen. If exact clipping is desired, use clipRect(). | 329 happen. If exact clipping is desired, use clipRect(). |
330 @param paint (may be null) This is copied, and is applied to the | 330 @param paint (may be null) This is copied, and is applied to the |
331 offscreen when restore() is called | 331 offscreen when restore() is called |
332 @return The value to pass to restoreToCount() to balance this save() | 332 @return The value to pass to restoreToCount() to balance this save() |
333 */ | 333 */ |
334 int saveLayer(const SkRect* bounds, const SkPaint* paint); | 334 int saveLayer(const SkRect* bounds, const SkPaint* paint); |
335 int saveLayer(const SkRect& bounds, const SkPaint* paint) { | 335 int saveLayer(const SkRect& bounds, const SkPaint* paint) { |
336 return this->saveLayer(&bounds, paint); | 336 return this->saveLayer(&bounds, paint); |
337 } | 337 } |
338 | 338 |
| 339 /** |
| 340 * Temporary name. |
| 341 * Will allow any requests for LCD text to be respected, so the caller must
be careful to |
| 342 * only draw on top of opaque sections of the layer to get good results. |
| 343 */ |
| 344 int saveLayerPreserveLCDTextRequests(const SkRect* bounds, const SkPaint* pa
int); |
| 345 |
339 /** DEPRECATED - use saveLayer(const SkRect*, const SkPaint*) instead. | 346 /** DEPRECATED - use saveLayer(const SkRect*, const SkPaint*) instead. |
340 | 347 |
341 This behaves the same as saveLayer(const SkRect*, const SkPaint*), | 348 This behaves the same as saveLayer(const SkRect*, const SkPaint*), |
342 but it allows fine-grained control of which state bits to be saved | 349 but it allows fine-grained control of which state bits to be saved |
343 (and subsequently restored). | 350 (and subsequently restored). |
344 | 351 |
345 @param bounds (may be null) This rect, if non-null, is used as a hint to | 352 @param bounds (may be null) This rect, if non-null, is used as a hint to |
346 limit the size of the offscreen, and thus drawing may be | 353 limit the size of the offscreen, and thus drawing may be |
347 clipped to it, though that clipping is not guaranteed to | 354 clipped to it, though that clipping is not guaranteed to |
348 happen. If exact clipping is desired, use clipRect(). | 355 happen. If exact clipping is desired, use clipRect(). |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 | 1316 |
1310 // Clip rectangle bounds. Called internally by saveLayer. | 1317 // Clip rectangle bounds. Called internally by saveLayer. |
1311 // returns false if the entire rectangle is entirely clipped out | 1318 // returns false if the entire rectangle is entirely clipped out |
1312 // If non-NULL, The imageFilter parameter will be used to expand the clip | 1319 // If non-NULL, The imageFilter parameter will be used to expand the clip |
1313 // and offscreen bounds for any margin required by the filter DAG. | 1320 // and offscreen bounds for any margin required by the filter DAG. |
1314 bool clipRectBounds(const SkRect* bounds, SaveFlags flags, | 1321 bool clipRectBounds(const SkRect* bounds, SaveFlags flags, |
1315 SkIRect* intersection, | 1322 SkIRect* intersection, |
1316 const SkImageFilter* imageFilter = NULL); | 1323 const SkImageFilter* imageFilter = NULL); |
1317 | 1324 |
1318 private: | 1325 private: |
| 1326 enum PrivateSaveFlags { |
| 1327 // These must not overlap the public flags. |
| 1328 kPreserveLCDText_PrivateSaveFlag = 1 << 5, |
| 1329 }; |
| 1330 |
1319 enum ShaderOverrideOpacity { | 1331 enum ShaderOverrideOpacity { |
1320 kNone_ShaderOverrideOpacity, //!< there is no overriding shader (
bitmap or image) | 1332 kNone_ShaderOverrideOpacity, //!< there is no overriding shader (
bitmap or image) |
1321 kOpaque_ShaderOverrideOpacity, //!< the overriding shader is opaque | 1333 kOpaque_ShaderOverrideOpacity, //!< the overriding shader is opaque |
1322 kNotOpaque_ShaderOverrideOpacity, //!< the overriding shader may not b
e opaque | 1334 kNotOpaque_ShaderOverrideOpacity, //!< the overriding shader may not b
e opaque |
1323 }; | 1335 }; |
1324 | 1336 |
1325 // notify our surface (if we have one) that we are about to draw, so it | 1337 // notify our surface (if we have one) that we are about to draw, so it |
1326 // can perform copy-on-write or invalidate any cached images | 1338 // can perform copy-on-write or invalidate any cached images |
1327 void predrawNotify(bool willOverwritesEntireSurface = false); | 1339 void predrawNotify(bool willOverwritesEntireSurface = false); |
1328 void predrawNotify(const SkRect* rect, const SkPaint* paint, ShaderOverrideO
pacity); | 1340 void predrawNotify(const SkRect* rect, const SkPaint* paint, ShaderOverrideO
pacity); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 | 1577 |
1566 class SkCanvasClipVisitor { | 1578 class SkCanvasClipVisitor { |
1567 public: | 1579 public: |
1568 virtual ~SkCanvasClipVisitor(); | 1580 virtual ~SkCanvasClipVisitor(); |
1569 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1581 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1570 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1582 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1571 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1583 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1572 }; | 1584 }; |
1573 | 1585 |
1574 #endif | 1586 #endif |
OLD | NEW |