| 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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 444 |
| 445 /** Replace the current matrix with a copy of the specified matrix. | 445 /** Replace the current matrix with a copy of the specified matrix. |
| 446 @param matrix The matrix that will be copied into the current matrix. | 446 @param matrix The matrix that will be copied into the current matrix. |
| 447 */ | 447 */ |
| 448 void setMatrix(const SkMatrix& matrix); | 448 void setMatrix(const SkMatrix& matrix); |
| 449 | 449 |
| 450 /** Helper for setMatrix(identity). Sets the current matrix to identity. | 450 /** Helper for setMatrix(identity). Sets the current matrix to identity. |
| 451 */ | 451 */ |
| 452 void resetMatrix(); | 452 void resetMatrix(); |
| 453 | 453 |
| 454 /** Add the specified translation to the current draw depth of the canvas. | |
| 455 @param z The distance to translate in Z. | |
| 456 Negative into screen, positive out of screen. | |
| 457 Without translation, the draw depth defaults to 0. | |
| 458 */ | |
| 459 void translateZ(SkScalar z); | |
| 460 | |
| 461 /** | 454 /** |
| 462 * Modify the current clip with the specified rectangle. | 455 * Modify the current clip with the specified rectangle. |
| 463 * @param rect The rect to combine with the current clip | 456 * @param rect The rect to combine with the current clip |
| 464 * @param op The region op to apply to the current clip | 457 * @param op The region op to apply to the current clip |
| 465 * @param doAntiAlias true if the clip should be antialiased | 458 * @param doAntiAlias true if the clip should be antialiased |
| 466 */ | 459 */ |
| 467 void clipRect(const SkRect& rect, | 460 void clipRect(const SkRect& rect, |
| 468 SkRegion::Op op = SkRegion::kIntersect_Op, | 461 SkRegion::Op op = SkRegion::kIntersect_Op, |
| 469 bool doAntiAlias = false); | 462 bool doAntiAlias = false); |
| 470 | 463 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 501 */ | 494 */ |
| 502 void setAllowSimplifyClip(bool allow) { | 495 void setAllowSimplifyClip(bool allow) { |
| 503 fAllowSimplifyClip = allow; | 496 fAllowSimplifyClip = allow; |
| 504 } | 497 } |
| 505 | 498 |
| 506 /** Modify the current clip with the specified region. Note that unlike | 499 /** Modify the current clip with the specified region. Note that unlike |
| 507 clipRect() and clipPath() which transform their arguments by the current | 500 clipRect() and clipPath() which transform their arguments by the current |
| 508 matrix, clipRegion() assumes its argument is already in device | 501 matrix, clipRegion() assumes its argument is already in device |
| 509 coordinates, and so no transformation is performed. | 502 coordinates, and so no transformation is performed. |
| 510 @param deviceRgn The region to apply to the current clip | 503 @param deviceRgn The region to apply to the current clip |
| 511 @param op The regio | 504 @param op The region op to apply to the current clip |
| 512 n op to apply to the current clip | |
| 513 */ | 505 */ |
| 514 void clipRegion(const SkRegion& deviceRgn, | 506 void clipRegion(const SkRegion& deviceRgn, |
| 515 SkRegion::Op op = SkRegion::kIntersect_Op); | 507 SkRegion::Op op = SkRegion::kIntersect_Op); |
| 516 | 508 |
| 517 /** Helper for clipRegion(rgn, kReplace_Op). Sets the current clip to the | 509 /** Helper for clipRegion(rgn, kReplace_Op). Sets the current clip to the |
| 518 specified region. This does not intersect or in any other way account | 510 specified region. This does not intersect or in any other way account |
| 519 for the existing clip region. | 511 for the existing clip region. |
| 520 @param deviceRgn The region to copy into the current clip. | 512 @param deviceRgn The region to copy into the current clip. |
| 521 */ | 513 */ |
| 522 void setClipRegion(const SkRegion& deviceRgn) { | 514 void setClipRegion(const SkRegion& deviceRgn) { |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1261 const SkPaint* paint, | 1253 const SkPaint* paint, |
| 1262 SrcRectConstraint constraint = kStrict_SrcRectCon
straint); | 1254 SrcRectConstraint constraint = kStrict_SrcRectCon
straint); |
| 1263 | 1255 |
| 1264 // expose minimum amount of information necessary for transitional refactori
ng | 1256 // expose minimum amount of information necessary for transitional refactori
ng |
| 1265 /** | 1257 /** |
| 1266 * Returns CTM and clip bounds, translated from canvas coordinates to top la
yer coordinates. | 1258 * Returns CTM and clip bounds, translated from canvas coordinates to top la
yer coordinates. |
| 1267 */ | 1259 */ |
| 1268 void temporary_internal_describeTopLayer(SkMatrix* matrix, SkIRect* clip_bou
nds); | 1260 void temporary_internal_describeTopLayer(SkMatrix* matrix, SkIRect* clip_bou
nds); |
| 1269 | 1261 |
| 1270 protected: | 1262 protected: |
| 1271 /** Returns the current (cumulative) draw depth of the canvas. | |
| 1272 */ | |
| 1273 SkScalar getZ() const; | |
| 1274 | |
| 1275 /** After calling saveLayer(), there can be any number of devices that make | 1263 /** After calling saveLayer(), there can be any number of devices that make |
| 1276 up the top-most drawing area. LayerIter can be used to iterate through | 1264 up the top-most drawing area. LayerIter can be used to iterate through |
| 1277 those devices. Note that the iterator is only valid until the next API | 1265 those devices. Note that the iterator is only valid until the next API |
| 1278 call made on the canvas. Ownership of all pointers in the iterator stays | 1266 call made on the canvas. Ownership of all pointers in the iterator stays |
| 1279 with the canvas, so none of them should be modified or deleted. | 1267 with the canvas, so none of them should be modified or deleted. |
| 1280 */ | 1268 */ |
| 1281 class LayerIter /*: SkNoncopyable*/ { | 1269 class LayerIter /*: SkNoncopyable*/ { |
| 1282 public: | 1270 public: |
| 1283 /** Initialize iterator with canvas, and set values for 1st device */ | 1271 /** Initialize iterator with canvas, and set values for 1st device */ |
| 1284 LayerIter(SkCanvas*, bool skipEmptyClips); | 1272 LayerIter(SkCanvas*, bool skipEmptyClips); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 | 1318 |
| 1331 virtual void willSave() {} | 1319 virtual void willSave() {} |
| 1332 // Overriders should call the corresponding INHERITED method up the inherita
nce chain. | 1320 // Overriders should call the corresponding INHERITED method up the inherita
nce chain. |
| 1333 virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) { | 1321 virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) { |
| 1334 return kFullLayer_SaveLayerStrategy; | 1322 return kFullLayer_SaveLayerStrategy; |
| 1335 } | 1323 } |
| 1336 virtual void willRestore() {} | 1324 virtual void willRestore() {} |
| 1337 virtual void didRestore() {} | 1325 virtual void didRestore() {} |
| 1338 virtual void didConcat(const SkMatrix&) {} | 1326 virtual void didConcat(const SkMatrix&) {} |
| 1339 virtual void didSetMatrix(const SkMatrix&) {} | 1327 virtual void didSetMatrix(const SkMatrix&) {} |
| 1340 virtual void didTranslateZ(SkScalar) {} | |
| 1341 | 1328 |
| 1342 virtual void onDrawAnnotation(const SkRect&, const char key[], SkData* value
); | 1329 virtual void onDrawAnnotation(const SkRect&, const char key[], SkData* value
); |
| 1343 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); | 1330 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); |
| 1344 | 1331 |
| 1345 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, | 1332 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, |
| 1346 SkScalar y, const SkPaint& paint); | 1333 SkScalar y, const SkPaint& paint); |
| 1347 | 1334 |
| 1348 virtual void onDrawPosText(const void* text, size_t byteLength, | 1335 virtual void onDrawPosText(const void* text, size_t byteLength, |
| 1349 const SkPoint pos[], const SkPaint& paint); | 1336 const SkPoint pos[], const SkPaint& paint); |
| 1350 | 1337 |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1618 | 1605 |
| 1619 class SkCanvasClipVisitor { | 1606 class SkCanvasClipVisitor { |
| 1620 public: | 1607 public: |
| 1621 virtual ~SkCanvasClipVisitor(); | 1608 virtual ~SkCanvasClipVisitor(); |
| 1622 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1609 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
| 1623 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1610 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
| 1624 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1611 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
| 1625 }; | 1612 }; |
| 1626 | 1613 |
| 1627 #endif | 1614 #endif |
| OLD | NEW |