Chromium Code Reviews| 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 /** Change the current draw depth of the canvas with a translation. | |
|
jvanverth1
2016/07/13 13:54:24
Suggestion: Add the specified translation to the c
vjiaoblack
2016/07/13 14:55:43
Done.
| |
| 448 @param z The SkScalar depth; it's tracked in the save/restore stack. | |
| 449 Negative into screen, positive out of screen. | |
| 450 Defaults to 0. | |
| 451 */ | |
| 452 void translateZ(SkScalar z); | |
| 453 | |
| 447 /** | 454 /** |
| 448 * Modify the current clip with the specified rectangle. | 455 * Modify the current clip with the specified rectangle. |
| 449 * @param rect The rect to combine with the current clip | 456 * @param rect The rect to combine with the current clip |
| 450 * @param op The region op to apply to the current clip | 457 * @param op The region op to apply to the current clip |
| 451 * @param doAntiAlias true if the clip should be antialiased | 458 * @param doAntiAlias true if the clip should be antialiased |
| 452 */ | 459 */ |
| 453 void clipRect(const SkRect& rect, | 460 void clipRect(const SkRect& rect, |
| 454 SkRegion::Op op = SkRegion::kIntersect_Op, | 461 SkRegion::Op op = SkRegion::kIntersect_Op, |
| 455 bool doAntiAlias = false); | 462 bool doAntiAlias = false); |
| 456 | 463 |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1238 const SkPaint* paint, | 1245 const SkPaint* paint, |
| 1239 SrcRectConstraint constraint = kStrict_SrcRectCon straint); | 1246 SrcRectConstraint constraint = kStrict_SrcRectCon straint); |
| 1240 | 1247 |
| 1241 // expose minimum amount of information necessary for transitional refactori ng | 1248 // expose minimum amount of information necessary for transitional refactori ng |
| 1242 /** | 1249 /** |
| 1243 * Returns CTM and clip bounds, translated from canvas coordinates to top la yer coordinates. | 1250 * Returns CTM and clip bounds, translated from canvas coordinates to top la yer coordinates. |
| 1244 */ | 1251 */ |
| 1245 void temporary_internal_describeTopLayer(SkMatrix* matrix, SkIRect* clip_bou nds); | 1252 void temporary_internal_describeTopLayer(SkMatrix* matrix, SkIRect* clip_bou nds); |
| 1246 | 1253 |
| 1247 protected: | 1254 protected: |
| 1255 /** Returns the current (cumulative) draw depth of the canvas. | |
| 1256 */ | |
| 1257 SkScalar getZ() const; | |
| 1258 | |
| 1248 /** After calling saveLayer(), there can be any number of devices that make | 1259 /** After calling saveLayer(), there can be any number of devices that make |
| 1249 up the top-most drawing area. LayerIter can be used to iterate through | 1260 up the top-most drawing area. LayerIter can be used to iterate through |
| 1250 those devices. Note that the iterator is only valid until the next API | 1261 those devices. Note that the iterator is only valid until the next API |
| 1251 call made on the canvas. Ownership of all pointers in the iterator stays | 1262 call made on the canvas. Ownership of all pointers in the iterator stays |
| 1252 with the canvas, so none of them should be modified or deleted. | 1263 with the canvas, so none of them should be modified or deleted. |
| 1253 */ | 1264 */ |
| 1254 class LayerIter /*: SkNoncopyable*/ { | 1265 class LayerIter /*: SkNoncopyable*/ { |
| 1255 public: | 1266 public: |
| 1256 /** Initialize iterator with canvas, and set values for 1st device */ | 1267 /** Initialize iterator with canvas, and set values for 1st device */ |
| 1257 LayerIter(SkCanvas*, bool skipEmptyClips); | 1268 LayerIter(SkCanvas*, bool skipEmptyClips); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1300 | 1311 |
| 1301 virtual void willSave() {} | 1312 virtual void willSave() {} |
| 1302 // Overriders should call the corresponding INHERITED method up the inherita nce chain. | 1313 // Overriders should call the corresponding INHERITED method up the inherita nce chain. |
| 1303 virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) { | 1314 virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) { |
| 1304 return kFullLayer_SaveLayerStrategy; | 1315 return kFullLayer_SaveLayerStrategy; |
| 1305 } | 1316 } |
| 1306 virtual void willRestore() {} | 1317 virtual void willRestore() {} |
| 1307 virtual void didRestore() {} | 1318 virtual void didRestore() {} |
| 1308 virtual void didConcat(const SkMatrix&) {} | 1319 virtual void didConcat(const SkMatrix&) {} |
| 1309 virtual void didSetMatrix(const SkMatrix&) {} | 1320 virtual void didSetMatrix(const SkMatrix&) {} |
| 1321 virtual void didTranslateZ(SkScalar) {} | |
| 1310 | 1322 |
| 1311 virtual void onDrawAnnotation(const SkRect&, const char key[], SkData* value ); | 1323 virtual void onDrawAnnotation(const SkRect&, const char key[], SkData* value ); |
| 1312 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); | 1324 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); |
| 1313 | 1325 |
| 1314 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, | 1326 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, |
| 1315 SkScalar y, const SkPaint& paint); | 1327 SkScalar y, const SkPaint& paint); |
| 1316 | 1328 |
| 1317 virtual void onDrawPosText(const void* text, size_t byteLength, | 1329 virtual void onDrawPosText(const void* text, size_t byteLength, |
| 1318 const SkPoint pos[], const SkPaint& paint); | 1330 const SkPoint pos[], const SkPaint& paint); |
| 1319 | 1331 |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1585 | 1597 |
| 1586 class SkCanvasClipVisitor { | 1598 class SkCanvasClipVisitor { |
| 1587 public: | 1599 public: |
| 1588 virtual ~SkCanvasClipVisitor(); | 1600 virtual ~SkCanvasClipVisitor(); |
| 1589 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1601 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
| 1590 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1602 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
| 1591 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1603 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
| 1592 }; | 1604 }; |
| 1593 | 1605 |
| 1594 #endif | 1606 #endif |
| OLD | NEW |