diff options
author | tomhudson <tomhudson@google.com> | 2016-05-18 07:24:16 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-18 07:24:16 -0700 |
commit | cb3bd18a4b787f6281930dbe49e1c430f28a367c (patch) | |
tree | 1c32f57742e253980f7480196c9d529ebd074c9b /src/core | |
parent | 3ab53d0c778704111a72b7107154ade4aa536232 (diff) |
SkCanvas::adjustToTopLayer()
Given a matrix and a clip bounds, offsets them to reflect the difference
between device coordinates and global coordinates. Useful when a client
wants an OS-specific backing for a canvas.
R=reed@google.com
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1986383002
Review-Url: https://codereview.chromium.org/1986383002
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkCanvas.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 56a42c3f50..4150a9a55b 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -2036,6 +2036,18 @@ void SkCanvas::legacy_drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, } } +void SkCanvas::temporary_internal_describeTopLayer(SkMatrix* matrix, SkIRect* clip_bounds) { + SkIRect layer_bounds = this->getTopLayerBounds(); + if (matrix) { + *matrix = this->getTotalMatrix(); + matrix->preTranslate(-layer_bounds.left(), -layer_bounds.top()); + } + if (clip_bounds) { + this->getClipDeviceBounds(clip_bounds); + clip_bounds->offset(-layer_bounds.left(), -layer_bounds.top()); + } +} + ////////////////////////////////////////////////////////////////////////////// // These are the virtual drawing methods ////////////////////////////////////////////////////////////////////////////// |