Commit e15a3024 authored by mtklein's avatar mtklein Committed by Commit bot

Set OS X widget bitmaps immutable, and while we're here use setMatrix().

I've been playing around with a build of Chrome that asserts all bitmaps
recorded into pictures are immutable.  Most are, but this one popped out
on sites that use native widgets (checkboxes, text fields, etc.).

While we're here, we can just call SkCanvas::setMatrix() instead of
concating the matrix with its inverse.  That works fine with SkPicture now.

BUG=

Review URL: https://codereview.chromium.org/801553002

Cr-Commit-Position: refs/heads/master@{#308088}
parent acb1e62d
...@@ -376,16 +376,9 @@ void SkiaBitLocker::releaseIfNeeded() { ...@@ -376,16 +376,9 @@ void SkiaBitLocker::releaseIfNeeded() {
if (!bitmap_.extractSubset(&subset, bounds)) { if (!bitmap_.extractSubset(&subset, bounds)) {
return; return;
} }
// Neutralize the global matrix by concatenating the inverse. In the subset.setImmutable(); // Prevents a defensive copy inside Skia.
// future, Skia may provide some mechanism to set the device portion of
// the matrix to identity without clobbering any hosting matrix (e.g., the
// picture's matrix).
const SkMatrix& skMatrix = canvas_->getTotalMatrix();
SkMatrix inverse;
if (!skMatrix.invert(&inverse))
return;
canvas_->save(); canvas_->save();
canvas_->concat(inverse); canvas_->setMatrix(SkMatrix::I()); // Reset back to device space.
canvas_->translate(bounds.x() + bitmapOffset_.x(), canvas_->translate(bounds.x() + bitmapOffset_.x(),
bounds.y() + bitmapOffset_.y()); bounds.y() + bitmapOffset_.y());
canvas_->scale(1.f / bitmapScaleFactor_, 1.f / bitmapScaleFactor_); canvas_->scale(1.f / bitmapScaleFactor_, 1.f / bitmapScaleFactor_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment