OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
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 #include "SkView.h" | 8 #include "SkView.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 | 10 |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 while (view) | 601 while (view) |
602 { | 602 { |
603 matrix->preConcat(view->getLocalMatrix()); | 603 matrix->preConcat(view->getLocalMatrix()); |
604 matrix->preTranslate(-view->fLoc.fX, -view->fLoc.fY); | 604 matrix->preTranslate(-view->fLoc.fX, -view->fLoc.fY); |
605 view = view->fParent; | 605 view = view->fParent; |
606 } | 606 } |
607 } | 607 } |
608 } | 608 } |
609 | 609 |
610 bool SkView::globalToLocal(SkScalar x, SkScalar y, SkPoint* local) const { | 610 bool SkView::globalToLocal(SkScalar x, SkScalar y, SkPoint* local) const { |
611 SkASSERT(this); | |
612 | |
613 if (local) { | 611 if (local) { |
614 SkMatrix m; | 612 SkMatrix m; |
615 this->localToGlobal(&m); | 613 this->localToGlobal(&m); |
616 if (!m.invert(&m)) { | 614 if (!m.invert(&m)) { |
617 return false; | 615 return false; |
618 } | 616 } |
619 SkPoint p; | 617 SkPoint p; |
620 m.mapXY(x, y, &p); | 618 m.mapXY(x, y, &p); |
621 local->set(p.fX, p.fY); | 619 local->set(p.fX, p.fY); |
622 } | 620 } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 ONELINER: | 801 ONELINER: |
804 SkDebugf(" />\n"); | 802 SkDebugf(" />\n"); |
805 } | 803 } |
806 } | 804 } |
807 | 805 |
808 void SkView::dump(bool recurse) const { | 806 void SkView::dump(bool recurse) const { |
809 dumpview(this, 0, recurse); | 807 dumpview(this, 0, recurse); |
810 } | 808 } |
811 | 809 |
812 #endif | 810 #endif |
OLD | NEW |