Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / platform / graphics / InterceptingCanvas.cpp
blob66907aa665dcbb315e35ba713c1ac9644836c8de
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "config.h"
6 #include "platform/graphics/InterceptingCanvas.h"
8 namespace blink {
10 void InterceptingCanvasBase::unrollDrawPicture(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint, SkPicture::AbortCallback* abortCallback)
12 int saveCount = this->getSaveCount();
13 if (paint) {
14 SkRect newBounds = picture->cullRect();
15 if (matrix)
16 matrix->mapRect(&newBounds);
17 this->saveLayer(&newBounds, paint);
18 } else if (matrix) {
19 this->save();
21 if (matrix)
22 this->concat(*matrix);
24 picture->playback(this, abortCallback);
26 this->restoreToCount(saveCount);
29 } // namespace blink