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 /** Set the current draw depth of the canvas. | |
| 448 @param z The integer depth, intended between 0 - 255 inclusive | |
| 449 0 is lowest (into screen), 255 is highest (out of screen) | |
| 450 */ | |
|
robertphillips
2016/07/07 20:43:08
I don't think Z can be restricted to the index ran
vjiaoblack
2016/07/08 17:13:47
Done.
| |
| 451 void setZ(uint32_t z) { | |
|
Brian Osman
2016/07/07 20:06:37
If this (and the member variable, getter, etc...)
vjiaoblack
2016/07/08 17:13:47
Acknowledged.
| |
| 452 this->fCurDrawDepth = z; | |
| 453 this->didSetZ(z); | |
| 454 } | |
| 455 | |
| 456 /** Returns the current draw depth of the canvas. | |
| 457 */ | |
| 458 uint32_t getZ() const { return this->fCurDrawDepth; } | |
| 459 | |
| 447 /** | 460 /** |
| 448 * Modify the current clip with the specified rectangle. | 461 * Modify the current clip with the specified rectangle. |
| 449 * @param rect The rect to combine with the current clip | 462 * @param rect The rect to combine with the current clip |
| 450 * @param op The region op to apply to the current clip | 463 * @param op The region op to apply to the current clip |
| 451 * @param doAntiAlias true if the clip should be antialiased | 464 * @param doAntiAlias true if the clip should be antialiased |
| 452 */ | 465 */ |
| 453 void clipRect(const SkRect& rect, | 466 void clipRect(const SkRect& rect, |
| 454 SkRegion::Op op = SkRegion::kIntersect_Op, | 467 SkRegion::Op op = SkRegion::kIntersect_Op, |
| 455 bool doAntiAlias = false); | 468 bool doAntiAlias = false); |
| 456 | 469 |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1300 | 1313 |
| 1301 virtual void willSave() {} | 1314 virtual void willSave() {} |
| 1302 // Overriders should call the corresponding INHERITED method up the inherita nce chain. | 1315 // Overriders should call the corresponding INHERITED method up the inherita nce chain. |
| 1303 virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) { | 1316 virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) { |
| 1304 return kFullLayer_SaveLayerStrategy; | 1317 return kFullLayer_SaveLayerStrategy; |
| 1305 } | 1318 } |
| 1306 virtual void willRestore() {} | 1319 virtual void willRestore() {} |
| 1307 virtual void didRestore() {} | 1320 virtual void didRestore() {} |
| 1308 virtual void didConcat(const SkMatrix&) {} | 1321 virtual void didConcat(const SkMatrix&) {} |
| 1309 virtual void didSetMatrix(const SkMatrix&) {} | 1322 virtual void didSetMatrix(const SkMatrix&) {} |
| 1323 virtual void didSetZ(const uint32_t) {} | |
| 1310 | 1324 |
| 1311 virtual void onDrawAnnotation(const SkRect&, const char key[], SkData* value ); | 1325 virtual void onDrawAnnotation(const SkRect&, const char key[], SkData* value ); |
| 1312 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); | 1326 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); |
| 1313 | 1327 |
| 1314 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, | 1328 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, |
| 1315 SkScalar y, const SkPaint& paint); | 1329 SkScalar y, const SkPaint& paint); |
| 1316 | 1330 |
| 1317 virtual void onDrawPosText(const void* text, size_t byteLength, | 1331 virtual void onDrawPosText(const void* text, size_t byteLength, |
| 1318 const SkPoint pos[], const SkPaint& paint); | 1332 const SkPoint pos[], const SkPaint& paint); |
| 1319 | 1333 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1377 // is not released or deleted by the caller. | 1391 // is not released or deleted by the caller. |
| 1378 virtual SkCanvas* canvasForDrawIter(); | 1392 virtual SkCanvas* canvasForDrawIter(); |
| 1379 | 1393 |
| 1380 // Clip rectangle bounds. Called internally by saveLayer. | 1394 // Clip rectangle bounds. Called internally by saveLayer. |
| 1381 // returns false if the entire rectangle is entirely clipped out | 1395 // returns false if the entire rectangle is entirely clipped out |
| 1382 // If non-NULL, The imageFilter parameter will be used to expand the clip | 1396 // If non-NULL, The imageFilter parameter will be used to expand the clip |
| 1383 // and offscreen bounds for any margin required by the filter DAG. | 1397 // and offscreen bounds for any margin required by the filter DAG. |
| 1384 bool clipRectBounds(const SkRect* bounds, SaveLayerFlags, SkIRect* intersect ion, | 1398 bool clipRectBounds(const SkRect* bounds, SaveLayerFlags, SkIRect* intersect ion, |
| 1385 const SkImageFilter* imageFilter = NULL); | 1399 const SkImageFilter* imageFilter = NULL); |
| 1386 | 1400 |
| 1387 private: | 1401 private: |
|
robertphillips
2016/07/07 20:43:08
I think we want the Z to be a member of the MCRec
vjiaoblack
2016/07/08 17:13:47
Done.
| |
| 1402 uint32_t fCurDrawDepth = 0; | |
| 1403 | |
| 1388 static bool BoundsAffectsClip(SaveLayerFlags); | 1404 static bool BoundsAffectsClip(SaveLayerFlags); |
| 1389 static SaveLayerFlags LegacySaveFlagsToSaveLayerFlags(uint32_t legacySaveFla gs); | 1405 static SaveLayerFlags LegacySaveFlagsToSaveLayerFlags(uint32_t legacySaveFla gs); |
| 1390 | 1406 |
| 1391 enum ShaderOverrideOpacity { | 1407 enum ShaderOverrideOpacity { |
| 1392 kNone_ShaderOverrideOpacity, //!< there is no overriding shader ( bitmap or image) | 1408 kNone_ShaderOverrideOpacity, //!< there is no overriding shader ( bitmap or image) |
| 1393 kOpaque_ShaderOverrideOpacity, //!< the overriding shader is opaque | 1409 kOpaque_ShaderOverrideOpacity, //!< the overriding shader is opaque |
| 1394 kNotOpaque_ShaderOverrideOpacity, //!< the overriding shader may not b e opaque | 1410 kNotOpaque_ShaderOverrideOpacity, //!< the overriding shader may not b e opaque |
| 1395 }; | 1411 }; |
| 1396 | 1412 |
| 1397 // notify our surface (if we have one) that we are about to draw, so it | 1413 // notify our surface (if we have one) that we are about to draw, so it |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1585 | 1601 |
| 1586 class SkCanvasClipVisitor { | 1602 class SkCanvasClipVisitor { |
| 1587 public: | 1603 public: |
| 1588 virtual ~SkCanvasClipVisitor(); | 1604 virtual ~SkCanvasClipVisitor(); |
| 1589 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1605 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
| 1590 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1606 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
| 1591 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1607 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
| 1592 }; | 1608 }; |
| 1593 | 1609 |
| 1594 #endif | 1610 #endif |
| OLD | NEW |