| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 437 |
| 438 /** Replace the current matrix with a copy of the specified matrix. | 438 /** Replace the current matrix with a copy of the specified matrix. |
| 439 @param matrix The matrix that will be copied into the current matrix. | 439 @param matrix The matrix that will be copied into the current matrix. |
| 440 */ | 440 */ |
| 441 void setMatrix(const SkMatrix& matrix); | 441 void setMatrix(const SkMatrix& matrix); |
| 442 | 442 |
| 443 /** Helper for setMatrix(identity). Sets the current matrix to identity. | 443 /** Helper for setMatrix(identity). Sets the current matrix to identity. |
| 444 */ | 444 */ |
| 445 void resetMatrix(); | 445 void resetMatrix(); |
| 446 | 446 |
| 447 /** Add the specified translation to the current draw depth of the canvas. | |
| 448 @param z The distance to translate in Z. | |
| 449 Negative into screen, positive out of screen. | |
| 450 Without translation, the draw depth defaults to 0. | |
| 451 */ | |
| 452 void translateZ(SkScalar z); | |
| 453 | |
| 454 /** | 447 /** |
| 455 * Modify the current clip with the specified rectangle. | 448 * Modify the current clip with the specified rectangle. |
| 456 * @param rect The rect to combine with the current clip | 449 * @param rect The rect to combine with the current clip |
| 457 * @param op The region op to apply to the current clip | 450 * @param op The region op to apply to the current clip |
| 458 * @param doAntiAlias true if the clip should be antialiased | 451 * @param doAntiAlias true if the clip should be antialiased |
| 459 */ | 452 */ |
| 460 void clipRect(const SkRect& rect, | 453 void clipRect(const SkRect& rect, |
| 461 SkRegion::Op op = SkRegion::kIntersect_Op, | 454 SkRegion::Op op = SkRegion::kIntersect_Op, |
| 462 bool doAntiAlias = false); | 455 bool doAntiAlias = false); |
| 463 | 456 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 494 */ | 487 */ |
| 495 void setAllowSimplifyClip(bool allow) { | 488 void setAllowSimplifyClip(bool allow) { |
| 496 fAllowSimplifyClip = allow; | 489 fAllowSimplifyClip = allow; |
| 497 } | 490 } |
| 498 | 491 |
| 499 /** Modify the current clip with the specified region. Note that unlike | 492 /** Modify the current clip with the specified region. Note that unlike |
| 500 clipRect() and clipPath() which transform their arguments by the current | 493 clipRect() and clipPath() which transform their arguments by the current |
| 501 matrix, clipRegion() assumes its argument is already in device | 494 matrix, clipRegion() assumes its argument is already in device |
| 502 coordinates, and so no transformation is performed. | 495 coordinates, and so no transformation is performed. |
| 503 @param deviceRgn The region to apply to the current clip | 496 @param deviceRgn The region to apply to the current clip |
| 504 @param op The regio | 497 @param op The region op to apply to the current clip |
| 505 n op to apply to the current clip | |
| 506 */ | 498 */ |
| 507 void clipRegion(const SkRegion& deviceRgn, | 499 void clipRegion(const SkRegion& deviceRgn, |
| 508 SkRegion::Op op = SkRegion::kIntersect_Op); | 500 SkRegion::Op op = SkRegion::kIntersect_Op); |
| 509 | 501 |
| 510 /** Helper for clipRegion(rgn, kReplace_Op). Sets the current clip to the | 502 /** Helper for clipRegion(rgn, kReplace_Op). Sets the current clip to the |
| 511 specified region. This does not intersect or in any other way account | 503 specified region. This does not intersect or in any other way account |
| 512 for the existing clip region. | 504 for the existing clip region. |
| 513 @param deviceRgn The region to copy into the current clip. | 505 @param deviceRgn The region to copy into the current clip. |
| 514 */ | 506 */ |
| 515 void setClipRegion(const SkRegion& deviceRgn) { | 507 void setClipRegion(const SkRegion& deviceRgn) { |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 const SkPaint* paint, | 1238 const SkPaint* paint, |
| 1247 SrcRectConstraint constraint = kStrict_SrcRectCon
straint); | 1239 SrcRectConstraint constraint = kStrict_SrcRectCon
straint); |
| 1248 | 1240 |
| 1249 // expose minimum amount of information necessary for transitional refactori
ng | 1241 // expose minimum amount of information necessary for transitional refactori
ng |
| 1250 /** | 1242 /** |
| 1251 * Returns CTM and clip bounds, translated from canvas coordinates to top la
yer coordinates. | 1243 * Returns CTM and clip bounds, translated from canvas coordinates to top la
yer coordinates. |
| 1252 */ | 1244 */ |
| 1253 void temporary_internal_describeTopLayer(SkMatrix* matrix, SkIRect* clip_bou
nds); | 1245 void temporary_internal_describeTopLayer(SkMatrix* matrix, SkIRect* clip_bou
nds); |
| 1254 | 1246 |
| 1255 protected: | 1247 protected: |
| 1256 /** Returns the current (cumulative) draw depth of the canvas. | |
| 1257 */ | |
| 1258 SkScalar getZ() const; | |
| 1259 | |
| 1260 /** After calling saveLayer(), there can be any number of devices that make | 1248 /** After calling saveLayer(), there can be any number of devices that make |
| 1261 up the top-most drawing area. LayerIter can be used to iterate through | 1249 up the top-most drawing area. LayerIter can be used to iterate through |
| 1262 those devices. Note that the iterator is only valid until the next API | 1250 those devices. Note that the iterator is only valid until the next API |
| 1263 call made on the canvas. Ownership of all pointers in the iterator stays | 1251 call made on the canvas. Ownership of all pointers in the iterator stays |
| 1264 with the canvas, so none of them should be modified or deleted. | 1252 with the canvas, so none of them should be modified or deleted. |
| 1265 */ | 1253 */ |
| 1266 class LayerIter /*: SkNoncopyable*/ { | 1254 class LayerIter /*: SkNoncopyable*/ { |
| 1267 public: | 1255 public: |
| 1268 /** Initialize iterator with canvas, and set values for 1st device */ | 1256 /** Initialize iterator with canvas, and set values for 1st device */ |
| 1269 LayerIter(SkCanvas*, bool skipEmptyClips); | 1257 LayerIter(SkCanvas*, bool skipEmptyClips); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 | 1300 |
| 1313 virtual void willSave() {} | 1301 virtual void willSave() {} |
| 1314 // Overriders should call the corresponding INHERITED method up the inherita
nce chain. | 1302 // Overriders should call the corresponding INHERITED method up the inherita
nce chain. |
| 1315 virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) { | 1303 virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) { |
| 1316 return kFullLayer_SaveLayerStrategy; | 1304 return kFullLayer_SaveLayerStrategy; |
| 1317 } | 1305 } |
| 1318 virtual void willRestore() {} | 1306 virtual void willRestore() {} |
| 1319 virtual void didRestore() {} | 1307 virtual void didRestore() {} |
| 1320 virtual void didConcat(const SkMatrix&) {} | 1308 virtual void didConcat(const SkMatrix&) {} |
| 1321 virtual void didSetMatrix(const SkMatrix&) {} | 1309 virtual void didSetMatrix(const SkMatrix&) {} |
| 1322 virtual void didTranslateZ(SkScalar) {} | |
| 1323 | 1310 |
| 1324 virtual void onDrawAnnotation(const SkRect&, const char key[], SkData* value
); | 1311 virtual void onDrawAnnotation(const SkRect&, const char key[], SkData* value
); |
| 1325 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); | 1312 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); |
| 1326 | 1313 |
| 1327 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, | 1314 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, |
| 1328 SkScalar y, const SkPaint& paint); | 1315 SkScalar y, const SkPaint& paint); |
| 1329 | 1316 |
| 1330 virtual void onDrawPosText(const void* text, size_t byteLength, | 1317 virtual void onDrawPosText(const void* text, size_t byteLength, |
| 1331 const SkPoint pos[], const SkPaint& paint); | 1318 const SkPoint pos[], const SkPaint& paint); |
| 1332 | 1319 |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 | 1585 |
| 1599 class SkCanvasClipVisitor { | 1586 class SkCanvasClipVisitor { |
| 1600 public: | 1587 public: |
| 1601 virtual ~SkCanvasClipVisitor(); | 1588 virtual ~SkCanvasClipVisitor(); |
| 1602 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1589 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
| 1603 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1590 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
| 1604 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1591 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
| 1605 }; | 1592 }; |
| 1606 | 1593 |
| 1607 #endif | 1594 #endif |
| OLD | NEW |